Main Menu
  • Welcome to The RPG Maker Resource Kit.

Quick help with actor name on save file.

Started by Zylos, June 28, 2009, 01:49:23 AM

0 Members and 1 Guest are viewing this topic.

Zylos

I'm still pretty bad at scripting, but this should be an easy enough one for me to do. Replacing the standard sprite bitmap on a save file with one particular actor's name (which will be used as chapter names rather than a character name). Unfortunately, no matter what I do I cannot get it to work right. I can get rid of the sprite easily, and can put in the text exactly as I want it to be if I were to type the text in directly, but it simply will not take the actor name itself no matter what I do. I wanted to be able to get it on my own, but it clearly there's something I'm missing. Anyone able to give me a pointer?




shaz

want to post what you've already got?  Or at least the bit where you're TRYING to put in the actor's name?
Always remember you're unique.
Just like everybody else.

modern algebra

Sorry for not noticing this before Zylos :( The problem is likely the window loads the data from the save file. It doesn't load $game_actors.

There are two ways to fix this, save actor names into @characters rather than the filenames, or else load up to $game_actors.

To save actor names instead of filenames, you would need to modify the write_save_data method of Scene_Save. Notice that the first thing it dumps is an array it makes of each actor's character name and hue. If you changed that to instead be each actor's name, then you could access the names from the @characters array in Window_SaveFile.

Otherwise you can load up to game_actors in Window_SaveFile instead of stopping at game_variables as they do.

Note this part in Window_SaveFile



    @file_exist = FileTest.exist?(@filename)
    if @file_exist
      file = File.open(@filename, "r")
      @time_stamp = file.mtime
      @characters = Marshal.load(file)
      @frame_count = Marshal.load(file)
      @game_system = Marshal.load(file)
      @game_switches = Marshal.load(file)
      @game_variables = Marshal.load(file)
      @game_self_switches = Marshal.load(file)
      @game_screen = Marshal.load(file)
      @game_actors = Marshal.load(file)
      @total_sec = @frame_count / Graphics.frame_rate
      file.close
    end


and then you could access name through:

@game_actors[id].name