Difficult performing multiple conditional branches

Okay so, I have an event running on a parallel process so that when the player is over a certain region they get environmental damage. I wanted to add conditionals so that if they're wearing certain type of armor or used a certain elixir, then they'll be immune.

I've managed to successfully set a conditional branch so it will check if the armor is in the inventory or equipped and it won't do the damage if it is, however I can't seem to stack another conditional where if they don't have the armor but they DO have the elixir they won't get damage.

I created an item for the elixir and a new state [protection], I set the state rate to [protection] * 100%. I've tried everything, different switches on and off, I tried multiple event pages, I tried stacking conditional branches (which I thought would be the simple solution, like if armor is on = no damage, else , check for [state] and if [state] is on then no damage else damage, but that sure didn't work.) I even tried making another, separate, event on a parallel process for the elixir and that didn't work either.

Is this something that's possible? What am I missing here?

I appreciate any help! Thank you!!
make a simple table detailing the outcome... like:
Code:
armor | elixir | states | result
  x        x       +        x
  x        +       x        +
  x        +       +        +
  +        x       x        +
etc

with that, you can make a single conditional using a script call.
you only need to validate for positive.
make a simple table detailing the outcome... like:
Code:
armor | elixir | states | result
  x        x       +        x
  x        +       x        +
  x        +       +        +
  +        x       x        +
etc

with that, you can make a single conditional using a script call.
you only need to validate for positive.
I don't quite understand this, I think that's what I'm trying to do? I tried setting a conditional for the damage being ON or OFF depending on that results and put the damage conditional on its on event page so that it would only run if it was ON but it still wasn't working.
but *what* is the combination of conditions that triggers the damage?
do you have one? can you dispense of the code and write everything as a table?
but *what* is the combination of conditions that triggers the damage?
do you have one? can you dispense of the code and write everything as a table?
I don't know that it's a combination so much as either/or.
Like you have the armor item on, then no damage.
Or you take the potion and have the [state] on and then no damage.
Doing armor & potion at the same time wont like, increase the immunity it'd just be a waste of a potion.

I don't know how to implement a table, how does that work? I haven't seen that mentioned before.
I don't know how to implement a table
write down the variables at play, and the result of each combination?
like, on a piece of paper?
I'm trying to get you to understand the condition outside of the code.
write down the variables at play, and the result of each combination?
like, on a piece of paper?
I'm trying to get you to understand the condition outside of the code.
Oh, I thought you were saying there was a table aspect to the rpg maker events.

I understand the combinations and conditions outside of the code. I just can’t get the code to work.
I just can’t get the code to work.
why?
if you have the condition figured out, just write that as a script call, don't use nested conditions.
I just can’t get the code to work.
that means that you have set the commands wrong in the event, most likely by ignoring the effects of indention and nested conditional branches.
the only way we can help you there is if you show us screenshots of your events so we can see what errors you made, because as the poster above said what you want is a basic logic structure that should be very easy to implement as long as you take care of which command is placed where and in which order.
why?
if you have the condition figured out, just write that as a script call, don't use nested conditions.
I'm very new to rpg maker, I don't know how to write a script call. What would it look like?

I would click the 'advanced' button on the event page and put it in there, right?

that means that you have set the commands wrong in the event, most likely by ignoring the effects of indention and nested conditional branches.
the only way we can help you there is if you show us screenshots of your events so we can see what errors you made, because as the poster above said what you want is a basic logic structure that should be very easy to implement as long as you take care of which command is placed where and in which order.
This is what I have and it got the poncho item to work, no damage inflicted when the poncho is on. And if they unequip it then damage is done.
Spoiler
poncho one.png
Spoiler
poncho two.png

When it comes to getting it to check for a second condition, I've tried everything I could think of. I tried putting under else another conditional branch so that it would check for the item and if the item was present then no damage, and else no item then damage. I tried adding exit event processing after those branches too but it still wouldn't process it.

I even tried putting a switch under the else statement. so like If else then [switch on] and then set another event page that would active if that switch was on, and put the conditional branch to check for the item on THAT page, and that didn't work either.

There's something I'm missing and I'm not sure what it is.
When it comes to getting it to check for a second condition, I've tried everything I could think of.
and that is what I wanted to see - where the error is and not what you got working right.

besides even the event above is not correct - because there is no way to get back from the second page after it has been activated. If the actor dons the correct equipment after triggering the first damage, the equipment would still be ignored and damage continue.

everything in such parallel processes needs to be on a single event page, because only one page will be active and the check on the first page will never happen again after the second page is triggered that way.
use a common event as parallel process, not a map event.

on the common event, check for both conditions:

nuevo-1.jpg


- if item is equipped?, set variable a
- if state is inflicted?, set variable b
- if either a or b == 1? perform effect
and that is what I wanted to see - where the error is and not what you got working right.

besides even the event above is not correct - because there is no way to get back from the second page after it has been activated. If the actor dons the correct equipment after triggering the first damage, the equipment would still be ignored and damage continue.

everything in such parallel processes needs to be on a single event page, because only one page will be active and the check on the first page will never happen again after the second page is triggered that way.
Oh! I used to have it all one one event page but I split it up in the process of trying to get everything to work. Now I'm no longer sure how to put it all together to get it on one event page again...

As for one of the failed attempts, it was basically something like this (which now I know it being split on two pages isn't good) but I wasn't sure if you could even stack conditional branches like this?

Spoiler
poncho three.png

use a common event as parallel process, not a map event.
I'm not sure what you mean here. It is running as a parallel process?

on the common event, check for both conditions:

View attachment 194674

- if item is equipped?, set variable a
- if state is inflicted?, set variable b
- if either a or b == 1? perform effect

Ooohhhh! I'd wondered if there was a way to do it utilizing variables but I wasn't sure!
Does the || between $game_variables tell it to check either/or?
as I guessed.
you have to take care where and when to place commands, especially the indentions.
If you place something in the else-branch, that means it will only be checked if the first condition is wrong.

that said, the above event would work correctly - aside from the fact that once damage is ON, it will never return to this page to check if the conditions changed.

Try to make the event into one page and then report when you have a problem - we can't help with events that work perfectly.
Does the || between $game_variables tell it to check either/or?
yes, that's a logical OR.
it can also be done pulling the values directly from the objects, through the script call, but it's a longer instruction, and probably messier.
as I guessed.
you have to take care where and when to place commands, especially the indentions.
If you place something in the else-branch, that means it will only be checked if the first condition is wrong.

that said, the above event would work correctly - aside from the fact that once damage is ON, it will never return to this page to check if the conditions changed.

Try to make the event into one page and then report when you have a problem - we can't help with events that work perfectly.
Yes, I understand it will only check it if the first condition is wrong. That's what I want it to do and is why I put it there.

I'll try putting everything on one page and see if that helps.

yes, that's a logical OR.
it can also be done pulling the values directly from the objects, through the script call, but it's a longer instruction, and probably messier.
I see, thank you! I'll try both this method and Andar's suggestion!
Okay I edited the conditional branches and got them all on one page (I didn't realize you could stack conditional branches in that many layers which is why I thought it had to be on a separate event page).

It seems to be working now! I tested putting on and removing the equipment and it did run the check again and stop doing the damage. Here's a screenshot of what it looks like, am I missing anything to make it more clean or is this about right?

Spoiler
poncho four.png
while you are protected, the parallel process runs sixty times per second - that creates lag that is not neccessary.
I would add a wait(5) or so to the currently empty branches for being protected.
Like this?
Spoiler
poncho five.png
use a common event as parallel process, not a map event.

on the common event, check for both conditions:

View attachment 194676

- if item is equipped?, set variable a
- if state is inflicted?, set variable b
- if either a or b == 1? perform effect

Ok I tried it but I think I did something wrong
Spoiler
poncho six.png
Spoiler
poncho seven.png

And I get this error when I go to test it
Spoiler
poncho eight.png

Original thread: https://forums.rpgmakerweb.com/threads/difficult-performing-multiple-conditional-branches.138250/