Destroy actor on hit (Kamikaze behavior)

Hi.
I’m trying to implement a Kamikaze action in the blueprint of one of the enemies.
So all I’m trying to achieve is that when the enemy hits my playable character, they explode. (Destroy actor).
But for now it’s the opposite, it’s only when my playable character touches the enemy that it disappears. If they hit me in the back nothing happen.
This is my blueprint. The Event Hit is assign on the Capsule Component of the enemy BP.

Thanks.

Hey @Atomfreak! So the way “EventHit” works: It goes off when the actor with this collision is hit. “Other” is the other actor, yes, so you’re on the right track there.

Try taking out the cast and using a branch in its place. Take the “Other” Off of the hit, and use “GetClass”-> an “= Node” with your “BP_MainCharParent” as the other part of the = (Just select it in the drop down). That should return a bool you can plug into the branch.

Run the execution line to “Destroy Actor” from the TRUE pin, leave false blank.

Lastly, as it is your destroy actor run “Other” from “Event Hit” to “Destroy Actor”. That should do it! I think. You’re saying it’s when your player hits them… Can you be a little clearer on that? We have no real way of knowing how your game works, if there’s a sword, a gun, or what… Maybe try “Event On Begin Overlap” instead of “Event Hit” :slight_smile:

1 Like

Thanks for your time @Mind-Brain !
If I’m not mistaken, with what you suggested, I have the same result.
The enemy is only a sphere without weapons.
There is a Melee attack component assigned in the BP, so maybe there is something interfering. I will search.

1 Like

Hi there, @Atomfreak. Hope you’re well!

This topic has been moved from International to Programming & Scripting: Blueprint.

When posting, please review the categories to ensure your topic is posted in the most relevant space.

Thanks and happy developing! :smiley: