How to trigger an event with multiple switches pressed?

Hey guys,

I am relatively new to UE4 and am trying to create a blueprint script that will trigger a matinee event (in this case a door opening), when three separate switches have been pressed. I have created a blueprint that will trigger the door opening when any one of the three switches has been pressed but cannot figure out how to make it so that the door only opens when every switch has been pressed. Any help with this would be greatly appreciated as I have been unable to find any tutorials for this type of blueprint.

I would not use a level blueprint for this. I’m away from PC but here’s the concept:

  1. Add a variable to your Door blueprint of Matinee reference type. Make it editable. Call it DoorMatinee.
  2. Add a variable to your Door blueprint of Actor references array type. Editable as well. Call it AllSwitches.
  3. Add a variable to your Door blueprint of Boolean type. Call it bAllSwitchesAreOn, set true by default.
  4. Add a variable to your Door blueprint of Boolean type. Call it bIsOpen, set false by default.
  5. In Switch blueprint, onBeginOverlap call Enable Input and add PlayerController.
  6. In Switch blueprint, onEndOverlap call Disable Input and add PlayerController.
  7. Add a variable to your Switch blueprint of boolean type. Call it bIsOn. false by default.
  8. Use ‘E’ (or any other key) and adda flip-flop drag a pin from flip-flop boolean and SET your bIsON; (this is basic toggle functionality)
  9. In Door blueprint, on even tick, do a ForLoop on AllSwitches, cast each array item to Switch blueprint then GET the value of bIsON, use a Branch and on False, assign bAllSwitchesAreOn to false.
  10. Drag a pin from Completed(from for loop) and use branch, for condition use bAllSwitchesAreOn . If True - add another branch and condition to bIsOpen . If False - Play your matinee. then SET bIsOpen to true;
  11. Place your door on your level. Click on it, and in property assign Matinee and Switches , to appropriate actors in your level.

Hopefully you can put this to blueprints. Cheers.