Chaos Project

RPG Maker => RPG Maker Scripts => Script Requests => Topic started by: AresWarrior on June 29, 2010, 08:43:09 pm

Title: Latest map name in Save Screen?
Post by: AresWarrior on June 29, 2010, 08:43:09 pm
Since there's a way to have the timestamp and playtime, shouldn't there be a way to add the map name too? I don't know exactly what script to add that shows the file's map. $game_map.name doesn't work because that shows the map you are currently on, and not the map that you were on when you saved to the file. Is there a way to show the last map? Thanks.  :)
Title: Re: Latest map name in Save Screen?
Post by: G_G on June 29, 2010, 11:02:18 pm
try this in a new script
then use $game_map.name
class Game_Map
  def name
    return @map.name
  end
end


However not sure if that'll work, I've seen other methods of doing it
Title: Re: Latest map name in Save Screen?
Post by: winkio on June 30, 2010, 09:01:36 am
He is looking for a modification of Window_SaveFile.
Title: Re: Latest map name in Save Screen?
Post by: AresWarrior on June 30, 2010, 12:48:03 pm
i will try game_guy's script. i think i can add $game_map.name to the draw_text code after inserting his script.  i can modify window_safefile by myself. thanks

edit: i get an error whenever i try to save/load. it says something like "undefined method for 'name'"
Title: Re: Latest map name in Save Screen?
Post by: G_G on June 30, 2010, 04:32:12 pm
instead of using $game_map try @game_map
Title: Re: Latest map name in Save Screen?
Post by: ForeverZer0 on June 30, 2010, 05:30:29 pm
I just did this for the CMS I made (will release by next week), but you cannot use the global variable ($game_map), because when it reads that variable to display the windows, it will always be the same for every window. You have to use the loaded variable for each specific file. It requires a modification of the what all is loaded from the game file for the save-file windows.
Title: Re: Latest map name in Save Screen?
Post by: AresWarrior on June 30, 2010, 09:24:27 pm
idk what i'm doing wrong. i've tried $game_map.name and @game_map.name but still getting the "undefined method for 'name'" error.
Title: Re: Latest map name in Save Screen?
Post by: ForeverZer0 on June 30, 2010, 09:40:24 pm
Quote from: AresWarrior on June 30, 2010, 09:24:27 pm
idk what i'm doing wrong. i've tried $game_map.name and @game_map.name but still getting the "undefined method for 'name'" error.


I'm not sure, but I don't think that "@game_map" is loaded normally just to make the SaveFile Windows, you will have to add it, but I think there other variables that will load first, you might have to have it load some unwanted things jut to be able to access it.

Its hard to explain briefly, but as soon as I get the demo made for my CMS I will release it, and you can see how I did it.
Title: Re: Latest map name in Save Screen?
Post by: AresWarrior on June 30, 2010, 10:23:42 pm
ok i will wait for that demo  :)
Title: Re: Latest map name in Save Screen?
Post by: AresWarrior on July 27, 2010, 01:50:12 pm
I looked at the demo but I still don't understand how you did it. Can someone explain how? Thanks
Title: Re: Latest map name in Save Screen?
Post by: ForeverZer0 on July 27, 2010, 04:41:23 pm
Quote from: AresWarrior on July 27, 2010, 01:50:12 pm
I looked at the demo but I still don't understand how you did it. Can someone explain how? Thanks


I'll make a demo/tutorial when I get a chance.
Title: Re: Latest map name in Save Screen?
Post by: SBR* on July 28, 2010, 05:15:44 am
Quote from: AresWarrior on July 27, 2010, 01:50:12 pm
I looked at the demo but I still don't understand how you did it. Can someone explain how? Thanks


Look, you load data from an external file using:

VARIABLE = Marshal.load(FILENAME)


Where VARIABLE is the variable and FILENAME is the name of the file, it's a string. FILENAME is 'stored' in a variable in a lot of cases. First you have to open the file, and after it, you have to close it, but that's already done in the Window_SaveFile script, so we just have to load the variable. Please note that the variable should have the same name as the variable in the external file, but it doesn't have to be of the same kind (with 'kind', I mean 'local', 'class', 'instance' or 'global'. Is 'area' the correct term for this? Whatever...). So, go to line 32 of the Window_SaveFile script and add a new line after that line. Now, paste this piece of code in that line:

See EDIT: ShowHide
      @game_map = Marshal.load(file)


file Is the variable that refers to the string with the filename. Now you can access $game_map of that file.

I see you can figure out the rest yourself? :P

EDIT:
      @game_self_switches = Marshal.load(file)
     @game_screen = Marshal.load(file)
     @game_actors = Marshal.load(file)
     @game_party = Marshal.load(file)
     @game_troop = Marshal.load(file)
     @game_map = Marshal.load(file)


All the class variables, except @game_map, could be anything (I think...).
Title: Re: Latest map name in Save Screen?
Post by: ForeverZer0 on July 28, 2010, 04:29:04 pm
Also remember that things must be loaded in the order they were saved.
Title: Re: Latest map name in Save Screen?
Post by: SBR* on July 29, 2010, 03:14:31 pm
Quote from: ForeverZero on July 28, 2010, 04:29:04 pm
Also remember that things must be loaded in the order they were saved.


Aha, so that's how it works :P. I'll edit my post.