How to make my character know what Im picking up.

I have a line trace in my player BP that checks if hit actor has an interface.


I also made a parent Master Item with only a print string and destroy actor.
image_2024-07-23_162428969

What im trying to do is make a child BP from my master ITEM sample is: gun , flashlight, consumable etc.
my problem is I dont know how to make my player BP know what I picked up. My player successfully Destroy the actor it hits with line trace.

Have you watched many vids on this?

It all depends how you have decide to design your inventory process.

You might have the class of the object, or an enum, or etc…

From the first graph it appears you already have a Item return type from Interact, so I think you are already well on the way. Just have the Interact within the subclasses return the appropriate struct. Or am I missing something?

Side note: If your item actors are not very complicated/different, subclassing is very heavy handed, better to just handle it all in one class (with instance editable mesh, item, etc).

yes, i made the return node have an output of a structure with name and icon.
I can successfully print the name of the child BP i hit with line trace. but I dont know how to make my player character recognize that the actor is already picked.

sample is: I have a flashlight in my world as a child BP of my master item.
I am successful to print the name of the actor I hit .
but I still cant make my player character use the flashlight. I dont know how to do it.

What im currently trying is setting a boolean after hitting my line trace.
but it activates everything

You will need to test the Name field in the struct returned from Interact. With the Set happening where you currently have it you would need to also have Generate Line Trace return the struct it gets from Interact.

Given the Generate Line Trace is a function on the character, you could of course just do it there too.

In general, this looks like a very rigid system that is probably going to fall apart as you add features…

How many items is the character able to pick-up? Can they switch items?

A handful of booleans will be fine if you have three items in the game, but if you intend to add many, this will not be manageable. Recommend you look into inventory systems, as semi-suggested by Clockwork.

Yes. I decided to check some tutorial videos on Inventory systems. and see if I can Implement it in my game. tnx

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