Hey, I’ve been trying to make so that player can pick up items. for now it’s supposed to destroy the selected item/actor but its not going well. The item is a children BP of the item master which includes the scene and ItemData data structure. In theory it should destroy actor but it’s not. Would someone please help me?
sorry, in the screenshot it was after experimenting with other methods. The original version is this one,
and no, it’s still the same outcome.
Hmm I Dont see anywhere that you call the Destroy function. Is it just not in the screenshots?
try adding a print string on the Cast Failed, maybe it is failing to cast it and that is why it is not destroying
edit: you may also print the Display Name of the hit actor, maybe it isn’t even targeting the object you want
Thank you for replying again, the casting to master Item seems to be failing? Not sure why?
try using this
if you want to execute more code do it on the Completed node
edit: i use a node called SphereOverlapActors
Maybe you shouldn’t cast it to the Master Item, but to a child one?
Wait, why do you have to cast to anything to destroy the actor? Can’t it be destroyed directly?
Correct me, if I’m wrong but…
Because it needs to be casted to the parent BP to find the actor/ child BP to find the actor. It can’t be directly be destroyed. Casting directly to child BP is impossible, because when you have many items later on; you’ll need to cast it to all child BP.
Also I followed several people’s tutorial and advice.
Can you print the name of the hit actor after you check blocking hit?
also you don’t need to use the node Make Array after the trace
you need to use a MULTI sphere trace
You don’t need casting to find the actor, you already have it when you get the hit result.
Alternatively, you may set the destroy function in the actor blueprint itself. I believe later on you’ll add some functionality to the bag blueprint so that it would return some data when picked. You can call the destroy function in the bag blueprint after you have received all the data from it. In this case you’ll have to cast to its blueprint.
Alternatively x2, you can create an interface and put it into the bag blueprint. In this case you won’t even have to cast, you can just call the interface.
Thank you so much!