Puzzel door won't stay locked untill puzzel is solved.

Status
Not open for further replies.

Whitewitchworks

Veteran
Ok I'm having a bit of a problem, I'm making a puzzle game and for one of the puzzle rooms you have ts change all the lights to green, I already have the light conditions set so when you walk on them they change and effect neighbouring lights.

so the puzzle starts

X0XXX0X

but say you walk over the very middle then it becomes

X00000X

then you walk over the end

0X0000X

then over the second to the left

X0X000X

and so on and so forth until the puzzle is all green lights

0000000

The problem is, I want the door to the next room to only Open when all the lights are green But conditional branching only allows for one condition. I tried using multiple condition switches with else branches but it will still open if any one of the lights are green

I tried variable but ran into another problem, because of the way the puzzle work you may need to step on a light multiple times changing it causing the Values to change but because of how many light and combinations there are people who struggle with the puzzle may end up with really high values

I'm really stuck on how to fix it anyone know how to work it?

glaphen

Veteran
Use a script call conditional.
Code:
``\$gameSwitches.value(1) && \$gameSwitches.value(2) && \$gameSwitches.value(3) && \$gameSwitches.value(4) && \$gameSwitches.value(5) && \$gameSwitches.value(6) && \$gameSwitches.value(7);``

Andar

Veteran
But conditional branching only allows for one condition.
because you don't need more, there are several solutions to this

First possibility is to nest conditional branches, checking those conditions one after another inside the true branches of the previous condition. Then the effect will only take place if every condition is fulfilled

Second possibility is to have the conditions checked on the switches, not on the door. Set a variable to zero, then count the number of lights that are correct and open the door only if the counter reaches 7 (all lights correct).

The scripted solution mentioned above is another possibility, but it will have limits in the number of conditions - if you have too many lights that script line will become too long and you'll have to go with a correct-counter like above anyway.

Whitewitchworks

Veteran
Use a script call conditional.
Code:
``\$gameSwitches.value(1) && \$gameSwitches.value(2) && \$gameSwitches.value(3) && \$gameSwitches.value(4) && \$gameSwitches.value(5) && \$gameSwitches.value(6) && \$gameSwitches.value(7);``
I am not advanced enough by anymeans to script *laughs* but thank you for the suggestion

because you don't need more, there are several solutions to this

First possibility is to nest conditional branches, checking those conditions one after another inside the true branches of the previous condition. Then the effect will only take place if every condition is fulfilled

Second possibility is to have the conditions checked on the switches, not on the door. Set a variable to zero, then count the number of lights that are correct and open the door only if the counter reaches 7 (all lights correct).

The scripted solution mentioned above is another possibility, but it will have limits in the number of conditions - if you have too many lights that script line will become too long and you'll have to go with a correct-counter like above anyway.

I tried nesting but once Light event 1 was green it worked even if other light events where off

I'll try the Variable in reverse and see what happens.

I appriciate both of your suggestions thank you very much

Andar

Veteran
I tried nesting but once Light event 1 was green it worked even if other light events where off
then you didn't nest correctly.
You have to look exactly where to place which command (that is what the indentions are there to help) to get the effect.
With seven conditions the correct place for the open effect would have to be indented three centimeter to the right or so, and it sounds as if you placed the comments on the first indention (about half a centimeter)

Whitewitchworks

Veteran
I think I have to be doing something wrong. I'm including screen shots of the three Things I have tried Maybe someone can see what I'm doing wrong?

Attachments

• Attempt one.png
356.8 KB · Views: 5
• Attempt three.png
331.5 KB · Views: 5
• Attempt two.png
350.6 KB · Views: 4

Andar

Veteran
none of these screenshots make any sense at all, so of course they don't work.

please take a step back and explain how your seven switches are working and handled, and then explain how you did the door.
If done correctly each of the seven switch events as well as the door event should have two pages only, and none of those events should use any self-switches (only seven switches for the seven lights and one variable for the counting condition).

Two screenshots of the two pages of one switch should be enough to clear up how you did them as I assume all work in a similiar matter.

Whitewitchworks

Veteran
I'm sorry I'm i'm showing you light 2 because it has lights on both sides and the actual puzzle floor to see how I set it up

Attachments

• Puzzleshot.png
496.6 KB · Views: 5
• switch2page1.png
359.3 KB · Views: 5
• switch2page2.png
356.7 KB · Views: 5

Andar

Veteran
you need to streamline your events, you'll never get it done with two switches per event.

You'll need one switch per event, with Light 1 = ON means green and Light 1 = OFF means red.
That will make your events much easier as you have only one conditional branch (Light 1 = ON?) to determine if you need to turn it on or off.

After that you can either count how many switches are ON or use them directly in nested conditions to check.

Your door event (if you go with the counting method) would have page one as door closed, page two as door open and the condition of the page 2 would simply be a variable lightcounter >=7

Whitewitchworks

Veteran
Sorry I'm confused I only have one switch per event though? Each event has it's self switch EX, for the second light in the pages the switch for the at event is Green 2 then to the left is Red one, and to the right is Red 3 So in a line they are Red 1 Green 2 Red 3 each only has one switch but turning on or off is meant to effect the switches on either side.Or do you mean I can somehow tie all the event lights to one switch but still get the puzzel to work the same?

I'm sorry for asking so many questions I really appriciate your help

Andar

Veteran
Your naming is confusing, and you added conditional branches that are not needed to this.
I'll attach an alternate example how it could be done - but this might require an additional event to set the switches based on which light should be on or off when the player first enters the room.
The screenshot also shows how to count if a switch is correct, with that you don't need any code on the door event at all (only have the condition to be the counter at 7 to open)

Attachments

• lightcount.jpg
190.1 KB · Views: 6

Whitewitchworks

Veteran
Oh I'm sorry It was the best way to keep track of the switches for this puzzle I can see how to someone looking from outside would get confused that was my fault.

Thank you for the example I'll try this now and let you know

Whitewitchworks

Veteran
AHHH! It worked, I just teadted it Thank you thank you thank you so so so so much! It works yeay!

slimmmeiske2

Little Red Riding Hood

Status
Not open for further replies.

Latest Profile Posts

Do you think horror RM games are still a thing today?
Now counting one week of skies alternating between cloud, rain, and heavy winds, in the middle of summer. Sure puts a new meaning to the phrase "strange weather around here"
Vacation from work coming up, hope I can smash out a bunch of progress on my game
We gather here on this divine day of Saturday, to proceed with the game make! Praise be.