Activate multiple switches to trigger door/light etc

Hey folks,

Really sorry if this is another question on ‘how to do something’, but I’m pretty much stumped on how to go about this one. The idea was to have two pillars (eample) with a switch on each, the player would need to activate one…play animation (cog turn,lever down example), run to the next switch and repeat, the door or light for example would then open/turn on.
Ive tried a few methods to do this but each time the animations play together from just the one switch and the door opens, or the door opens just entering the trigger box :roll eyes:, you get the idea haha.

Has anyone done something similar to this? theres a lot of info on opening one door via a trigger box etc but, I cant seem to find the best way to do it so the player has to activate two switches before something happens :confused:?
I’m asuming this is based on a boolean type of setup? is it best to use a Matinee for the animation or using the Blurprint to set the door rotation for the animations in this case

Sorry if this is a newbiee question haha, i’m failry new to the UE4 and this is slightly more advanced than what i’ve done thus far. Thanks for any help on this one :cool:

doesnt matter, forums are made for answering questions. but i think you want to look into something like an AND gate. or maybe create a Boolean value to see if one of the levers is down, and another Boolean for the other. then check if both Booleans are 1 (down) and then go on and open the gate. you could use branches to check the boolean value and put them after each other. it will work because even if the second lever gets pulled first then you will still have to pull the other one. then it will first check the first and then the second. so the order in which they are checked doesnt matter, they both need to be true and then it will open (or at least continue executing the BP)

Been playing around by trying to piece info that is already out there to get one door open via a switch which ive done a few different ways that work. One Blueprint for the door animation, anothe for the switch. I thought I had it figured but I think the way I set it up the engine was getting confused and the door wouldnt open on the first button press. I was running in/out/jumping in the trigger volume while continuesly pressing my gamepad button and it would eventually play the door animation (I think overlapping trigger volumes might have been the problem here??) but obviouslly not ideal.

I’ll throw up some screen shots of my current Blueprint setup (might be easier to that way) to see where i’m going wrong or in the right direction. Would I need to setup x2 separate switch Blueprints and then the Door or have x1 Blueprint for both switches so I can include the ‘AND’?

Thanks for taking the time to reply.

@Guyverzero - I use variables to do this inside your player character. Base the action of the items that ‘move’ to a Branch and get the Boolian value of the switch. IE: Does “firstswitchvariable” = 1. If not nothing happens. When you flip the 1st switch, set the firstswitchvariable to 1. Then the action will happen, but the second action wont because it too is waiting for secondswitchvariable to be =1. Until it is, it wont do anything. When the player character goes over to switch 2 and flips it, set the second variable to 1 (or positive), and the 2nd action should take place. Within the Branch, if you get a false, it does nothing. This is how locked doors and drawers know that you have the right key usually, when you pick up the key, the drawer variable becomes positive, so when you click on the drawer, it checks the variable, and either opens or does not.

Hope that helps in theory.

Jerry



Play_Door_Opening.jpg

This what I have so far, so the player can walk into each trigger separate and press D-Pad (Down) to play the cog (the switch) animation. I also setup the animation to play the doors opening, now the problem is tying them together to only play the animation when both switches are checked. Its probably something simple i’m totally overthinking but so far still a bit stumped.

I had a very similar question literally a week ago and James94Hodges provided a video with a good solution for setting up the basics. The only downside to this method is that you need to recompile the door master blueprint if you modify the switch master blueprint, but other than that it is perfect and has a simple workflow for building new switch reactive objects.

The end result is you add to your world the master door blueprint, add however many switch blueprints you need, select each switch in the door’s array field and bam, you have a working door with switches.

Thanks for pointing me to this video :), stumbled on one small section but managed to put something in place to fix it. There is a section where the ‘SET’ Owning Door should be linked to Self, only mine didn’t work as the video. To work around it I used ‘Make Array’ then attached the ‘SELF’ node to that. Not sure if its a solid/good thing to use but it seem to have worked for me just incase anyone gets stuck on that part to.

Im hoping I can use the Matinees I have built in place of the TimeLine, I’ll have to play around some more switching out Nodes and see what comes out of it.