Hi everyone, I’m having some trouble with my inventory. I’m trying to make one where items add as soon as you collide with them. However, it seems everyone is doing their inventory with an interact interface, or on a key press. I feel like I’ve watched every tutorial and no one talks about how to do the pickup style I’m looking for. I’ve also tried my hand at watching a standard tutorial and just changing it to what I need but it seems the “add to inventory node” never works outside of the inventory system itself so I don’t know how to get the “add to inventory” to actually work on actor collision instead. Does anyone have a link to a good inventory tutorial? Or perhaps have some insight as to why when I put my “add to inventory” node in an actor after “on component hit” nothing happens. Thank you for any help!
Are you using an actor component for the inventory? Or just an array on the character itself?
If you’re using an inventory component just drag off the other actor pin from the on hit/overlap event, get the component by class, then call the function on it which adds an item. Like so:
If you don’t have a function to add items, you can access the array var from the get component node.
Likewise if you’re just using an array on the player’s char, you can access it directly by casting to the character class like so:
Usually not a good idea to blindly add to an inventory array though, especially if you’re limiting the size.
1 Like
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.