Connecting a Keypad to unlock a door
Hi, so I am currently making a level in UE4 (4.8.3) and have added in a asset for a Keypad (bought on the Marketplace)and of course a door w/ its own animation (from another free content pack, Shooter Level )
Now I'm struggling to connect these together so that the door will only open when the right key code is entered and access is granted, where and how do I do this?
At the moment I can enter the right keycode and it displays that it is correct/incorrect, but the door still opens when I approach it no matter what(due to its own trigger box, there no collision with the door either, but that's a later issue)
asked Feb 25 '16 at 10:27 PM in Blueprint Scripting
I'm assuming that you have it set up so that when the player overlaps the trigger box for the door, it opens. If this is the case, you could do this with the use of a boolean variable.
First, create the boolean variable inside of the door's blueprint and set the "Editable" setting on it to true. Make the default value of the boolean False.
Next, open the blueprint for your Keypad, return to the level editor and select the instance of your door in the level. After it is selected, go back into the blueprint for the keypad and right-click in the Event graph. It'll give you the option to get a reference to that door instance from the level.
After this, go to the logic where you have the keypad's sequence set up and on the part where the sequence is correct, have it also set that boolean to True. You can do this by dragging off of the Door reference and making a "Set booleannamehere" node.
Lastly, go back to your Door's blueprint and add a branch between the overlap event and the logic to open the door that checks the value of the boolean. If it is set to true, open the door. If it's set to false, do nothing.
Hope this helps!
answered Feb 25 '16 at 10:57 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here