Making floor switches, multiples thereof, and requiring a specific order

Hello folks,

I've been trying to create the traditional "move a box onto a switch" puzzle as a test, and it's not quite going as I would hope. I've seen that previous iterations of the engine required using scripts in the conditional "if" section, but I was wondering if that's been changed for MV.

The other thing I want to do, once I can get that working, is to make it so that a door can only open once a set of switches are set, and in a specific order. Is that possible currently, without straight scripting, or no? (i.e. there are three switches, A, B, and C. They have to be pressed in B, A, and C order, or the door will not open.)

I know that requiring more than 2 switches will require a plugin (which I believe someone has already made a plugin for this, but I cannot currently remember who, my apologies), but I don't think there is an order to it, it's just all or nothing.

If this has been covered already, my apologies. My search-fu has been failing me a lot recently. ^_^;
No, it only requires scripting if you don't know how to do it correctly.


You assign a variable as the key to opening the door, allowing it only to be opened if the variable is above a number you set based on the number of switches.


Then, at each switch event, when the action button is pressed you check the current number of that variable.


If the switch is used in sequence (the variable is the number of the sequence minus one) then the variable is added by one.


If not (the variable is some other number) then the puzzle is reset by setting the variable to zero.


That's all you need to do to make sequential switches work.
No, it only requires scripting if you don't know how to do it correctly.

You assign a variable as the key to opening the door, allowing it only to be opened if the variable is above a number you set based on the number of switches.

Then, at each switch event, when the action button is pressed you check the current number of that variable.

If the switch is used in sequence (the variable is the number of the sequence minus one) then the variable is added by one.

If not (the variable is some other number) then the puzzle is reset by setting the variable to zero.

That's all you need to do to make sequential switches work.
Ahh, I see. Thank you very much!
No, it only requires scripting if you don't know how to do it correctly.

You assign a variable as the key to opening the door, allowing it only to be opened if the variable is above a number you set based on the number of switches.

Then, at each switch event, when the action button is pressed you check the current number of that variable.

If the switch is used in sequence (the variable is the number of the sequence minus one) then the variable is added by one.

If not (the variable is some other number) then the puzzle is reset by setting the variable to zero.

That's all you need to do to make sequential switches work.
Would this method work for a "collect the objects" style door as well, do you think? Or would that possibly be too messy?
Pocky, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.


it can be done this way, or you can make the objects real items and check the number collected with a combination of control variable and conditional branch
Would this method work for a "collect the objects" style door as well, do you think? Or would that possibly be too messy?
There is more than one way to do things.

You can nest conditional if's if there's not that many switches, and have the final switch set the variable that unlocks the next objective. I use this to check that all the required party members are present for example.

Another way that works for "Collectables" is to have a counter incremented after each object is collected. Make sure that the event "self-deletes" after it's picked up so can't be repeated. A less error prone way is to actually set a value to a variable, eg "5" and then test for less than or equal to 0. So each collectible subtracts 1. That also allows the player to "over collect".

In the "move boxes on top of switches" puzzle, you would want to make sure that the objects final condition checks to see if the objective has been met and tell the player so. eg "if remaining boxes =0, say "you hear a click in the wall"" and set the switch so that any further attempts to move it or other boxes doesn't trigger the message again.

If a certain order has to be done, then you nest the IF's in that order on the "unlock" event, OR, you put one IF statement in event to test for the previous event's conditions. So if the player successfully did event 1, the counter should now be at either 1 (if you're adding) or 4 (if you started at 5 and subtracted 1)

Edit 1:

Back in 1988 or so when I got my first computer, there was pages explaining how variables work (in BASIC). It is analogous to how electricity circuits work.

You either have "series" switches, which means "all switches must be true", which is what AND (IF) is.

And you have "parallel" switches, which means that "any switch must be true", which is what OR is (which doesn't exist in RPG Maker.) 

Series is represented as nested IF's

if switch one is ON+ if switch two is ON + if switch three is ON Do something and then exit processingWhen you can't do a "OR" switch, you actually just test each condition once and then test the final condition.

if switch is ON+ set switch99 ONif switch2 is ON+ set switch99 ONif switch99 is ON+ do processing ELSE is the testing of "Not true", or "NOT"

So something has to be either true or NOT true

if switch1 is ON text "Hey your refrigerator is running"else text "The refrigerator is not running"So only one condition will be executed.
Thanks to everyone who has responded! It's been a big help, and I've got most of it working now.

The only thing left is the "move a box (or something) on top of a switch to activate the... switch." part. I saw for previous RPG Makers that this involved some scripting; does that still hold true?
There is more than one way to do things.

You can nest conditional if's if there's not that many switches, and have the final switch set the variable that unlocks the next objective. I use this to check that all the required party members are present for example.

Another way that works for "Collectables" is to have a counter incremented after each object is collected. Make sure that the event "self-deletes" after it's picked up so can't be repeated. A less error prone way is to actually set a value to a variable, eg "5" and then test for less than or equal to 0. So each collectible subtracts 1. That also allows the player to "over collect".

In the "move boxes on top of switches" puzzle, you would want to make sure that the objects final condition checks to see if the objective has been met and tell the player so. eg "if remaining boxes =0, say "you hear a click in the wall"" and set the switch so that any further attempts to move it or other boxes doesn't trigger the message again.

If a certain order has to be done, then you nest the IF's in that order on the "unlock" event, OR, you put one IF statement in event to test for the previous event's conditions. So if the player successfully did event 1, the counter should now be at either 1 (if you're adding) or 4 (if you started at 5 and subtracted 1)

Edit 1:

Back in 1988 or so when I got my first computer, there was pages explaining how variables work (in BASIC). It is analogous to how electricity circuits work.

You either have "series" switches, which means "all switches must be true", which is what AND (IF) is.

And you have "parallel" switches, which means that "any switch must be true", which is what OR is (which doesn't exist in RPG Maker.) 

Series is represented as nested IF's

if switch one is ON+ if switch two is ON + if switch three is ON Do something and then exit processingWhen you can't do a "OR" switch, you actually just test each condition once and then test the final condition.

if switch is ON+ set switch99 ONif switch2 is ON+ set switch99 ONif switch99 is ON+ do processing ELSE is the testing of "Not true", or "NOT"

So something has to be either true or NOT true

if switch1 is ON text "Hey your refrigerator is running"else text "The refrigerator is not running"So only one condition will be executed.
Thank you, this has been very helpful! I took BASIC years ago... and I remember some (and more, as I've been working through MV), but not all of it yet. ^_^; 
Pocky, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.

it can be done this way, or you can make the objects real items and check the number collected with a combination of control variable and conditional branch
I see, thank you!

(And sorry about the double post, that was unintentional. ^^; )
Pocky, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.

(And sorry about the double post, that was unintentional. ^^; )
Then why did you do it again? Not only two, but now there are three posts from you under each other.
If your own post is the last post in a topic, you have to edit that instead of adding more posts beneath it.


If you want to quote several people, use multiquote.


And you don't need to quote titanic texts - only keep the part of the quote you're referring to and delete the rest.
Ahh, sorry. I was still waking up. I'll be sure to not do that again. My apologies.

EDIT: Is it possible to delete posts? I'd like to clean my own mess, if possible. I tried to find a delete command in the editor, but wasn't able to.
No - only moderators can delete posts, and we usually do that only for specific reasons. Randomly deleting posts will only make other posts that reference to them unreadable.
Okay, understood. Thank you for your patience, I promise not to double (or triple) post again. You and the other folks here have been a big help, and I appreciate it!

Original thread: https://forums.rpgmakerweb.com/threads/making-floor-switches-multiples-thereof-and-requiring-a-specific-order.49533/