Status
Not open for further replies.

Whitewitchworks

Veteran
Veteran
Joined
Dec 1, 2015
Messages
42
Reaction score
113
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
326
Reaction score
124
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
37,980
Reaction score
10,549
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
42
Reaction score
113
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
37,980
Reaction score
10,549
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)
 

Whitewitchworks

Veteran
Veteran
Joined
Dec 1, 2015
Messages
42
Reaction score
113
First Language
English
Primarily Uses
N/A
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
    Attempt one.png
    356.8 KB · Views: 5
  • Attempt three.png
    Attempt three.png
    331.5 KB · Views: 5
  • Attempt two.png
    Attempt two.png
    350.6 KB · Views: 4

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
37,980
Reaction score
10,549
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.
 

Whitewitchworks

Veteran
Veteran
Joined
Dec 1, 2015
Messages
42
Reaction score
113
First Language
English
Primarily Uses
N/A
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
    Puzzleshot.png
    496.6 KB · Views: 5
  • switch2page1.png
    switch2page1.png
    359.3 KB · Views: 5
  • switch2page2.png
    switch2page2.png
    356.7 KB · Views: 5

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
37,980
Reaction score
10,549
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
42
Reaction score
113
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
37,980
Reaction score
10,549
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

  • lightcount.jpg
    lightcount.jpg
    190.1 KB · Views: 6

Whitewitchworks

Veteran
Veteran
Joined
Dec 1, 2015
Messages
42
Reaction score
113
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
42
Reaction score
113
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
10,110
Reaction score
6,397
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.

Latest Threads

Latest Profile Posts

Trailer is almost done for the game i can't wait to show it to everyone
I've got good news and bad news. The good news is, there aren't any bad news to report. The bad news is, there aren't any good news to report.

Or as others say, yesterday was uneventful.


I am curious that can you "understand/get the point" about what does this place do generally?
(ARPG game)
If anyone knows any C# programmers, please send them my way.
Chilling at night in a tavern.
ChillingAtTavern.png

After 'multiple breakdowns', it's finally over. 10/10 will do this again.

Forum statistics

Threads
129,856
Messages
1,205,750
Members
171,032
Latest member
RoyKerry
Top