Status
Not open for further replies.

AdamSakuru

[Null_Value]
Veteran
Joined
Mar 14, 2014
Messages
314
Reaction score
171
First Language
English
Primarily Uses
N/A
In games like Metroid Fusion/Super Metroid, event processing changes in something like a save room when you load your game from there. Sometime a couple years ago, I'd asked a question regarding this with ACE on another forum and someone wrote up some code. Essentially, it had a switch that would turn on when a file was loaded from the title screen. With the switch being turned on going into the file, you could have the event go differently when continuing a game from that point, and then turning the switch off after the event so it doesn't happen when saving your game during play (in Metroid Fusion/Super Metroid Samus phases in to the fanfare when loaded rather than saving at that point).

Would anyone be able to write up similar code for MV?
 
Last edited by a moderator:

Doktor_Q

I'm not a real doktor, but I am a real Q
Veteran
Joined
Aug 1, 2016
Messages
881
Reaction score
573
First Language
English
Primarily Uses
RMMV
It's not even code so much as just eventing structure. It'd go something like this inside the event:

  1. Set "loaded game" switch to ON.
  2. Save game / open save menu / however you want to handle saving.
  3. Set "loaded game" switch to OFF, before you leave the event handling this.

The save game has "loaded game" switch as ON still, and you can do whatever you want with it- probably add extra dialog to an event on load, or the like.
 

AdamSakuru

[Null_Value]
Veteran
Joined
Mar 14, 2014
Messages
314
Reaction score
171
First Language
English
Primarily Uses
N/A
It's not even code so much as just eventing structure. It'd go something like this inside the event:

  1. Set "loaded game" switch to ON.
  2. Save game / open save menu / however you want to handle saving.
  3. Set "loaded game" switch to OFF, before you leave the event handling this.

The save game has "loaded game" switch as ON still, and you can do whatever you want with it- probably add extra dialog to an event on load, or the like.


That's a clever solution. The event always turns the load switch off, but the save keeps the load switch on.
 

AdamSakuru

[Null_Value]
Veteran
Joined
Mar 14, 2014
Messages
314
Reaction score
171
First Language
English
Primarily Uses
N/A
Hey, so I tried eventing this and I'm sort of stuck. Not sure if I misunderstood you/if I evented this wrong.

See the attached image. What I'm stuck on is how to get the load game event sequence to happy only when the file is being loaded. Right now, the event still occurs even when just saving because the switch is ON.
 


untitled.PNG


What I'm stuck on is how to get the load game event sequence to happen only when the file is being loaded. Right now, the load game event still occurs even when just saving because the switch is ON.
 
Last edited by a moderator:

iamhers

Villager
Member
Joined
Dec 29, 2016
Messages
7
Reaction score
0
First Language
C, oh English
Primarily Uses
Hello,


I am looking at doing this as well.

The issue I see with any "Event Structuring" is that After you resume on a load, is still operates in the event tree.

Maybe there is a way to make the event processing not fire after Load, but I haven't found that.

I was thinking the only way to accomplish this is writing to an .ini file, and then checking that value which would be something you could use.
 

iamhers

Villager
Member
Joined
Dec 29, 2016
Messages
7
Reaction score
0
First Language
C, oh English
Primarily Uses
Hello,


I assume the solution he was proposing was actually Event Pages. But I still don't see how that works any different. Again, unless different pages are not processed after Loading of a saved game...


Thanks in advance regardless!
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,751
Reaction score
14,493
First Language
English
Primarily Uses
RMVXA
iamhers, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.



As for the question being posed, when you load a game, it loads where you were in the event processing, and it loads the event as it was when you saved it. This is so you can put save events inside long cutscenes and have then pick up where they were if you wish.
 

iamhers

Villager
Member
Joined
Dec 29, 2016
Messages
7
Reaction score
0
First Language
C, oh English
Primarily Uses
Firstly,


Sorry for the double post, as I didn't see an edit for the post after it had been sent.


Secondly, sounds like you are confirming that it does indeed pickup where you left off. And in that case, there would be no way to have an event pickup a different switch, unless that was something set/changed by a script into a .ini type file.



Basically
Event
Save
Event2
 


There is no way to get Event2 checked/set and then go back to Save where Event2 will have processed.


Butttt - hopefully Doctor_Q can give us something....
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,751
Reaction score
14,493
First Language
English
Primarily Uses
RMVXA
Np. The edit button is at the bottom of the original post. Though I've had times it's not shown up on some browsers for me, so if you don't see it, maybe try another browser?


But, yes, as far as I know it's not possible without getting really cute deep at the scripting level (for XP onwards). I know in ACE you can edit the code for loading games, and have it run something there if you wish. So I'm sure it's possible at that level, but with eventing only, probably not.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
32,327
Reaction score
8,072
First Language
German
Primarily Uses
RMMV
What the OP wants is not possible by eventing alone - because the entire switch and variable structure is saved with all savefiles, there is no way in default to detect if somethings was saved regularly or not.


What you need is a plugin that saves some data outside the regular savefile, then compare an internal flag with that external flag and have eventing react differently based on if they are identical or not.


There is no way to do this without a plugin.
 

Doktor_Q

I'm not a real doktor, but I am a real Q
Veteran
Joined
Aug 1, 2016
Messages
881
Reaction score
573
First Language
English
Primarily Uses
RMMV
@AdamSakuru I'd put the "turn switch off" statement immediately after the "open save menu" setup, for the first thing- just to keep it all isolated in the same area. Some thing like:


[...]
LOAD GAME SWITCH set to ON
open save menu
LOAD GAME SWITCH set to OFF
[...]


as a distinct unit.


After that, I'd put your "LOAD GAME SWITCH" branch in a separate event- probably set to autorun- that fires only when LOAD GAME SWITCH is on, and turns the switch back off when it's done. You can place one on the map you want (invisible in the top-left corner is a classic), or make a switch-triggered common event if you want the same code to run on any map. Something like:


[On a page set to "autorun" with the condition LOAD GAME SWITCH = on]
"This extra dialog only shows when you load the game!"
LOAD GAME SWITCH = off
[end event processing if you want to be extra sure]


This bit is needed because RPGMaker doesn't save your progress inside a running event, so when you re-load, it won't (normally) open the save dialog to be able to hit that branch. The status of the switch you flipped is saved. To take an important lesson from my own recent development: Any events you want to run upon game load will have to be able to run themselves, either autorun or parallel process.


Hopefully that helps, if you're still having trouble I can dig up my copy of VXAce to help debug and give actual screenshots.
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,751
Reaction score
14,493
First Language
English
Primarily Uses
RMVXA
@Doktor_Q: As far as I can tell, that is going to run when  you save, not just when you load the game. I think the OP wants it to run only when loaded, and that is what we meant when we said it can only be done with scripting/a plug-in.
 

Doktor_Q

I'm not a real doktor, but I am a real Q
Veteran
Joined
Aug 1, 2016
Messages
881
Reaction score
573
First Language
English
Primarily Uses
RMMV
Why would it run on save? The switch is disabled before you exit event processing, so the auto-run won't have a chance to trigger. I made something similar to this to do a "LAST TIME ON DRAGON BALL Z"-type on-load recap when I was still fooling around in Ace, I don't think I forgot any parts of it.
 

AdamSakuru

[Null_Value]
Veteran
Joined
Mar 14, 2014
Messages
314
Reaction score
171
First Language
English
Primarily Uses
N/A
@Doktor_Q: As far as I can tell, that is going to run when  you save, not just when you load the game. I think the OP wants it to run only when loaded, and that is what we meant when we said it can only be done with scripting/a plug-in.


Yeah, that's what I meant. Like the Super Metroid/Metroid Fusion example. When you load a game, the save room event is different than when you simply save there during the game.

For the record, everyone, here was the syntax written for me for ACE:

Code:
module DataManager

  # Needed to alias a static method
  class << self
    alias extract_save_contents_onload extract_save_contents unless $@
  end
  
  
  
  def self.extract_save_contents(*args)
    # First call the original load method, this will do the actual loading
    extract_save_contents_onload(*args)
    
    # Here is where you can cram in any code you want. For this demo I just
    # flip the switch IsLoaded (#1) to true
    $game_switches[41] = true
    # But you can do more stuff here too
  end
  
end
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,751
Reaction score
14,493
First Language
English
Primarily Uses
RMVXA
Hmmm...I'd have to test it then, as from my experience, when you load you also resume the event processing, so the other event has no chance to run before the switch gets disabled. Though maybe I could see it working if it was in parallel...


Edit: Tested in a blank project, and it heavily depends how the save event is triggered. Here are the two conditions I checked.


Save Event: Action Button, Event to run only on load: Autorun: Works as described


Save Event: Autorun, Event to run only on load: Autorun: Does not work. The event to run only on load never runs.


So... it does appear that as long as the event you wish to save on is not set up to autorun (like say for a cutscene) the method by Doktor_Q will work. Meaning, it works well for those who use save points. However, if you do like I do and only call the save menu up in long cutscenes, then it will more than likely require a script or plug-in edit.
 
Last edited by a moderator:

Doktor_Q

I'm not a real doktor, but I am a real Q
Veteran
Joined
Aug 1, 2016
Messages
881
Reaction score
573
First Language
English
Primarily Uses
RMMV
I haven't tested it, but I'd imagine the problem with auto saves is that the "auto save" event has a lower event ID, so it auto-runs first, and disables the GAME LOAD switch before the other event has a chance to start. The two solutions to that would be to shuffle the event order (which seems like a lot of extra trouble), or to ensure the autosave event won't do anything if GAME LOAD is already on.


One option would be to make your LOAD only event a higher-priority page of the autosave event, I suppose.
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,751
Reaction score
14,493
First Language
English
Primarily Uses
RMVXA
I wondered about that too, and switched the event ID order. Still didn't work. I think its due to how the autoruns are set up more than anything. But chances are very few people are going to be trying to use this in an autorun, as I only see this trick being used for save points more than anything, so probably not worth worrying about too much.


And at least we know it will work for save point like structures, which is what I think the OP wanted (after all. who would make their save points an autorun event, right?)
 

AdamSakuru

[Null_Value]
Veteran
Joined
Mar 14, 2014
Messages
314
Reaction score
171
First Language
English
Primarily Uses
N/A
I still can't get this to work when I make it a separate event. When I turn the switch OFF after the save, the auto-run load event doesn't get to run. And when it's turned ON after the save (removing the OFF switch), the auto-run load event always runs.

untitled.PNG


In any case, if anyone knows the syntax/plugin edit to function like the syntax I had written for me on ACE, that would be swell. Seems more efficient to have the plugin handle the load switch initially while the designer can worry about all the eventing stuff in the maker/turn the load switch OFF at the end of the event themselves. 
 
Last edited by a moderator:

Doktor_Q

I'm not a real doktor, but I am a real Q
Veteran
Joined
Aug 1, 2016
Messages
881
Reaction score
573
First Language
English
Primarily Uses
RMMV
Oh! I see the issue there, actually- I hadn't tried it in MV before, apparently in the version change, it saves your place inside currently running events. So much for that clever trick...


As to the plugin syntax- you should be able to find the "DataManager.loadGame" function in rpg_managers.js. In your own plugin file, you'd want to:

  1. Assign some variable to the existing DataManager.loadGame, such as "DataManager._oldLoadGame = DataManager.loadGame;" so you can still access it.
  2. Reassign the existing loadGame to your new function, a la "DataManager.loadGame = function (savefileId) { ...your code goes here... }"
  3. Inside your function, immediately call the old load game so it works: "this._oldLoadGame(savefileId);"
  4. After calling that to make it actually load the game, apply whatever changes you want to the database, such as: "$gameSwitches.setValue(switch ID here, value here);

Your final code might look something like:


DataManager._oldLoadGame = DataManager.loadGame; //preserve the old function
DataManager.loadGame = function(savegameId) { //override the functionality to create a wrapper
this._oldLoadGame(savegameId); //load the game normally
$gameSwitches.setValue(1, true); //assuming switch 1 is "LOAD GAME", this will turn it on right after you load a game
};


And then you'd just pop that in a .js file in your plugins folder, and pull it in with the script manager, preferably below anything else that modifies saving. I'd highly advise against modifying rpg_managers.js directly.
 

AdamSakuru

[Null_Value]
Veteran
Joined
Mar 14, 2014
Messages
314
Reaction score
171
First Language
English
Primarily Uses
N/A
Oh! I see the issue there, actually- I hadn't tried it in MV before, apparently in the version change, it saves your place inside currently running events. So much for that clever trick...


As to the plugin syntax- you should be able to find the "DataManager.loadGame" function in rpg_managers.js. In your own plugin file, you'd want to:

  1. Assign some variable to the existing DataManager.loadGame, such as "DataManager._oldLoadGame = DataManager.loadGame;" so you can still access it.
  2. Reassign the existing loadGame to your new function, a la "DataManager.loadGame = function (savefileId) { ...your code goes here... }"
  3. Inside your function, immediately call the old load game so it works: "this._oldLoadGame(savefileId);"
  4. After calling that to make it actually load the game, apply whatever changes you want to the database, such as: "$gameSwitches.setValue(switch ID here, value here);

Your final code might look something like:



DataManager._oldLoadGame = DataManager.loadGame; //preserve the old function
DataManager.loadGame = function(savegameId) { //override the functionality to create a wrapper
this._oldLoadGame(savegameId); //load the game normally
$gameSwitches.setValue(1, true); //assuming switch 1 is "LOAD GAME", this will turn it on right after you load a game
};


And then you'd just pop that in a .js file in your plugins folder, and pull it in with the script manager, preferably below anything else that modifies saving. I'd highly advise against modifying rpg_managers.js directly.



Okay, apologies if I'm a bit slow, I also don't program.

So I made a new plugin file, popped the syntax in and put it below everything. But when I try to load the game from the title, it won't let me actually pick the file. Like I can get into the file screen with the file highlighted, but it wont let me select it.
 
Status
Not open for further replies.

Latest Threads

Latest Posts

Latest Profile Posts

It's been half a month and I didn't give signs of life, not even in my website.

I've been studying about my project and I discovered something that I definitely think it will be better.

On the other hand, I still have to learn how to use it properly so I need time.
This catgirl name is Elyune.
Her hobby is cooking and eating sweets. She's also an alchemist.

Cat_girl.jpg
catgirl-1.jpg
Raptor Revolt Demo 4_10_2021 3_12_09 PM.png

Latest custom tileset work for RAPTOR REVOLT in this beach scene set in the acheroraptor capital in Ridge City, Hell Creek.
unknown.png


I figured it was about time to update the battle sprite for one of my characters. The old one was the first time I ever drew a battle sprite, and filled with lines that shouldn't be there. So far, the new one is cleaner.
EQAQeW8.png

This was supposed to become her neutral talking stance, but now i just feel like she looks a little puzzled :D
I'm also open for any name suggestions, as i seriously suck at those. In my notes everything is just THE CITY or THAT GUY and THIS PRIESTESS or whatever :D

Forum statistics

Threads
110,281
Messages
1,051,946
Members
143,302
Latest member
exucav
Top