Tiffypowers79

Villager
Member
Joined
May 11, 2021
Messages
6
Reaction score
0
First Language
English
Primarily Uses
RMMV
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.PNGpuzzleproblem2.PNGpuzzleproblem3.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)
 
Last edited:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
33,646
Reaction score
8,479
First Language
German
Primarily Uses
RMMV
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.
 

Tiffypowers79

Villager
Member
Joined
May 11, 2021
Messages
6
Reaction score
0
First Language
English
Primarily Uses
RMMV
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.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
33,646
Reaction score
8,479
First Language
German
Primarily Uses
RMMV
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.
 

Oddball

Veteran
Veteran
Joined
Sep 4, 2014
Messages
2,006
Reaction score
581
First Language
English
Primarily Uses
N/A
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
 

Latest Threads

Latest Profile Posts

Will be focusing on map making today and adding locked chests :LZSsmile:Screenshot 2021-09-16 095316.png
It's hard to stay consistent for at least a week
new enemies for the game I'm working on...
Fricken hell! I dropped a bowl with mac and spam on my brothers floor, and was going to put leftover mac with whatever was still safe in there. It was only after I added the leftover mac that my brother told me he put floor noodles in there, now I wasted my planned dinner for tomorrow!
How to make a cool character 101: Create a messy plot, make the character said "all according to the plan", then somehow the problem is solved.

Forum statistics

Threads
115,101
Messages
1,087,208
Members
149,554
Latest member
Alexxyx_x
Top