RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Portraits in save menu?

0 Members and 1 Guest are viewing this topic.

**
Rep: +0/-0Level 83
Hello again!
I've been trying to figure this out by looking up instances where faces are drawn in other menus and trying to duplicate it.. but so far no go.
All I want to is to show the actors portrait (or a smaller version thereof) on the save file screen. Will probably have to move it around until I find just the right spot for it.. using x,y chords.. but honestly I have no idea of how to do this at all.

I searched on here and on another rmvx/xp site but no luck yet.

Can anyone help me out with this? Sorry for the newbishness, but I am learning slowly

Thanks

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Look at:
Code: [Select]
  #--------------------------------------------------------------------------
  # * Draw Party Characters
  #     x : Draw spot X coordinate
  #     y : Draw spot Y coordinate
  #--------------------------------------------------------------------------
  def draw_party_characters(x, y)
    for i in 0...@characters.size
      name = @characters[i][0]
      index = @characters[i][1]
      draw_character(name, index, x + i * 48, y)
    end
  end

You'll need to do something similar. Except, instead of draw_character, you'll want to
Code: [Select]
draw_face (name, index, x, y)

More importantly, however, you need to retrieve the actor data from the save file. What I would do is I would add that data to the @characters array when you save a file. Those lines are in Scene_File
Code: [Select]
  def write_save_data(file)
    characters = []
    for actor in $game_party.members
      characters.push([actor.character_name, actor.character_index])
    end

Change it to:

Code: [Select]
  def write_save_data(file)
    characters = []
    for actor in $game_party.members
      characters.push([actor.character_name, actor.character_index, actor.face_name, actor.face_index])
    end

Then this code would work for drawing faces back in Window_SaveFile:

Code: [Select]
  #--------------------------------------------------------------------------
  # * Draw Party Faces
  #     x : Draw spot X coordinate
  #     y : Draw spot Y coordinate
  #--------------------------------------------------------------------------
  def draw_party_faces(x, y)
    for i in 0...@characters.size
      name = @characters[i][2]
      index = @characters[i][3]
      draw_face (name, index, x + i * 48, y)
    end
  end

That would corrupt all old save files though, so you'd need to delete them all.


**
Rep: +0/-0Level 83
I really appreciate your help. I guess it was far more complicated to do something simple than I thought..
I was wondering if you tested this though? The portraits aren't showing up, but maybe I did something wrong. I don't get any syntax errors though and I deleted the old save file and started a new one. Ideas? Is it just not showing up because of the coords?

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Well, you need to call that method somewhere. It is pretty simple in any case, you just need to load the data from the save file to draw it.

You need to draw it in the refresh method, so something like:

Code: [Select]

  def refresh
    self.contents.clear
    self.contents.font.color = normal_color
    name = Vocab::File + " #{@file_index + 1}"
    self.contents.draw_text(4, 0, 200, WLH, name)
    @name_width = contents.text_size(name).width
    if @file_exist
      draw_party_characters(152, 58)
      draw_party_faces (152, 58)
      draw_playtime(0, 34, contents.width - 4, 2)
    end
  end

I assume you'll want to play around with the coordinates in the draw_party_faces method of course.

**
Rep: +0/-0Level 83
For some reason it is not showing up, however I messed with the coordinates a little and after that one of my character sprites vanished.. almost as if it got covered up, but there was no visible picture.

I'm kinda lost.. haha

Code: [Select]
#==============================================================================
# ** Window_SaveFile
#------------------------------------------------------------------------------
#  This window displays save files on the save and load screens.
#==============================================================================

class Window_SaveFile < Window_Base
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader   :filename                 # filename
  attr_reader   :file_exist               # file existence flag
  attr_reader   :time_stamp               # timestamp
  attr_reader   :selected                 # selected
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     file_index : save file index (0-3)
  #     filename   : filename
  #--------------------------------------------------------------------------
  def initialize(file_index, filename)
    super(0, 56 + file_index % 4 * 90, 544, 90)
    @file_index = file_index
    @filename = filename
    load_gamedata
    refresh
    @selected = false
  end
  #--------------------------------------------------------------------------
  # * Load Partial Game Data
  #    By default, switches and variables are not used (for expansion use,
  #    such as displaying place names)
  #--------------------------------------------------------------------------
  def load_gamedata
    @time_stamp = Time.at(0)
    @file_exist = FileTest.exist?(@filename)
    if @file_exist
      file = File.open(@filename, "r")
      @time_stamp = file.mtime
      begin
        @characters     = Marshal.load(file)
        @frame_count    = Marshal.load(file)
        @last_bgm       = Marshal.load(file)
        @last_bgs       = Marshal.load(file)
        @game_system    = Marshal.load(file)
        @game_message   = Marshal.load(file)
        @game_switches  = Marshal.load(file)
        @game_variables = Marshal.load(file)
        @total_sec = @frame_count / Graphics.frame_rate
      rescue
        @file_exist = false
      ensure
        file.close
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = normal_color
    name = Vocab::File + " #{@file_index + 1}"
    self.contents.draw_text(4, 0, 200, WLH, name)
    @name_width = contents.text_size(name).width
    if @file_exist
      draw_party_characters(152, 58)
      draw_playtime(0, 34, contents.width - 4, 2)
    end
  end
 
  def refresh
    self.contents.clear
    self.contents.font.color = normal_color
    name = Vocab::File + " #{@file_index + 1}"
    self.contents.draw_text(4, 0, 200, WLH, name)
    @name_width = contents.text_size(name).width
    if @file_exist
      draw_party_characters(175, 100)
      draw_party_faces (152, 58)
      draw_playtime(0, 34, contents.width - 4, 2)
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Party Characters
  #     x : Draw spot X coordinate
  #     y : Draw spot Y coordinate
  #--------------------------------------------------------------------------
  def draw_party_characters(x, y)
    for i in 0...@characters.size
      name = @characters[i][0]
      index = @characters[i][1]
      draw_character(name, index, x + i * 48, y)
    end
  end
 #--------------------------------------------------------------------------
  # * Draw Party Faces
  #     x : Draw spot X coordinate
  #     y : Draw spot Y coordinate
  #--------------------------------------------------------------------------
  def draw_party_faces(x, y)
    for i in 0...@characters.size
      name = @characters[i][2]
      index = @characters[i][3]
      draw_face (name, index, x + i * 48, y)
    end
  end
 
 
  #--------------------------------------------------------------------------
  # * Draw Play Time
  #     x : Draw spot X coordinate
  #     y : Draw spot Y coordinate
  #     width : Width
  #     align : Alignment
  #--------------------------------------------------------------------------
  def draw_playtime(x, y, width, align)
    hour = @total_sec / 60 / 60
    min = @total_sec / 60 % 60
    sec = @total_sec % 60
    time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
    self.contents.font.color = normal_color
    self.contents.draw_text(x, y, width, WLH, time_string, 2)
  end
  #--------------------------------------------------------------------------
  # * Set Selected
  #     selected : new selected (true = selected, false = unselected)
  #--------------------------------------------------------------------------
  def selected=(selected)
    @selected = selected
    update_cursor
  end
  #--------------------------------------------------------------------------
  # * Update cursor
  #--------------------------------------------------------------------------
  def update_cursor
    if @selected
      self.cursor_rect.set(0, 0, @name_width + 8, WLH)
    else
      self.cursor_rect.empty
    end
  end
end
« Last Edit: May 25, 2009, 04:09:26 AM by AgentArsonist »

**
Rep: +0/-0Level 83
Did I do something wrong there?

 ???

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Well, yeah, your coordinates are way off. I told you you'd need to mess around with them. For one thing, the window is only 90 pixels high, meaning only 58 pixels are available. So drawing the files at 150, 58, is going to draw them outside of the visible window. 150, 0 makes more sense, but even still you can't possibly fit the whole face onto the file without enlarging it. Also, the way it draws x coordinates I took directly from characters with the intention that you would modify them to fit with what you have in mind, as it is it's (x + i * 48) meaning that it takes the x argument (150, from what you have) and adds 48 for each member index. So first actor at 150, second actor at 198, etc... Since faces are 96x96 you'll want to make that difference larger.

Also, if you don't want to enlarge the window, then you'll need to draw only a smaller section of the face. To do that, you would want to not use the Window_Base draw_face method and do it manually instead. You can look at the draw_face method and see how they do it, and then just make it smaller. I can help you with that if that's what you want to do. It would almost certainly be better to make extra, thinner face edits in an image editing program and use those instead.