How to destroy a spawned projectile on Hit

I am new to UE4, so this is probably a noob question.

I am spawning in actors upon key press with a destroy actor upon hit by projectile. the actor gets destroyed when they are already on the map, but not when I spawn them in. do I need to make an array or a check actor command?

Hello,

You need to destroy the Actor inside of the Projectile BP, not the Level BP. The Level BP can see objects that already exist, but spawned objects it would have to be told to look specifically for.

In the Projectile BP’s event graph, just set the On Hit in the same way you have it set here. Then you can remove the old nodes from the Level Blueprint.

Please let me know if that helps

thanks. that worked. but what am I missing to kill actor with only the projectiles and not by toughing it…

Drag off the Event Hit’s “Other” pin then search for “==”. Then you can use the dropdown to select your projectile blueprint to compare with the “Other” actor that hit this actor. This returns true/false based on if it was hit by a projectile.

A “Branch” node will only allow the execution to proceed based on a bool (true/false) value.

So basically what it would do is compare the object hitting you and if it is a projectile, output true. If the output is true, destroy the actor.

Ok. This should work. You nees to tag your projectile.
Simply go to your projectile class BP and in the default tab you can scroll all the way down. Find tags.
Add one. Name it what you like.

Now on componant begin overlap on the zomby come.out od the other actor slot and type actor had tag.
Simply type the name of the tag you created. Make.sure to spell it right.

Brsnch…and tada. :wink: good luck!!

I have used both examples and found that AttemptD method worked the best. I will post a picture of both methods. the one on the bottom by AttemptD is the only one that worked for some reason. I tried to get the other one to work but I think I had something goofed up with the collection for it not to work. Thanks for all the help guys!