How can I use the "E" Key for opening doors AND pick up Items?

So my question is like written above.

I already made an IA Interact with an E key. I also got it to work to open and closing Doors. Now I wanted to make my inventory system and followed every step from the Tutorial of Ryan Laley from his Inventory System Tutorial. I’m now by Part 13 from his Tutorial.

But now I have the Problem that the “E” Key is only working for picking up Items but not anymore for opening / closing doors. I also tried to ask ChatGPT but he is talking non-sense and wants me to rebuild like everything from that what I’ve done so far so he is definitely no solution. I’m pretty new to all this developing stuff and started to learn the UE with ChatGPT.

I’m working on UE 5.7 and only with Blueprints. I can also post some Screenshots of my FirstPersonCharacter BP and my Inventory System and all that stuff if it would be helpful. But I’d really appreciate some help for how I can make it work to open/close doors AND picking up Items with the “E” Key since I need the Input Key for several things like also for interacting with NPC’s and so on.

Can you show the piece of code for E, both in a door and a pickup?

Hey buddy,

You can check the thread below, where I used to have am issue with the door opening and o fi ally solved it, it contains a big part of my code that you can use and help yourself.

Hey there @McTeppichTV! I would recommend learning about Blueprint Interfaces. They are the most effective way to cleanly manage contextual interactions like this.

This post from Clockwork sums up the resources I usually recommend plus one more that combines both:

Disclaimer: One or more of these links are unaffiliated with Epic Games. Epic Games is not liable for anything that may occur outside of this Unreal Engine domain. Please exercise your best judgment when following links outside of the forums.

Yeah sure.

So this is my “E” Input Code for the Doors or the general “E” Interact Code. If the InputAction Interact is connected then the doors are working

This is my “E” Event Interact for the Pickup. If the “Event Interact” is connected then the Pickup system doesn’t work. Only if I connect the “InputAction Interact” but then the doors aren’t working anymore.

I’ll check it out, thank you

I’ll check this out too, thanks

This is a fully code of an interactive Door. Idk if u meant this with showing the “E” Interaction Door Code. Maybe it’ll help too.

Where is this code? Inside the pickup?

Yes that’s the one for Pickup / Inventory System

If you put a print string here

Does it fire?

Are you writing a multiplayer game?

It only fires when I connect the “InputAction Interact” from the pin “pressed” with the Exc. from “Get”. While “Event Interact” is connected it doesn’t fire.

Actually I’m writing a SP Game but I didn’t found any good tutorials for an SP Inventory System. The most Tutorials are just showing very simple Inventory Systems or the Videos are like 2h on Yt. So I just built it like Ryan Laley showed it in his Tutorials. Idk if it somehow impacts the whole Coding and writing when I make a Inventory System for the MP but actually doing a SP game.

Ok, then you’re not actually sending the interact message to the object.

I don’t know how, but if the event doesn’t fire, it’s just not getting the message.

In your player code, put a print of the actor name here

then you can check it’s picking the correct actor.

It’s picking the correct actor. My problem is just that I can’t interact with them. I made a few tests earlier with ChatGPT and the problem was that it doesn’t recognize my Inventory System. It’s recognize the Actors and all that stuff but not my Inventory System.

This below is my build for the Flashlight that the player should be able to pickup.

I don’t think you can do a ‘get component by class’ on the player character? Not sure without testing it, but I think only your player type has that component.

You can check ( with a print of course ), if it finds that component.

If not, you either need to cast to your player type, or use an interface to get a reference to the component.

Is that a generic player character parameter, or already your player type?

It finds the Component. It is a generic player character. The standard one from the First Person Level from UE. I didn’t made my own one yet if it is that what you mean.

I also tried to cast it with “Get player character” and connect the “Get Player Character” node with “Get Component by Class” and still the same result.

Ok, my bad, if it finds the component, cool…

But I see in the next node you have an ‘inventory system’ variable, when did that get set from the component you read?

I mean A is the system, but suddenly you’re using B without setting anything?

Ohhhh yeah okay I see. That makes ofc sense lol…

I now added the Set and now it’s working. Such a simple solution omg. I really was struggling with this like for 2 Days… Now I can pickup the Flashlight and it goes into the Inventory AND I can open / close the doors. Omg I really thank you and appreciate your help and your patience. Really, thank you.

Ha! :star_struck: