Random chests in dungeon

I want to create a dungeon that has chests that don't always spawn, I have them in set locations and use a random variable to decide whether or not they spawn and self switches for when they are turned on or opened. The problem is I want them to re-run the chance every time you visit the dungeon but since self switches don't reset this doesn't happen. I have no idea how to do this without making a long list of switches and resetting them all when you leave, which for my intended purpose would leave me with a LOT of switches to work with. Is there a way to do this without giving each chest a switch?
you want your chests to reappear when you enter the dungeon ??  but not same chests all the time i guess??


what you want to do is place one variable, chest spawn ...when you teleport into dungeon or move in... place an event ...control variable random between X and Y


each time you enter the variable will change number, and different chests will spawn


your transfer player event will look like this


control variable (random number between x and y)


transfer player to dungeon (coords)
Personally, I just picked a nice animation for a chest vanishing (optional), faded out the chest graphics (wait for completion) and then erased the event. No switch means it'll be back next time.
Thank you both, for anyone wondering I did a combination of the two. I set an autorun event for the object and set the variable to a random number (for example 1-25) then check if it equals the highest number (25) if it does not it erases the event, if it does there is a separate event page that runs only if the number is the highest possible (25), this is the chest page, when it is opened I fade it out and erase the event. This way it always reruns the chance for every chest each time I enter the room regardless of whether or not it was opened last time.

Original thread: https://forums.rpgmakerweb.com/threads/random-chests-in-dungeon.58848/