Is there a way to fully reset one or multiple maps?

Hello. Is there a possible way to reset a map during gameplay using a plugin or even just event stuff? I'm making a dungeon that you can repeat as many times as you like, and every time you clear it the dungeon resets, meaning all the chests respawn, enemies respawn, puzzles reset, ect. Is there a way to do this is MV using a plugin or something else? Thanks.

Edit: Never mind. I found another thread that helped me a lot. Here is a quote from there
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);}
Thanks @mrcopra for the help!
.
That is just resetting the self switches on all events on the map. If any event changed a switch or a variable, you would also need to set those back to a default/original value, which could be problematic if events on other maps also modify them.
I'm a big fan of just spawning in all the events, and despawning them when the player leaves.
@Shaz Actually, the only thing I need to reset is the self switches, so this is perfect!

Edit: @ImaginaryVillain That's too much work, especially when events don't repeat too often. I would rather just make the events in the map rather then spawn all them in when you enter it. Then you can use the auto transfer command to help make your game much faster instead of making custom transfers.

Original thread: https://forums.rpgmakerweb.com/threads/is-there-a-way-to-fully-reset-one-or-multiple-maps.133387/