[RPG Maker MV] Reset the self switches in a Map?

I wonder if there's a way to do it, I only know how to reset the self switches in all the game, but there's a lot stuff that works with self switches in my project so I can't just shut down all of them, I just need to do it on a one map, is all... But I can't find a way to do it.


Someone knows?


PD: I'm new in the forum, so... If I post it in the wrong place, tell me.


PD2: My mother language is spanish, so, sorry for my bad english...
Try this


make event in the map > script > 

Code:
var m = $gameMap.mapId();
for (var s = 1; s < $dataMap.events.length; s++){
$gameSelfSwitches.setValue([m, s, 'A'], false);
$gameSelfSwitches.setValue([m, s, 'B'], false);
$gameSelfSwitches.setValue([m, s, 'C'], false);
$gameSelfSwitches.setValue([m, s, 'D'], false);}
mrcopra answer seems to be easiest.


alternatively you could create an last extra Eventpage on Paralell  which deactivates there own self switches, that for every Event  and get a Switch as Condition for the Page (Call the switch reset for example).


To reset the Events Selfswitches just do:


Activate Switch


Wait 1 Frame (Maybe 4 if 1 doesnt work)


Deactivate Switch


(Now your Events should have enough Time to Switch there Eventpage run the code once)


You have to Turn off the switch quick cause this methothe can cause a little fps drop if too many events are paralell active at the same time.


But for a few Frames it should be ok in this case. My english aint the best so i hope i explained well enough.
Try this


make event in the map > script > 



var m = $gameMap.mapId();
for (var s = 1; s < $dataMap.events.length; s++){
$gameSelfSwitches.setValue([m, s, 'A'], false);
$gameSelfSwitches.setValue([m, s, 'B'], false);
$gameSelfSwitches.setValue([m, s, 'C'], false);
$gameSelfSwitches.setValue([m, s, 'D'], false);}


OK, got it! I'm gonna try! Thanks to much!

To reset the Events Selfswitches just do:


Activate Switch


Wait 1 Frame (Maybe 4 if 1 doesnt work)


Deactivate Switch


(Now your Events should have enough Time to Switch there Eventpage run the code once)


You have to Turn off the switch quick cause this methothe can cause a little fps drop if too many events are paralell active at the same time.


But for a few Frames it should be ok in this case. My english aint the best so i hope i explained well enough.



Don't worry, I understand! And welp, thanks for the advice! 😀
Sure and thanks, no Problem.

Original thread: https://forums.rpgmakerweb.com/threads/rpg-maker-mv-reset-the-self-switches-in-a-map.61599/