[RMMV] Torch light puzzle problems

Alright, so...I tried to code a puzzle in which you have to light the torches in a certain color order for it to work.
When you get the order right, it works as normal, activating the switch and stuff. When you get it wrong, however, the self switches don't reset, and then you're stuck. This isn't even the first time this has happened.

I thinking that maybe the way I did this is too over-complicated, but I'm not too sure.

puzzleproblem1.PNG
puzzleproblem2.PNG
puzzleproblem3.PNG



EDIT: Thank you so much. I'll just have to do an individual script call to turn off each self switch on each event. A bit tedious but thankfully, I only have to do it once.

EDIT-EDIT- One small problem, every time the sequence resets, the last light you lit inexplicably relights, making it impossible to try it again. Anyone can shed some light on this? (pun intended)
that self-switch script looks strange - are you sure that it is supposed to be used like that?
the scripts that I remember needed every switch to be handled in its own command, it was not possible to set multiple switches in a single command.

That said, I would handle all sequentiel puzzles in a different way.

Use one variable for counting every step step of the puzzle, counting it up if the event is used in the correct order and resetting it if not.

so on the first event it is simply var += 1
on the second event it is conditional branch var=1 - if yes +1 else =0
on the third event it is conditional branch var = 2 - if yes +1 else =0

you can chain as many events as you want, even use some events multiple time with nested conditional branches, and the end of the puzzle is simply conditioned on the variable being higher or equal than the number of steps to reach that.
that self-switch script looks strange - are you sure that it is supposed to be used like that?
the scripts that I remember needed every switch to be handled in its own command, it was not possible to set multiple switches in a single command.

That said, I would handle all sequentiel puzzles in a different way.

Use one variable for counting every step step of the puzzle, counting it up if the event is used in the correct order and resetting it if not.

so on the first event it is simply var += 1
on the second event it is conditional branch var=1 - if yes +1 else =0
on the third event it is conditional branch var = 2 - if yes +1 else =0

you can chain as many events as you want, even use some events multiple time with nested conditional branches, and the end of the puzzle is simply conditioned on the variable being higher or equal than the number of steps to reach that.
The self switch script is a variation of Shaz's script for sequential switch puzzles:

The only thing that isn't correct is that the first event value should be 1 not 2. Even after fixing it still doesn't work. I've used this script in this same puzzle to get the torches to turn on and it works fine.

$gameSelfSwitches.setValue([75, 1, 'B'], true);

$gameSelfSwitched.setValue([75, 1 'A'], true);

And the puzzle needn't be activated in the right order. The colors that you set the torches to must be ordered, but you could activate the torches in any order you want.
The self switch script is a variation of Shaz's script for sequential switch puzzles:
variations of functions will NEVER work from themselves. If you want a variant of a function, you need to program in that function.

This:
$gameSelfSwitches.setValue([75, 1, 'B'], true);
will work, because the key [75,1,'B'] designates a single switch to be set to true.

[75,1,'A','B','C'] is NOT a key for a switch but is completely undefined, unless you added a plugin that programmed a function to dissassemble that string into several keys and use them.

So - have you added a plugin that allows you do change multiple self-switches with a single command, because that is NOT possible in the default as far as I know.
Why not use variables? The first switch goes up if the variable is 0, otherwise, it resets the variable and the switches. The second torch raises the variable if the variable is 1, otherwise, it sets the variable to 0 and resets the switches. The third torch raiser the vairable if the variable is 2 otherwise...ect, ect

The last torch checks if the variable is = the number of variables before it. if it is, the puzzle is solved. if not, the variable is reset

Original thread: https://forums.rpgmakerweb.com/threads/rmmv-torch-light-puzzle-problems.137607/