How do I open a door with multiple switches?

Hi, I have a door in my level which the player needs to open, but to do so there are 8 switches lined up against a wall nearby, and only 4 specific ones need to be activated to open the door.

What needs to be done is some sort of blueprint script which recognizes when the 4 that need to be activated have been, and the 4 that shouldn’t be activated haven’t been.

All I’ve got right now is the matinee of the door opening and 8 switches which have point lights that toggle on or off when the user presses ‘F’ near them, I’m not really sure where I can go from here.

Any help would be appreciated, thanks in advance!

One idea could be setting up booleans. The four that need to be activated to true conditions and the four that need to be off to false that then activate the matinée.

So you want a combination lock? Just have a bool check on the door for the 4 that open it, or have the switches add 1 or reduce 1 to a door variable and when the doors number hits “4” it opens.

Thanks for the answers, but how would you do this in blueprints? I’ve never done bools before and can’t seem to find anything similar online

ill make a mock up here in a min. You will need to adjust it to fit your BP setup.

ok darnit well unreal isnt opening for me atm. So ill point you in the right direction. On youtube Unreal engine has a tutorial on opening a door with blueprint. I’d copy that example and make references to all 8 switches. a bool is a true or false condition. True means on and false means off. so arrange the bools in order that when the correct switches are true and the wrong switches are false it executes your matinee on the door. Hope that helps sorry i cant get you a picture to help visualize.

Hey thanks I was able to make it work, using 8 bools connected to an “and” node which triggered the door to open once they’re all true, the only issue was I wasn’t able to make it that it only opens when 4 are true and 4 are false, which I am still trying to figure out.

Hello IbyGTR,

I made quick example that will get you pointed in the correct direction. I hope that this information helps.


In this picture I have created a new actor blueprint named switch and I have added two boolean variables to it. As you can see I have exposed them on spawn. This will allow you to add the switches to the level and choose which ones you would like to be needed.

Here is an example of setting the “Needed” variable for one of the switches. I did this by selecting one of the switch actors that I placed in the level.

This is a screen shot of the Door blueprint. In this blueprint I have used the get all actors of class node to find all of the switch actors in the level and I have checked to see if they are needed. If they are needed I set the “needed count” variable up by one so that I will have an accurate count of the number of needed switches. From there I check to see if the actor’s “on off?” variable is true and if it is I set the “Current Count” variable up by one. This means that if the “Needed count” ever equals the “Current Count” that all of the needed switches have been turned on.

Make it a great day