Download

Button combination triggers event

Hello!
I’m sure this is very basic but I can’t get to make it work.
I have four buttons in my level, and if they are pushed in the right order (say 1st, then 2nd, 3rd, and 1st back again), an event is triggered. In my case, a door opens.

I’m not sure how to build this little program. For now, I am trying to do it like this:
Button 1 triggered > bool 1 On for five seconds
If Button 2 triggered and bool 1 On > Bool 2 On for five seconds
If button 3 triggered and bool 2 On > Bool 3 On for five seconds
If button 1 triggered and bool 3 On > bool 4 On
If bool 4 On > door opens

But this isn’t working, and I’m sure there is a better way to do this.
Anyone has an idea, please?
Thank you!

I would create an array of int.

every time you push a button you call an event that shift all value in the array… .so
use a loop to copy the 4° value on the 5° … the 3° on the 4° … 2° on 3° … 1° on 2° … 0° on 1°
and now set the 0 to the button you pressed. (This will create a list of button pressed )

Check if this is the combination you need to open the door , If yes Call a custom event for open the door …
IF not
Now reset a timer of 5 sec https://docs.unrealengine.com/en-US/Gameplay/HowTo/UseTimers/Blueprints/index.html
if the timer reach 0, set all the array to 0 0 0 0 0

Your player have 5 second for hit every button, if he press them in the right order , the door open.
If he take more than 5 sec , the combo is reset, and if he push wrong buttons, the door dont open

This sounds like a much better way to do this indeed, thank you very much! I greatly appreciate the help!