Boolean operators not working?

I’m using an AND operator to check if BOTH of my variables are set to true in a branch node, then if true it will execute my code. But for some reason the code executes when only one of the variables is true, NOT both. Is it a bug or have I made an error?

code below

Simply what I’m trying to do is I have 2 trigger boxes, after they both have been triggered, I want to execute code to go to the next level.

I am a beginner so I’m sorry I don’t really understand how to use this node correctly just yet.

Thank you for any replies

you dont show where the branch execution comes from…
are you sure the branch is executed?..the wire goes off screen.

Hi sorry, it just connects to begin play, i tried connecting it to different places but the outcomes the same

begin play only runs ONCE at the beginning…thats why its called like that
I dont know your code but connect to event tick instead so it will be run on every frame.

when i connected it to event tick, it will just execute the code after the branch, not even paying attention to the conditions needed to execute it, so therefore I don’t actually know what to connect the execute to

Hi @str4w_b3rrieZ,

Just having a quick look. I might be wrong so someone please correct me.

I think it would be better to use the values of each of the Booleans (Overlap, Overlap 2) rather than the return node. Essentially, you are getting the return values of those nodes which are both set to true but not the values of the Booleans you are wanting to change based on those conditions.

1 Like

same outcome, unfortunately

sorry also: the default values are set to true when I hooked them up to the AND gate, I’ll keep them like this as it makes sense to?

if anyone has any ideas what to connect branch execute to that would be great

The events you have that set the booleans will store TRUE to those booleans when they trigger at any time.

in event tick you can read those booleans and will keep the current value like this:

event 1 triggeres → sets bool1 to true
event 2 triggers -->sets bool2 to true

event tick (runs all the time) evaluates current value of bool1 and two and if true does something.

also you dont have to wire the branch conditions from the SET in the events you can GET the booleans from the variables list in the left side of the screen.

1 Like

Thank you for the reply, I tried this in a post above that someone else commented, you can check it out but it still doesn’t work, it continues to ignore the conditions that both need to be set, and just executes the code after branch straight away.

Hello quick update: your post really helped, thank you for letting me know about event tick, the main problem was I had to set the default values to = NOT true, instead of true, also when connecting it to the AND operator.

Thank you for your help, it worked out!

1 Like

glad to help

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.