Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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. alt text

Product Version: UE 4.8
more ▼

asked Apr 13 '16 at 12:19 PM in Blueprint Scripting

avatar image

1 1 3 3

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

more ▼

answered Apr 13 '16 at 01:49 PM

avatar image

383 10 7 19

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question