Making some Self-Switches permanent and others reset

So I'm using a lot of switches in my project and want some of them to stay permanent and others to change whenever you move to a different map (Some dialog, enemies, since I'm not using random encounters etc.). This can ofc be done using some global switches and some self switches, but I realized that even if I reuse the same global switches on different maps, it's still a bunch of work for something that could potentially be done easier.

So my question is if anyone has an idea for making some self switches reset whenever the scene changes, but others don't. Having to use scripting is not an issue.
Evented Workaround:
Everytime the Map is entered a Event will run once and turn a Switch On, that Switch is used as condition for the Events so called "Reset Eventpage". This runs only once when needed and should work flawless and offers easy adjustments.

I hope its ok that the Switches resett when the Map is entered, not when the map is left, but if that is a problem iam sure its somehow possible to switch it around.

Create a Paralell Event on your Map:
Turn Global SwitchX ON
Wait 4 Frames
Turn Global SwitchX OFF
Eventcommand Erase Event (Thatway its always executed 1x everytime the Map is entered)

Now go to your single Events and create an extra Eventpage(If Event got 2 Pages, thisone needs to be the 3rd), with condition SwitchX ON and on Paralell Process:
Turn Self Switches OFF
Wait 60 Frames
Awesome. Pretty smart way to do it.

Out of curiosity, what's the purpose of the waits and their amounts. I get that the first one is to let other events run before it goes back to off, but why 4 frames exactly? And why should the other events wait 60 frames after resetting?
waiting 1 frame instead of 4 should also work, but iam a casual so i went with 4 frames. But i wasnt sure if i got 100 Events if all get iterated in that 1frame or not (normly they should) but in case they are not, i chosed 4 frames.

The 60 Frames i just entered so the event isnt running again and again until the switch is off.
So simply its just waiting for 1 second, but it will be turned off way before the end of the wait is near.

sorry my english aint the best and dont know how to explain. if someone else knows more, let us know.
Nahh, it's okay I understand. Makes sense really. With the first part I'm pretty sure 1 or 2 frames should work just as well. I could always change it if issues appear.
The second part I figured out by testing. I suppose the waiting process is just interrupted when the switch is turned off again.
If you want to get more fancy with this, than you could put the Code into a Common Event, one that never runs.
Than let the paralell Event which previously turned the switch on instead do the Eventcommand: Call Common Event.
Than the Eventcode of that Common Event becomes the Eventcode of this Event.

This is helpfull in case you want to change the Wait or something else like a Soundeffect, than you just need to edit the common event without having to search and change that event on every possible map.
Ahh, that's a good point. I will probably do that. Thanks 🙂

Original thread: https://forums.rpgmakerweb.com/threads/making-some-self-switches-permanent-and-others-reset.105324/