How to reset all treasure chests in map?

I would like to have my dungeon maps reset all the treasure chests when you enter them. One way I could do this is to set separate switches for each chest and turn them all off manually. But this can get really tedious and buggy. I really would like to find a self switch solution that will enable me to copy/paste chests without changing the switches of each and every one.


In other words, how can I write a script that "Turns off all Self Switch A" if the event name is "Treasure"?


This can also be used to respawn monster events too.
There are multiple ways you could do this but I feel like the easiest way to do it would be having all of the chests connected to a common event or have them all on regular switches instead of self switches and then have an event on all the points of the map where you can exit the map turn those switches off so that theyt reset back to page one.  Then when you open them, and they are on their second page and the switch is on, You can then again leave, and it would turn those switches off effectively resetting the chests.
Hey there, I know you weren't looking for an event solution, but I think I've found one. It's okay if you would prefer not to use it, but I think it works pretty well, for what you want.


It requires only the use of one switch, which will be turned on at the entrance of the dungeon. Kinda something like this:


IUYqg97.png



After you do that, it comes to setting up the chest events, which requires 3 pages.


I'll put the pages first and then elaborate:


vfRQoXG.png



cv6eSzr.png



wIMi1Zr.png



After activating a single chest, the reset switch turns off to prevent the chest from being looped over and and over again. Using self switches you make a loop where it only goes back to the second page once you re-enter the dungeon/room.


This way, it resets all the chests you have when you re-enter the room, but you don't need to set a separate switch for each chest.



If your dungeon is multiple maps, it becomes a tiny bit of an issue if you don't want the chests resetting each time you enter a specific room in the dungeon. I'm trying to find a solution to that. I'll let ya know if I do.


Otherwise, if you are okay with that, this is what you do to have it reset in the other rooms.



Instead of setting it on when you first enter the dungeon, we'd have it set for each room. First, set up a parallel event like this for every room there is chests in:


7s3ofFz.png



Next, in the transfer events, set it up like this:


jJ6N1ct.png



That way it still resets each time you enter the room and still only using one switch.


Hopefully this will be of help to you!
There is an even simpler solution, but it has one side-effect: the chest will not be displayed as an open chest, it will vanish after opening.


And that solution is to replace the control self-switch command on the chest event page with an erase event command and don't use self-switches or the second page at all.
@Rusty_Gears Hey I never thought of that. This is an elegant solution!
To avoid vanishing chests, put an invisible event beside the chest, and have the chest move the invisible event to the same location and change its image to an open chest before the chest erases itself.


Like the erased event, the dummy chest should reset itself on reentering the map.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-reset-all-treasure-chests-in-map.60996/