Spatial inventory system, I don't want to pick up items automatically but rather by pressing the "E Key"

Hi, could anyone help me with this tutorial? Something simple, but as I’m a beginner I can’t do it, in this part of the tutorial it teaches you how to pick up objects at the same time as placing an inventory grid, but it picks up the objects automatically.
What I want is to get the items by pressing the “E key”. Just that, if you could send me prints I would be grateful :slight_smile:

Video tutorial i have followed

On ‘E Key’ do some sort of trace, lets say a sphere trace around the actor, if it detects any “item’s” call an event to add them to the inventory

@Auran131 This is the code that is currently running, but the character picks up the item automatically

I also have the item’s sphere, in this image only the sphere appears because it is the parent blueprint and the meshes only appear in the children, so that said, what would be the event to call the item? and how do I remove it from the automatic?

so basically you want to move everything from overlap begin/end to custom events Pickup/Drop and then call those custom events when you want, which in this case is the ‘E’ key.

but remember to do the sphere trace to confirm you’re in range and which item to get

So from what I understand, was this supposed to be done? If yes, ok now how do I track the sphere you say?

there is a spheretrace node, center it on the character and if your collision is correct it’ll return all items in the area. from there you can call functions on those items like tryadditem

This should work for you, assuming this code is run on your player character/pawn.
You don’t need both the [Input Action Interact] and the [E Key] events, I just had them both as an example.

Likewise I highlighted the Object Type on a component of this actor to show what you want to look for on the Items you’re picking up.

2 Likes

I did it, I made an interaction interface system with some things and added the “event on interact” instead of overlap and it worked normally as I expected
thanks

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.