Reset events when changing map

Hi everyone! I'm having an issue with my game. There are no random encounters while walking—only visible enemies on the map. When the player defeats an enemy, it turns into a slimy puddle. I achieved this by creating an event that follows the player and triggers a battle with one of my troops. If the player wins, a self-switch is activated, which changes the event to the next page. On this page, the enemy sprite is replaced with the slimy puddle, and the event stops following the player.

I've seen many threads where people wanted their event not to reactivate when leaving and reentering a map. One common solution is using the self-switch trick. In my case, I need the self-switch to turn enemies into puddles when defeated, but I also need them to reset when the player quits and reenters a map. How can I achieve this?
There have been some threads about this, as well 😉



If you want it to automatically happen as you transfer maps, you'll need a little plugin - it would be best to label your enemy events with a notetag and have the code account for that, so you don't reset events you want to stay switched, like treasure chests or cutscenes.

You could do it without any code or script calls by making the defeated page of your enemies, with the self switch, look like this:

1723165748974.png


Then make an event with a higher ID than any of those enemies that does:

1723165804667.png


Then you have any events that are sending the player to a new map turn on the Reset switch when you want it to repopulate.
There have been some threads about this, as well 😉



If you want it to automatically happen as you transfer maps, you'll need a little plugin - it would be best to label your enemy events with a notetag and have the code account for that, so you don't reset events you want to stay switched, like treasure chests or cutscenes.

You could do it without any code or script calls by making the defeated page of your enemies, with the self switch, look like this:

View attachment 314095

Then make an event with a higher ID than any of those enemies that does:

View attachment 314096

Then you have any events that are sending the player to a new map turn on the Reset switch when you want it to repopulate.
It perfectly worked. Thanks !

Original thread: https://forums.rpgmakerweb.com/threads/reset-events-when-changing-map.170958/