The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: Zylos on April 09, 2012, 05:30:44 AM

Title: A question about VXA saving... [Resolved, I think]
Post by: Zylos on April 09, 2012, 05:30:44 AM
Yet another scripting question, ugh. This time I only have a vague idea of where to start...

To begin with, I've noticed something very strange about the way that RPG Maker saves game files. It saves the player's map coordinates just fine, but NOT the coordinates or settings of any of the events around it. As an example of a harmless bug, let's say we have an event that is just turned invisible with the transparent command in the move route. Save the game, quit, restart, and suddenly the event is visible again due to the game rebuilding the map from scratch. This is annoying yet harmless, but there are much more serious situations. Say you're in an action game and have the start location of an enemy on a map. The enemy moves away from the starting location to try to touch you, you move TO the starting location or a square around it, then save, quit, restart. All of a sudden, the game has relocated that enemy to be back to the starting square again, meaning that you've potentially got the enemy and player trying to take up the same tile and probably triggering the event touch already (if not the second after you try to move away).

The long and short of it is that we need a more precise way of saving what's happening on the game map at the time of saving to avoid these simple types of bugs, probably saving move routes and map coordinates. Now obviously, the best place to start looking for a fix is in the data manager, adding something to the "def self.make_save_contents" section. What I'm at a loss for is WHAT to add, aside from everything.

Any suggestions?
Title: Re: A question about VXA saving...
Post by: Lethrface on April 09, 2012, 05:49:21 AM
I think the best option is to figure out how RPG Maker determines event location and the current graphic in use and make sre it is accessible through the save and load functions and then have it save all of that data for that current map within the save file and then when you load it, make sure it essentially dynamically creates those events and ONLY those events on the map, deleting their starting event location to prevent duplicates if that is necessary.

Is that the kind of suggestions you were looking for?  The vague-ness kind of left me re-writing this at least 3 times lol
Title: Re: A question about VXA saving...
Post by: pacdiggity on April 09, 2012, 07:02:25 AM
I always love the things you pick up on, Zylos. I don't mind answering your questions at all, they're very interesting and I learn something myself looking for the answers.

They way I would do this is creating a new attribute in Game_Map, and call it something like event_details. What we could do is save the details of all events on the current map (i.e., coordinates, graphic, etc.) by aliasing the make_save_contents of DataManager. Then, upon loading, you would apply the details from the save to each event. This is not simple. It would take a bit of thinking to figure that bit out. It may also take a bit of time to apply, so lag would be an issue. I wish I could help more at the moment. Nice idea though.
Title: Re: A question about VXA saving...
Post by: Zylos on April 09, 2012, 04:46:00 PM
Ugh, I'm a dumbass who didn't look closely at the coding. -.-;

So apparently it DOES already save what's going on to an extent, and will only reload the map if you've made changes on it since the save file you're using. IE, if the current version ID doesn't equal the version ID of the save file, it'll refresh the map. As this will only ever happen in playtesting rather than the actual game being released, it won't ever be a real problem for people playing.

Thanks for your chipping in, you two. <3
Title: Re: A question about VXA saving...
Post by: Lethrface on April 09, 2012, 04:49:30 PM
Ugh, I'm a dumbass who didn't look closely at the coding. -.-;

So apparently it DOES already save what's going on to an extent, and will only reload the map if you've made changes on it since the save file you're using. IE, if the current version ID doesn't equal the version ID of the save file, it'll refresh the map. As this will only ever happen in playtesting rather than the actual game being released, it won't ever be a real problem for people playing.

Thanks for your chipping in, you two. <3

You know, I saw that last night but I didn't really pick up on it while looking at the datamanager stuff and the save window script.  I just assumed it was going to be something for something else like the modification of that specific event, which I assumed it would just be a safeguard to make sure that event loaded properly with it's new settings lol

Nice find.
Title: Re: A question about VXA saving... [Resolved, I think]
Post by: pacdiggity on April 10, 2012, 02:12:59 AM
It still remains a tiny problem in the testing process though D:
Title: Re: A question about VXA saving... [Resolved, I think]
Post by: Lethrface on April 10, 2012, 02:17:22 AM
It still remains a tiny problem in the testing process though D:

I think (im not positive) that if you just replace

Code: [Select]
def self.reload_map_if_updated
    if $game_system.version_id != $data_system.version_id
      $game_map.setup($game_map.map_id)
      $game_player.center($game_player.x, $game_player.y)
      $game_player.make_encounter_count
    end
  end

with

Code: [Select]
def self.reload_map_if_updated
    return
  end

that will fix that...maybe.  I'm not willing to try it XD
Title: Re: A question about VXA saving... [Resolved, I think]
Post by: pacdiggity on April 10, 2012, 02:21:29 AM
No, that would ignore any changes made between the saving of the game and the loading of the game. I think that minor problem is worth the game working properly.
Title: Re: A question about VXA saving... [Resolved, I think]
Post by: Lethrface on April 10, 2012, 02:29:04 AM
this actually has me extremely curious now >.<

now i'm looking further up and thinking about what would happen if you did update the map then load the rest of the data AFTER the update or if it would even be worth messing with it...of course I'm also half asleep and my mind is easily wandering off on other things so I should probably get sleep and avoid messing with the datamanager...