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

Status
Not open for further replies.

Whitewitchworks

Veteran
Veteran
Joined
Dec 1, 2015
Messages
39
Reaction score
74
First Language
English
Primarily Uses
N/A
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?
Thanks for reading any suggestion would be helpful Please.
 

glaphen

Veteran
Veteran
Joined
Jan 13, 2019
Messages
302
Reaction score
110
First Language
English
Primarily Uses
RMMV
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
Veteran
Joined
Mar 5, 2013
Messages
29,551
Reaction score
6,880
First Language
German
Primarily Uses
RMMV
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
Veteran
Joined
Dec 1, 2015
Messages
39
Reaction score
74
First Language
English
Primarily Uses
N/A
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
Veteran
Joined
Mar 5, 2013
Messages
29,551
Reaction score
6,880
First Language
German
Primarily Uses
RMMV
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)
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,551
Reaction score
6,880
First Language
German
Primarily Uses
RMMV
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.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,551
Reaction score
6,880
First Language
German
Primarily Uses
RMMV
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
Veteran
Joined
Dec 1, 2015
Messages
39
Reaction score
74
First Language
English
Primarily Uses
N/A
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
Veteran
Joined
Mar 5, 2013
Messages
29,551
Reaction score
6,880
First Language
German
Primarily Uses
RMMV
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

Whitewitchworks

Veteran
Veteran
Joined
Dec 1, 2015
Messages
39
Reaction score
74
First Language
English
Primarily Uses
N/A
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
Veteran
Joined
Dec 1, 2015
Messages
39
Reaction score
74
First Language
English
Primarily Uses
N/A
AHHH! It worked, I just teadted it Thank you thank you thank you so so so so much! :D It works yeay!
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
6,183
Reaction score
4,301
First Language
Dutch
Primarily Uses
RMXP

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Forbidden - You don't have permission to access /index.php on this server.
I love how people have real technical issues and im all like ''I CANT DECIDE ON A FONT'' :p
So this question doesnt deserve its own thread, but why the hell does the B-Layer gets erased when I draw on the Ground-Layer while the RMXP had 3 individual layers?

Forum statistics

Threads
95,745
Messages
931,516
Members
126,125
Latest member
ronylaplata
Top