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,372
Reaction score
8,395
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,372
Reaction score
8,395
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
1,983
Reaction score
568
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

BCj
Working on Escalia again, feels good. Have this overwhelming urge to map as well, but need to get some extra tiles commissioned first :D
Lee Sang wrote on Bandito's profile.
Hi, I've just tried your plugin "Game is Active" and when I tested it on Android, it gave me an error, something about "Cannot read property 'underfined' of underfined.
With my project, I want the player to have access to all the tools they need to get from New Game to Credits as soon as possible; I want the player's progress to only be impeded by the player not knowing how to use the tools the game provides.
Just a little close up shot...
w2xZocX.jpg
finally drew the last member of "team outcast" for my game. since my game has a lot fighting game elements in it, there's bosses in teams of three like King of Fighters.

Forum statistics

Threads
113,857
Messages
1,077,986
Members
147,949
Latest member
paravn9
Top