So i am thinking about a puzzle that has several (most likely 5-6) switches that can be pressed. And the player needs to press on them in right order. Right now the possible event i can imagine is making each press trigger the separate switch, and then check each of the other switches that should be turned on, and creates yet another switch on each successfull press, but i don't see a way to reset all those switches when player starts anew. I would like to avoid the reset button and instead allow player to just start pressing switches again at any moment. But not sure how that can be done. Maybe someone has advice?
Pressing switches in right order
RPG Maker MV SupportIf I understand this correctly, you just want to let the player keep stepping on the switches and if at any time the player steps in the right order, then it’s a victory dance?
Let’s say you have 6 switches. And the correct order is 6, 5, 4, 3, 2, 1. (If you want this order to be random each time, then it will be a bit more complicated and you’d need to use a variable array instead of hard-coded numbers)
When game starts set a variable, say, next_switch to 6.
Each switch will have an event page.
Event page for switch 6 would be:
If next_switch is 6
Set next_switch to 5
Event page for switch 5 would be:
If next_switch is 5
Set next_switch to 4
Else
Set next_switch to 6
Event page for switch 4 would be:
If next_switch is 4
Set next_switch to 3
Else
Set next_switch to 6
Event page for switch 3 would be:
If next_switch is 3
Set next_switch to 2
Else
Set next_switch to 6
Event page for switch 2 would be:
If next_switch is 2
Set next_switch to 1
Else
Set next_switch to 6
Event page for switch 1 would be:
If next_switch is 1
YOU WIN
Else
Set next_switch to 6
Let’s say you have 6 switches. And the correct order is 6, 5, 4, 3, 2, 1. (If you want this order to be random each time, then it will be a bit more complicated and you’d need to use a variable array instead of hard-coded numbers)
When game starts set a variable, say, next_switch to 6.
Each switch will have an event page.
Event page for switch 6 would be:
If next_switch is 6
Set next_switch to 5
Event page for switch 5 would be:
If next_switch is 5
Set next_switch to 4
Else
Set next_switch to 6
Event page for switch 4 would be:
If next_switch is 4
Set next_switch to 3
Else
Set next_switch to 6
Event page for switch 3 would be:
If next_switch is 3
Set next_switch to 2
Else
Set next_switch to 6
Event page for switch 2 would be:
If next_switch is 2
Set next_switch to 1
Else
Set next_switch to 6
Event page for switch 1 would be:
If next_switch is 1
YOU WIN
Else
Set next_switch to 6
Hi,
What you would like to achieve is easiest done using state machines. You could then have repetitions to the switches, like 1, 2, 1, 2, 3, 3, 4.
Each switch in the event would set variable 'SwitchNrPressed' to its number. Then execute a common event.
Common event can use a variable State which would be 0 in the begining and change the state depending on the SwitchNrPressed which would look something like this:
This way you have the entire switches system logic in one place and it is flexible as you may program repetitions. So you may not need as many switches.
What you would like to achieve is easiest done using state machines. You could then have repetitions to the switches, like 1, 2, 1, 2, 3, 3, 4.
Each switch in the event would set variable 'SwitchNrPressed' to its number. Then execute a common event.
Common event can use a variable State which would be 0 in the begining and change the state depending on the SwitchNrPressed which would look something like this:
This way you have the entire switches system logic in one place and it is flexible as you may program repetitions. So you may not need as many switches.
Original thread: https://forums.rpgmakerweb.com/threads/pressing-switches-in-right-order.176185/