Running an event/script specifically on saved game load?

So, I have a plugin which is doing all of my parallax layering. It works great. My only issue is this:

If I have a parallel event constantly re-sending the command to display the parallax layers on a given map it doesn't look right since the layer images are repeatedly reloading. So I have a parallel event which runs once and then sets a switch to disable itself. The exit to that area sets the switch back off so that the next time you enter the parallax layers will reload.

The problem is that if you save in that area when you load the save the plugin will no longer be displaying the layers, and the switch state will still be set to "On".

The fix to this would be as simple as setting a pool of switches to an "Off" state every time a saved game is loaded via a common event... but I'll be damned if I can find a plugin which can initiate a common event specifically when saved games are loaded.

In the meantime I basically have restricted saving to a special area where no parallax effects are needed. The exit to that area sets the switches to "Off". I think this is a terrible solution.

Anyone have a better solution?
Hi there!
You can use my plugin. It does exactly that, load a common event when the game is loaded. See if it will help you.
Eli_CheckPoint.js

But.. what is the parallax plugin that you are using?
Because have to set a parallax image constantly is not normal.
Many parallax plugins you only have to set the command in map note, or plugin parameters, or when you enter a map.
Thanks! I'll give it a try.

I am using OcRam Layers Plugin. I don't need to set it constantly, only when I enter the area.

Basically I am doing my "tilemap" parallax image through rpgmaker normally, by selecting "!imagename" in the parallax dropdown. Any overlays, trees, etc, get set via plugin command, and anything falling below the parallax "tilemap" get called by the plugin.

Only issue is that I have to clear these plugin added layers prior to area transitioning and that they will not persist beyond a save/load. So if I set a switch to prevent the event from adding the layers over and over, when you save load... things are weird.
Hmm... Think I got it.
But oc ram layers does not have a parameter for you to set the parallax for each map?
Or your map is dynamic, need to change it every time?
The plugin appears to have 3 layer "slots" for you to work with, the relative z position of those layers can be adjusted in the plugin parameters. I liked this because I've heard that other plugins which allow you to bind images infinitely can cause issues with memory usage.

If you use a plugin command to show an image on one of those layers, it will continue showing it until the image is cleared via another plugin command.

So, right now I have a parallel event in each parallax map which sends the plugin commands to show the specific images it needs on its various layers and do scrolling, transparency, or whatever. The parallel event then disables itself so that it wont run over and over. When you hit the area transition I send the plugin command to clear the layers so that the next area can load its layers in turn or a non-parallax map will display properly. The transition then re-enables the parallel event so that it can run the next time it is needed.

The issue arises when I save/load within an area that has layers being displayed via the plugin.

All that said, I realized it isn't quite doing what I thought it was doing. It's easier to show than tell.



In case you missed it, prior to save load I have 3 images showing on my parallax map:

-the faux tilemap set up normally as a parallax image on the map through RPG maker
-A partially (20%) transparent overlay layered on top of the trees so that your characters gets mostly obscured when walking behind them, but is still slightly visible due to transparency (Plugin).
-A seamless water texture that scrolls down and to the right behind the faux tilemap's partially transparent riverbed to give the river the impression that it is flowing (Plugin).

However, after save load.

-"water" layer behind the semi-transparent riverbed was still there, but was scrolling reaaaaallly slowly up rather than down and to the right.
-Foreground layer (trees, bushes, etc) prior to save load had its opacity at 80%, that layer is still there, but after save load it was fully opaque.
-Area transition plugin command to clear the layers was severely delayed after save/load. If I area transitioned without saving that would all happen instantaneously.

Once the plugin layers get cleared/reloaded via the area transition and parallel event everything goes back to working.

Could be a bug or just something I'm doing wrong, but I'm gonna see if I can reset switches/clear layers as part of a load save game common event.
@Eliaquim

In case you are interested, I found a better solution.

I was able to redirect the save main menu option to run a common event instead. That common event saves player position to variable memory, clears all layers, resets the needed switch, teleports the party to a new area, opens the save prompt, and then returns them to whence they came all fairly seamlessly.

Original thread: https://forums.rpgmakerweb.com/threads/running-an-event-script-specifically-on-saved-game-load.120525/