Conditional Event Simplification / Event Coordinates Interfering With Each Other

Alright, so this is a little complicated so I'm going to try and provide as much information as I can.

I am making a dungeon puzzle that requires 4 boulders to be placed onto individual tiles. When a boulder is on a correct tile, a torch lights up, and when all 4 torches are lit, the puzzle is solved. I have events checking the X and Y coordinates of the boulders and the tiles they sit on that turn the torches on if the X and Y coordinates match. However, there is a slight problem. Since my puzzle is designed like a plus sign, two torches share an X coordinate, and two share a Y coordinate.
Spoiler: Plus Puzzle
Torch Puzzle.png

As you can see, the torch with the boulder is lit. However, the torch directly beneath it won't turn on because the conditional event checks the X coordinate and matches the lit torch. How can I make the conditional event check both X and Y? Currently, I believe it only checks X and matches, and then terminates if it doesn't match Y. I'm sure there is a simple solution to solve it, but my brain is fried and I can't figure it out. I know this is somewhat complicated so if you need any additional information please ask! Please help x.x
Spoiler: Conditional event
conditionalevent.png
conditionalevent2.png
Spoiler: bonus side effect of problem
notworking.gif
If I am understanding this correctly, I don't think there should be any 'Else' conditions.
The conditionals for each boulder should check it's x and y, but you wouldn't want an else statement. Otherwise, once it reaches a condition that matches, it terminates the whole sequence after running the code inside the matching conditions.

Also, I'm not understanding why the player X and player Y are being checked in the second page of conditionals. Did you mean to check boulder 4?
Yes we could try and fix your parallel Event, or we change it a little bit and do it without it.
Okay lets try the parallel Event:
It looks like that you are comparing switches, that indicates we are missing a Event Picture.
Here a example of how this could look like:
Spoiler
Code:
◆Control Variables:#0012 MyRockMapX = Map X of EV001
◆Control Variables:#0013 MyRockMapY = Map Y of EV001
◆If:MyRockMapX = 5
  ◆If:MyRockMapY = 3
    ◆If:MyRockOnPlace is OFF
      ◆Wait:20 frames
      ◆Control Switches:#0002 MyRockOnPlace = ON
      ◆
    :End
    ◆
  :Else
    ◆If:MyRockOnPlace is ON
      ◆Wait:20 frames
      ◆Control Switches:#0002 MyRockOnPlace = OFF
      ◆
    :End
    ◆
  :End
  ◆
:Else
  ◆If:MyRockOnPlace is ON
    ◆Wait:20 frames
    ◆Control Switches:#0002 MyRockOnPlace = OFF
    ◆
  :End
  ◆
:End
The Wait comand is optional, its sometimes used, so the rock has time to finish moving onto the maptile. because mapcoordinates change and the rock just started moving and other stuff happens to quickly, like the torch lites up to early.

Edit: Forgot a few lines of Code, its Edited now.
If I am understanding this correctly, I don't think there should be any 'Else' conditions.
The conditionals for each boulder should check it's x and y, but you wouldn't want an else statement. Otherwise, once it reaches a condition that matches, it terminates the whole sequence after running the code inside the matching conditions.

Also, I'm not understanding why the player X and player Y are being checked in the second page of conditionals. Did you mean to check boulder 4?

I want the torch to light when the player is standing on the spot as well, but then turn off when they step off so that in order to complete the puzzle, it has to have a boulder. To simplify it I left out that the black torch has a unique condition, but lets just say we need 3 boulders to solve it. So you're saying just to remove the else conditions? That makes sense, and I don't know why I didn't try it. I'll try that out now.
EDIT: So it works well with your changes and the removal of the Player Position checks, but I would really like to have it trigger by player touch as well. Any ideas on why the player positions would create the problem as shown in the gif hidden behind the last spoiler tag? It only seems to track one coordinate, not two, after the player triggers it, and the torch stays lit while walking along that axis.

Yes we could try and fix your parallel Event, or we change it a little bit and do it without it.
Okay lets try the parallel Event:
It looks like that you are comparing switches, that indicates we are missing a Event Picture.
Here a example of how this could look like:
Spoiler
Code:
◆If:MyRockMapX = 5
  ◆If:MyRockMapY = 3
    ◆If:MyRockOnPlace is OFF
      ◆Wait:20 frames
      ◆Control Switches:#0002 MyRockOnPlace = ON
      ◆
    :End
    ◆
  :Else
    ◆If:MyRockOnPlace is ON
      ◆Wait:20 frames
      ◆Control Switches:#0002 MyRockOnPlace = OFF
      ◆
    :End
    ◆
  :End
  ◆
:Else
  ◆If:MyRockOnPlace is ON
    ◆Wait:20 frames
    ◆Control Switches:#0002 MyRockOnPlace = OFF
    ◆
  :End
  ◆
:End

It is comparing variables that are automatically being determined by a common event. All they do is check the position of the boulders.
You dont have to determine those variables all the time by common Event. Its enough to set and check them when needed.
This also eliminates possible room for bugs.

I edited my Code, because it was missing a few lines.
Since you put the next conditions on the Else of the first, they will only run if the first condition is false... This is why events with that same X wont trigger..

What you'd want to do is either use separate conditional branches per event (so no elses) or make sure you only use the else of the 2nd conditions.
In the below example Rocks themself do the position check when getting pushed.
Maybe thisway your Parallel Event get less packed with code.
Spoiler
rockpushregionthingy546.PNG
This should cover atleast a part of your Problem.
Iam not sure how your Special stone behaves ingame, so iam not sure how the code for it would look like exactly. Maybe you can explain if you like this.
In the below example Rocks themself do the position check when getting pushed.
Maybe thisway your Parallel Event get less packed with code.
This should cover atleast a part of your Problem.
Iam not sure how your Special stone behaves ingame, so iam not sure how the code for it would look like exactly. Maybe you can explain if you like this.
For the "location Info for me", is that the location of the tile it will be placed on? I'm just slightly confused on that part of your edit.
Edit: Thats just a Variable i called thatway.
Edit2: In the Eventcommand Get Location Info, you need to choose a Variable which will used to contain the number of the RegionID or EventID or TileID you want to know about. That variable is than used for the conditional branches further below.

Edit3: Setting "Location Info for me" to 0, was redundant, that line could be deleted.
Sorry i made this in a hurry, mistakes slip in.

Edit4: All you have to change is the Region ID in the conditional branch and the Torch Switch. The rest is copy and paste reusable. "LocationInfoforme" Variable is also reusable between all Rock Events. So just let it alone.

Edit5: Region1 is the Tile the rock needs to be pushed on. Region 1 could be anywhere on your Map, and its easy for you to change your puzzle without editing the coordinates every time.

Edit6: If no Rocks are pushed nothing happens normaly. When rocks get pushed its just easier to include the condition codes also inside them, or let them call a common event which contains them.

Sorry wasnt sure how to answer, because i wasnt exactly sure about the question.

Edit7:
Here an example of the Paralell Event checking if player is on the Region4 for left direction torch switch to be set on or off.
Spoiler
rockpushregion756.PNG
In case u use this in comon event, than replace self switches with game switches, parallel common events dont have self switches.
If your player gets on region4 , than left torch will be lit.
If he isnt on region 4 but previously activated the torch, than the torch will go off.
but if the rock turned the torch on, the player will not turn it off when moving, thats why i made extra condition in above example.
Edit: Thats just a Variable i called thatway.
Edit2: In the Eventcommand Get Location Info, you need to choose a Variable which will used to contain the number of the RegionID or EventID or TileID you want to know about. That variable is than used for the conditional branches further below.

Edit3: Setting "Location Info for me" to 0, was redundant, that line could be deleted.
Sorry i made this in a hurry, mistakes slip in.

Edit4: All you have to change is the Region ID in the conditional branch and the Torch Switch. The rest is copy and paste reusable. "LocationInfoforme" Variable is also reusable between all Rock Events. So just let it alone.

Edit5: Region1 is the Tile the rock needs to be pushed on. Region 1 could be anywhere on your Map, and its easy for you to change your puzzle without editing the coordinates every time.

Edit6: If no Rocks are pushed nothing happens normaly. When rocks get pushed its just easier to include the condition codes also inside them, or let them call a common event which contains them.

Sorry wasnt sure how to answer, because i wasnt exactly sure about the question.

Edit7:
Here an example of the Paralell Event checking if player is on the Region4 for left direction torch switch to be set on or off.
In case u use this in comon event, than replace self switches with game switches, parallel common events dont have self switches.
If your player gets on region4 , than left torch will be lit.
If he isnt on region 4 but previously activated the torch, than the torch will go off.
but if the rock turned the torch on, the player will not turn it off when moving, thats why i made extra condition in above example.
Okay, I do like the simplification you are providing me, but I feel like I am missing something. Where Location Info = 4 in your event page, is that supposed to be replaced by the switch coordinates? Do I repeat the check for every switch?
I edited the example and added a second possible position for that rock. so it doesnt matter if Rock 1 or Rock 2 is on Position A or B.
But the details realy depend on the details of how it needs to play out in the end for the player.
For example if you only got 4 torches, i can make use of the self switches in the individual events, if you need more, than we would need to start over completly and
approach this mechanic differently. This also counts for other things, many of which iam often not aware or i simply run into them sometimes while creating stuff.
Spoiler
Code:
◆Play SE:Push (50, 100, 0)
◆Set Movement Route:This Event (Skip)
:                  :◇Turn away from Player
:                  :◇1 Step Forward
◆Wait:2 frames
◆Set Movement Route:Player (Skip, Wait)
:                  :◇1 Step Forward
◆Control Variables:#0012 MyRockMapX = Map X of This Event
◆Control Variables:#0013 MyRockMapY = Map Y of This Event
◆Control Variables:#0014 Location Info for me = 0
◆Get Location Info:Location Info for me, Region ID, ({MyRockMapX},{MyRockMapY})
◆If:Location Info for me = 1
  ◆If:Self Switch A is OFF
    ◆Control Self Switch:A = ON
    ◆Control Switches:#0006 Left Torch = ON
    ◆
  :End
  ◆
:Else
  ◆If:Self Switch A is ON
    ◆Control Self Switch:A = OFF
    ◆Control Switches:#0006 Left Torch = OFF
    ◆
  :End
  ◆
:End
◆If:Location Info for me = 2
  ◆If:Self Switch B is OFF
    ◆Control Self Switch:B = ON
    ◆Control Switches:#0007 Upper Torch = ON
    ◆
  :End
  ◆
:Else
  ◆If:Self Switch B is ON
    ◆Control Self Switch:B = OFF
    ◆Control Switches:#0007 Upper Torch = OFF
    ◆
  :End
  ◆
:End
◆If:Left Torch is ON
  ◆If:Upper Torch is ON
    ◆Control Switches:#0010 Puzzle Ends = ON
    ◆Comment:I have no clue if the rocks can still
    :       :be pushed after finishing the puzzle.
    :       :Also Mapreload through changing Maps
    :       :would also need additional Edits.
    :       :It all depends on the details...
    ◆
  :End
  ◆
:End

Edit: Question because i dont understand, what do you mean, can you elaborate in more detail?
Where Location Info = 4 in your event page, is that supposed to be replaced by the switch coordinates? Do I repeat the check for every switch?
I dont understand the first and second part, and what do you mean with checking every Switch? Or never heart of Switch Coordinates, a Switch can only be On or Off, it cant hold coordinates. I dont know what you mean with that, or at which location. Iam not native English, and i am unable to sort the context and the meaning in sentences like that. And expirience of the past showed me that if i just guess a thing, than its the wrong out of the 10 in my mind. and if i explain all 10, than its the 11th one i didnt thought of that troubles the user.
Or its so much Textwall that the helpful info drowns under Klingon sounding Text.
My apologies =).

EDIT: Forget everything, iam not a good explainer. But i had an Idea for a way shorter much easier solution. ... working on it right now...
I didnt want to delete my last Post even if its outdated now.
Here is the new Solution for pushable Rock specified for your Puzzle.
Spoiler
Code:
◆Play SE:Push (50, 100, 0)
◆Set Movement Route:This Event (Skip)
:                  :◇Turn away from Player
:                  :◇1 Step Forward
◆Wait:2 frames
◆Set Movement Route:Player (Skip, Wait)
:                  :◇1 Step Forward
◆Get Location Info:VarforEventonPosition, Event ID, (5,12)
◆If:VarforEventonPosition > 0
  ◆Control Switches:#0006 Left Torch = ON
  ◆
:Else
  ◆Control Switches:#0006 Left Torch = OFF
  ◆
:End
◆Comment:---------------------------------------------
◆Get Location Info:VarforEventonPosition, Event ID, (7,10)
◆If:VarforEventonPosition > 0
  ◆Control Switches:#0007 Upper Torch = ON
  ◆
:Else
  ◆Control Switches:#0007 Upper Torch = OFF
  ◆
:End
◆Comment:---------------------------------------------
◆If:Left Torch is ON
  ◆If:Upper Torch is ON
    ◆Control Switches:#0010 Puzzle Ends = ON
    ◆
  :End
  ◆
:End
In Get Location Info Eventcommand, we use direct coordinates.
Than we ask if any Event is on that Locations and store their ID in a Variable.
If Variable is more than 0, than an Event must be on it and we ignite a Torch.
Than we check the next position. I included 2 Positions in the example.
The code for the player would be still handlet in parallel event, but this is for the push rock mechanic. You could copy paste the rock 10 times and it would not matter which 2 rocks activate or deactivate the target position.

Since i didnt understand your question, i hope this isnt derailing to much.
I should maybe step back a little and try to pick you up where you stand.
On what would you like to focus? And can you maybe provide all the details of your puzzle?(If not no problem)
I edited the example and added a second possible position for that rock. so it doesnt matter if Rock 1 or Rock 2 is on Position A or B.
But the details realy depend on the details of how it needs to play out in the end for the player.
For example if you only got 4 torches, i can make use of the self switches in the individual events, if you need more, than we would need to start over completly and
approach this mechanic differently. This also counts for other things, many of which iam often not aware or i simply run into them sometimes while creating stuff.
Spoiler
Code:
◆Play SE:Push (50, 100, 0)
◆Set Movement Route:This Event (Skip)
:                  :◇Turn away from Player
:                  :◇1 Step Forward
◆Wait:2 frames
◆Set Movement Route:Player (Skip, Wait)
:                  :◇1 Step Forward
◆Control Variables:#0012 MyRockMapX = Map X of This Event
◆Control Variables:#0013 MyRockMapY = Map Y of This Event
◆Control Variables:#0014 Location Info for me = 0
◆Get Location Info:Location Info for me, Region ID, ({MyRockMapX},{MyRockMapY})
◆If:Location Info for me = 1
  ◆If:Self Switch A is OFF
    ◆Control Self Switch:A = ON
    ◆Control Switches:#0006 Left Torch = ON
    ◆
  :End
  ◆
:Else
  ◆If:Self Switch A is ON
    ◆Control Self Switch:A = OFF
    ◆Control Switches:#0006 Left Torch = OFF
    ◆
  :End
  ◆
:End
◆If:Location Info for me = 2
  ◆If:Self Switch B is OFF
    ◆Control Self Switch:B = ON
    ◆Control Switches:#0007 Upper Torch = ON
    ◆
  :End
  ◆
:Else
  ◆If:Self Switch B is ON
    ◆Control Self Switch:B = OFF
    ◆Control Switches:#0007 Upper Torch = OFF
    ◆
  :End
  ◆
:End
◆If:Left Torch is ON
  ◆If:Upper Torch is ON
    ◆Control Switches:#0010 Puzzle Ends = ON
    ◆Comment:I have no clue if the rocks can still
    :       :be pushed after finishing the puzzle.
    :       :Also Mapreload through changing Maps
    :       :would also need additional Edits.
    :       :It all depends on the details...
    ◆
  :End
  ◆
:End

Edit: Question because i dont understand, what do you mean, can you elaborate in more detail?
I dont understand the first and second part, and what do you mean with checking every Switch? Or never heart of Switch Coordinates, a Switch can only be On or Off, it cant hold coordinates. I dont know what you mean with that, or at which location. Iam not native English, and i am unable to sort the context and the meaning in sentences like that. And expirience of the past showed me that if i just guess a thing, than its the wrong out of the 10 in my mind. and if i explain all 10, than its the 11th one i didnt thought of that troubles the user.
Or its so much Textwall that the helpful info drowns under Klingon sounding Text.
My apologies =).

EDIT: Forget everything, iam not a good explainer. But i had an Idea for a way shorter much easier solution. ... working on it right now...
Switch was probably the wrong word to use. I was referring to the tile the boulder had to be on, which acts like a button of sorts to turn the torch on. Basically, all the puzzle requires is having 3 boulders on the 3 torch tiles, and a fourth, invisible boulder on the black torch. That one I already have figured out. So what I need is the three boulders all having the same effect, regardless on which of the 3 tiles they are placed on. I could simplify the puzzle by making them specific to a tile, but I would rather it be indiscriminate. I am currently at work, but if you need any additional information I can provide it when I get the chance, and I will look at your newest solution as soon as I get home tonight.

EDIT: so after reading your second post, you’re saying that there is no event on the tiles that act as buttons? If that’s the case, that’s why I was confused. I’ve had parallel events on them. I’ll try it with the checks only within the boulder events and see what happens.

EDIT 2: Thank you,@Bex, I finally got it to work. For some reason, the location info would not light the torches when immediately pushed onto the tiles, so instead I opted for a parallel event to check anyway. It works perfectly when run outside of the boulders. Thank you for your help. My struggle was mainly from my lack of understanding of the Get Location Info command. Your many suggestions were very useful.
Edit: Good to hear that it works, but i ran into so many errors after every corner,
are you sure your puzzle is complete? Else take a look the the demo example game in the downloadlink, it might safe you some headaches.

LOL i was very tired that i didnt got the Word Switches = Boulder Target Position Plate/Switch. =)

This was like a Challenge not an easy task in the End... i feel like a young Battle Hungry Soldier going into war with too much confidence and coming back traumatized from the Battlefield.
I have a Working Demo for you. It works but its not documented and not simplified in any Way, it just works and does what its supposed to do.
Also it seems not flexible, its real specific.
But the cool thing is if you have Boulders on the correct positions, than those stay there even when you change the map. boulders not on target switch position will resett to there initial map position.
Its also too much Events and structures, so it would cost too much time posting pictures.
It surly can be build easier, but atleast we have a working prototype seemingly without bugs. The Switches are spread up a bit strangely but thats because of different approaches.
I packed the Demo as a Zip File:
https://www.file-upload.net/download-13660224/puzzlehelpsmaldemo.zip.html
Edit2: And its made without permanent parallel Event. No Script Calls. No Plugins.
9 Switches and 3 Variables used (I forgot to delete a 4th unused one) and 19 Events needed minimum.
Edit3: I just tested it once and posted it quick. There is room for improvement, sorry iam a little lazy and much other stuff going on.

Edit4: A New Day =)
I rewatched the whole mechanic and saw potential to drastically simplify it. without working prototype this wasnt possible. now it is. if you are interested and if you like the old demo, i could give it a shot and rework it. If its realy allready working on your end,
than let me also know.
Edit: Good to hear that it works, but i ran into so many errors after every corner,
are you sure your puzzle is complete? Else take a look the the demo example game in the downloadlink, it might safe you some headaches.

LOL i was very tired that i didnt got the Word Switches = Boulder Target Position Plate/Switch. =)

This was like a Challenge not an easy task in the End... i feel like a young Battle Hungry Soldier going into war with too much confidence and coming back traumatized from the Battlefield.
I have a Working Demo for you. It works but its not documented and not simplified in any Way, it just works and does what its supposed to do.
Also it seems not flexible, its real specific.
But the cool thing is if you have Boulders on the correct positions, than those stay there even when you change the map. boulders not on target switch position will resett to there initial map position.
Its also too much Events and structures, so it would cost too much time posting pictures.
It surly can be build easier, but atleast we have a working prototype seemingly without bugs. The Switches are spread up a bit strangely but thats because of different approaches.
I packed the Demo as a Zip File:
https://www.file-upload.net/download-13660224/puzzlehelpsmaldemo.zip.html
Edit2: And its made without permanent parallel Event. No Script Calls. No Plugins.
9 Switches and 3 Variables used (I forgot to delete a 4th unused one) and 19 Events needed minimum.
Edit3: I just tested it once and posted it quick. There is room for improvement, sorry iam a little lazy and much other stuff going on.

Edit4: A New Day =)
I rewatched the whole mechanic and saw potential to drastically simplify it. without working prototype this wasnt possible. now it is. if you are interested and if you like the old demo, i could give it a shot and rework it. If its realy allready working on your end,
than let me also know.
You're right, those boulder events are a lot cleaner than the parallel event I was using. I opted to scrap the player turning on the torches for just the boulders activating the event. I still got a headache trying to figure this all out but... your help was immeasurably useful and it saved me from a migraine. So thank you!

Original thread: https://forums.rpgmakerweb.com/threads/conditional-event-simplification-event-coordinates-interfering-with-each-other.110850/