Need Help Making Simple Key And Locked Door Blueprint

I don’t know if this is the right place to ask this question but I need help with this blueprint to unlock a door with a key. As shown below I have the blueprint of the key to where when you collide with it, it will destroy the key and set “has key” to true. What I want to do is make it so it’s the same thing but instead, you press E to pick up the key and when you pick it up it says “picked up key”. So basically how do I recreate this blueprint I have but make it only pick up if you press E.
Now for the door. The blueprint I have is when you enter the trigger and press E it opens/ closes how do I make a blueprint where when you start it is locked “when you press E on it, it says Locked” when you pick up the key and “has key” variable is set to true it will open the door then.
Yes, I know there are tutorials and other posts on this but none of them helped me. And I am new to blueprints so If you just type an answer I won’t understand it so could you send a screenshot of what the blueprint should look like?

Hi there,

For picking up the key, I would check for an overlap with the key in your player character blueprint, and then when you press E you can check to make sure your character is overlapping the key. If the character is overlapping the key, change the boolean HasKey to True.

Now for the door, for the actual opening / closing of the door, just add a branch from the BeginOverlap node which checks the HasKey boolean from your player character blueprint. To display a message on screen, you will need to use a UMG Widget.

The above is very high level, but should set you on the right path.

Any problems, let me know.

You need to use an interface that allows interactions between the character blueprint and the key as well as the character blueprint and the door actor blueprint. This is how I would handle it because it will greatly simplify your whole process and you can also use this same interaction handler for communicating interactions across any blueprints that implement the interface. You can also do some additional checking to ensure you have exactly the right "targets/object/actor whatever it is you are attempting to interact with.

I am going to link to the video I watched that to me best explained the process. If you don’t understand this one then I suggest searching for “blueprint interface” on youtube as there are many examples found with that search term. Once you understand this you can really do a lot more with a lot less time and headaches involved.

For the text to be displayed I would almost suggest using a very basic text widget that is static in position on the screen. If you want to do floating text that appears over the character it gets much much more involved. By adding a simple pop up text widget you can just pop the text on screen and fade it out after an arbitrary amount of time that suits your needs. I think this would be the easiest approach for anyone new to this. Once you get a little more experience you can expand on the idea and try out floating overhead text.

Just remember that text is easiest to read as a player when it has an kind of outline on it no matter if the outline is like one pixel thick. This will make the text stand right out no matter what is going on behind it :slight_smile: