Create a key to open a door

I’d like to make a key located in one part of my map, that I can pick up. This key will then be used to interact with a door and allow it to be opened. I tried looking around to see if I could figure out how to do this, but haven’t had any luck.

I would do it with a blueprint for the key with the key and a box around. Then use the box to create a “In-touch with and pressing E”. That would a bool that says if you have the key or not. Then destroy that actor so no other player can get it. The best would be if you could pass the bool to you pawn so you have it at all times. Then pass it from there to the blueprint for the door.

Create the door with a “lock-function” so that the door can only open if a bool is used as the look so you can only play the door anim if you have unlocked the door. If you have passed the variable from your pawn to this blueprint you should be able to use it for locking/unlocking the door.

Sry for the short answer, don’t really have the time right now to give you a real tut on it. But check the youtube tutorials and it will help you a great deal! Just wanted to give you an idea on how you could do it :slight_smile:

Happy Blueprinting! :slight_smile:

  • Oscar Hvarfvén

Howdy!

You can also check out the Content Examples and the Level Scripting Map. Section 1.3 deals with what you are after (sort of) and should give you an idea. Granted it’s collect all of X coins to open the door, but using that along with some of the other examples as reference, you should be able to piece something together.

Also, Oscar gives a great example as well!

-W

That is probably a better solution to look at if you want to learn. Mine was just an idea more than help on solving it for someone kinda new to blueprints (As I guess the person asking might be?) :slight_smile:

This tutorial cover all you need to open doors with keycard :

UE4 Tutorial | Use Keycard to Unlock Door