The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: Zethzune on December 10, 2009, 02:53:07 AM

Title: [Resolved] Save Menu with Names
Post by: Zethzune on December 10, 2009, 02:53:07 AM
The default save/load menu is useless since the only way you can tell files apart is the date the save was made. My current project allows the players to set their characters own names, so I'd like to replace "File 1" etc. with the character's name - I can't figure out how to get the characters name.

In Window_SaveFile I have:
if @file_exist
# Draw character names
player_names = CharacterName1 + " & " + CharacterName2 #how the hell do I get the name out of a save?
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 600, 32, player_names)
Title: Re: Making a More Useful Save Menu
Post by: Falcon on December 10, 2009, 04:50:36 AM
for i in 0...@characters.size
player_names += @characters.name + " "
end

Try it.
Title: Re: Making a More Useful Save Menu
Post by: shaz on December 10, 2009, 07:12:16 AM

player_names += @characters[i].name + " "


Falcon's line didn't come out properly because the page interpreted it as "change to italics"
Title: Re: Making a More Useful Save Menu
Post by: Zethzune on December 10, 2009, 03:30:43 PM
That's what the Code tags are for but thanks :)

Quote from: RMXPScript 'Window_SaveFile' line 49: NoMethodError occured.
undefined method `name' for ["player", 0]:Array

I've tried a few different things by trying to mimic the way it gets a characters name elsewhere in the code with no luck. The closest I've managed so far is to get an error message with the "name" of the character - which was actually the graphic's name for that character. :l
Title: Re: Making a More Useful Save Menu
Post by: shaz on December 10, 2009, 10:15:25 PM
Ah, okay, I see what you're trying to do.  @characters has the graphics name.  The following code should work, but it won't give you what you're after.


for i in 0...@characters.size
player_names += @characters[i][0] + " "
end


For what you want, you'd have to load $game_party, then iterate through $game_party.actors to get their names.

However, $game_party is way down in the list, and you might find it slow to bring up the loading screen if it has to show for several save files.