Resetting self-switches when entering map?

so i'm doing this for npcs:

npc.png



but i would like for the leftmost event to repeat every time the player enters the map
With the intent of each npc having a percentage chance to spawn whenever the player enters the map
is there a way to reset self switches when the player enters the map so that event 1 can repeat each time?
I think the way to do this would be a separate event using switches instead of self switches (or a plugin script that lets you control self switches from other events); then you can just set the 'trigger' event to autorun and end it with 'erase event' so that it loads back up next time you enter the map. Hope that made sense and that it helps; I can throw together an example if you need!
I think the way to do this would be a separate event using switches instead of self switches (or a plugin that lets you control self switches from other events); then you can just set the 'trigger' event to autorun and end it with 'erase event' so that it loads back up next time you enter the map. Hope that made sense and that it helps; I can throw together an example if you need!
I get what you mean, I wanted to avoid main game switches/external events because i was planning to have a lot of npc spawning in this way and having a switch for each will probably get... very cumbersome :\

But yeah, if there's no way to do that with self switches, that's fair. Thanks for the answer 🙂
If it helps at all, you can definitely control all the NPCs on one map from a single invisible event; in some ways, that might make it easier, as all the controls will be in one place. Otherwise, yeah, I think you'll have trouble this way. On the other hand, lots of people here know better than I do; you might still get an answer that works better for you. Good luck!
you can use a map-based reset switch, but it will require a lot of work.

you'll need to add one more event page to every event that is to be reset.
condition this page to the reset switch
in the commands, use control switch and control variable to set all switches back that you want
after that make a wait(3)
and after the wait, control switch reset off
then make the page a parallel process.

if you turn on the switch before or on entering, all those events will reset themselves.
the wait 3 is to give every event a chance to process before disabling the reset - without the wait only the first event would reset and then disable the reset.

you'll either need one exclusive switch per map, or get a bit tricky with a single reset switch on entering to prevent the resets from happening when you don't want them.

Original thread: https://forums.rpgmakerweb.com/threads/resetting-self-switches-when-entering-map.148158/