Common event loads everytime I open a save file.

Hello! I made a common event to save the game and then go back to title. It works fine, but if I try to reload the save file it's stuck in an infinite loop of going back to title. Is there a way to stop the common event from loading when I open the file?
Or is there a more simple solution to "suspend" a run?
My idea was to have a way to save your run but then delete the save file after you die (or if the game is reloaded).
depends how your event looks like, as if the common event looks like:

save game
back to title

the first loading is from save game => back to title after wards.

to fix this issue is relative easy.

this depends if you use choices or not so we need to see the event and common event.
depends how your event looks like, as if the common event looks like:

save game
back to title

the first loading is from save game => back to title after wards.

to fix this issue is relative easy.

this depends if you use choices or not so we need to see the event and common event.
the common event is simply

open save game
wait 1 second
go back to title

it's triggered by using an item.
after saving, it goes back to title as the saving point = the loading point.
there are 2 ways to fix this (require a plugin.)

you can store the X and Y into a variable like
variable 3 = Map ID
variable 4 = Map X
variable 5 = Map Y

so this can be used on loading a game as the common event is than bypassed.
but the variable has to be set BEFORE you call the calling the scene.

as it is inside the "Game Data" of the variable to fetch those.
if your comfortable with that, I can give you a snippet to use inside your game.
after saving, it goes back to title as the saving point = the loading point.
there are 2 ways to fix this (require a plugin.)

you can store the X and Y into a variable like
variable 3 = Map ID
variable 4 = Map X
variable 5 = Map Y

so this can be used on loading a game as the common event is than bypassed.
but the variable has to be set BEFORE you call the calling the scene.

as it is inside the "Game Data" of the variable to fetch those.
if your comfortable with that, I can give you a snippet to use inside your game.
yeah sure, I'm relatively new to rpgmaker so it would help a lot!
this is a small snippet (open the file, alter the variable X and Y.
make sure those are set, leave mapID for now, but if it doesn't work,
copy the variable line and set another ID there as well.

put this under ANY custom save plugins as this override the function
for loadSuccess.
👋
You can track load/save for a save point by storing a value on a game object that is initialised on new/load game, but not included in save data. A good example is $gameTemp.

E.g. you could use a script call like this, before saving:
JavaScript:
$gameTemp.showPostSaveMessage = true;
Then put the stuff after it in a Conditional Branch -> Script:
JavaScript:
$gameTemp.showPostSaveMessage
I.e. "is that value truthy?" That should be true if you've just saved, but false if you've just loaded the save.
this is a small snippet (open the file, alter the variable X and Y.
make sure those are set, leave mapID for now, but if it doesn't work,
copy the variable line and set another ID there as well.

put this under ANY custom save plugins as this override the function
for loadSuccess.
mmh this doesn't look like what I need. if it wasn't clear, that book is an item I can carry with me and use everywhere I want.
correct me if I'm wrong, I know nothing about javascript, but this looks like something I can use only on a specific tile in the map.
E.g. you could use a script call like this, before saving:
JavaScript:
$gameTemp.showPostSaveMessage = true;
Then put the stuff after it in a Conditional Branch -> Script:
JavaScript:
$gameTemp.showPostSaveMessage
I.e. "is that value truthy?" That should be true if you've just saved, but false if you've just loaded the save.
I didn't know this, but it's a lot cleaner if $gameTemp can always be used without the use
of an existent function.

mmh this doesn't look like what I need. if it wasn't clear, that book is an item I can carry with me and use everywhere I want.
correct me if I'm wrong, I know nothing about javascript, but this looks like something I can use only on a specific tile in the map.
what the plugin does is load the game on the spot you saved the game with the X and Y variables.
so the common event or item use is always working.

the idea by caethyril is cleaner and works probably also far better without the other needs.
I didn't know this, but it's a lot cleaner if $gameTemp can always be used without the use
of an existent function.


what the plugin does is load the game on the spot you saved the game with the X and Y variables.
so the common event or item use is always working.

the idea by caethyril is cleaner and works probably also far better without the other needs.
I tried your plugin and if I reload that save file I just get a blackscreen (maybe I did something wrong? I made variables that check the X and Y of the character and wrote the numbers of the variables in the plugin)

I don't really understand where to put the script and the conditional branch. sorry if I sound dumb but I'm a beginner and I have no idea how a lot of things work.
I don't really understand where to put the script and the conditional branch. sorry if I sound dumb but I'm a beginner and I have no idea how a lot of things work.
she means, place on top of the common event:

$gameTemp._showSave = true
and the rest.

than before open save scene:

if: script: $gameTemp._showSave
open save scene (this opens when the condition is true which is true)
else
nothing here
end

because upon loading, the $gameTemp._showSave = false so it isn't true anymore
unless you rerun the event.
I don't really understand where to put the script and the conditional branch. sorry if I sound dumb but I'm a beginner and I have no idea how a lot of things work.
No worries, I could have been clearer! The commands should be:
  • Script (set value on $gameTemp)
  • Open Save Menu (or whatever script call or plugin command you may be using to force-save)
  • Conditional Branch -> Script (check value on $gameTemp)
    • Return to Title
Here's an example:

◆Script:$gameTemp.quitAfterSave = true; ◆Open Save Screen ◆If:Script:$gameTemp.quitAfterSave ◆Return to Title Screen ◆ :End
Spoiler: technical explanation
It works because, when a save is loaded, the game continues processing any active event(s) where they left off: right after Open Save Screen, in this case. But starting a new game or loading a save causes $gameTemp to reset, so the branch condition $gameTemp.quitAfterSave will not be true if you've just loaded a save from that point.
No worries, I could have been clearer! The commands should be:
  • Script (set value on $gameTemp)
  • Open Save Menu (or whatever script call or plugin command you may be using to force-save)
  • Conditional Branch -> Script (check value on $gameTemp)
    • Return to Title
Here's an example:

◆Script:$gameTemp.quitAfterSave = true;
◆Open Save Screen
◆If:Script:$gameTemp.quitAfterSave
◆Return to Title Screen
◆
:End

Spoiler: technical explanation
It works because, when a save is loaded, the game continues processing any active event(s) where they left off: right after Open Save Screen, in this case. But starting a new game or loading a save causes $gameTemp to reset, so the branch condition $gameTemp.quitAfterSave will not be true if you've just loaded a save from that point.
it works!! thank you so much for the help, you're a life saver!

Original thread: https://forums.rpgmakerweb.com/threads/common-event-loads-everytime-i-open-a-save-file.172863/