How to make a timed switch puzzle?

So, I feel kind of weird for asking this because I managed to pull this off in another project I worked on a while ago, but I didn't want to jump in-between projects to try to figure out how I did it, so I figured I'd ask here for a clear explanation for how to do this.

I want there to be a puzzle that involves a button and a switch. One is kind of a "prep" button, which is the one that you press first. This makes a timer go off, and you have to go and flip the witch before the timer gores off. If you succeed, then a sound will play and it'll add a variable to a variable group (I want a total of 4 of these button and switch puzzles). If you fail, a buzzer sound will play and it resets the puzzle.

How exactly would I engineer this?

Thank you!
Puzzle lover here!
With what you describe, I would have used a combination of the Control Timer option in your Event Commands, a parallel event, and a Conditional Branch.

I would have made it like this:

Push button, this turns ON a behind-the-scenes Switch (call it Timer. This is not your actual in-game switch).
In that same command, set a timer for the time limit you want under your Control Timer command.

Now, make a separate event that's parallel, that is only activated with your Timer Switch when it is ON (turned ON by your button).
Within this parallel event, use a Conditional branch that checks for the Timer's value constantly. (It's option 4 in your Conditional branches)
You can use this as you wish, but ideally, make it to where if the Timer = 0 (aka player runs out of time), have the parallel event turn itself off, and turn the Timer Switch OFF.


That's how I'd approach this in a general sense!

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-a-timed-switch-puzzle.161215/