About if statement

Hi,guys

I have two light and one door in my project. I hope that if I turn on light A and then turn on light B ,

I can open the door. If I turn on B first and then turn on light A , it will be false .

But when I execute the game , it is not follow the sequence I want . B->A should be false .

This is my BP

Thanks guys ~

I will assume that the lights are different classes. Otherwise your use of get all actors of class will fail.

Having two unique references to light A and light B you can do this:

if A.isOn then if B.isOn then do.

All you have to do is to call the function you have there only in the LAST light to be activated, i.e. B.

Hi~ De

I am not understand what you mean in last two sentence @@"

Can you give me a example or more detail ~~

thank you so much ><

or you can use an “AND” node for your boolean, so when both are true it returns true, and then trigger your branch

Hi expose ~

But I need the sequence that A should be done first ~

Use an and node like the guy below me said and then make sure that the only one who performs the check is the last light. In what class is the code you showed us?

I would include 2 booleans in the lights. An “On” and a “TurnedOnFirst” variable. When a light is turned on, check to see if the other light is turned on, if the other light is off also turn on the “TurnedOnFirst” variable. Then just check to see if LightA “On” and “TurnedOnFirst” are true. Just make sure to turn both variables off when you turn off the light.