How to ignore other actors in my OnActorHit Event?

I have a blueprint set up where when the player hits the other character he’s killed. This works perfectly, but when i add other enemies when they hit the original enemy the player is killed. I want to ignore the hits from the other enemies so my player only dies when they hit the enemy.

There’s my blueprint set up.

I also have another problem, when I replicate the OnActorHit Event for my second enemy (The bottom set) when i start the game the player is killed immediately. They’re not touching or hitting the second enemy at all.

Any help would be greatly appreciated.
Cheers.

I use cast to …, and only connect on success output. This filter to only one actor.

can you give me a step by step? You can see my blueprint there.

Like:

  1. Break this node
  2. Connect that to this one
  3. etc,

I’m new to Unreal 4 and haven’t got a lot down yet.

On ActorHit Node, click-n-drag “Other Actor”, this will show up context menu.
Now type cast to “The BP/Class you whant filter”.
This will give you a node with 2 return arrows. Cast Failed and de default one. On default one, connect to your current destroy actor.

this will filter your hit event to only firesup to specific actor class.

Thanks, but my main player and the enemies are both character classes.

Any ideas? I’m really stuck.

I’m not at home with Unreal Engine now. But try to search how to compare actors of same class. Other hint is put a TAG on player, and use node “Actor has Class” compare it.

There are different ways.

1.First, add your character public bool variable “isPlayer” with default value false. When you start playing set that variable to true. After hitting , get if hit actor is character and “isPlayer” is true ,then kill player.
2. Add "isplayer "tag to your character after event on begin play and after hit get if character contains tag “isplayer”. sensitive.

Cheers for the help, but I don’t really get how to do any of that stuff. I’m totally new to doing things this way.

If you have the time I’d be really helpful if you told me what to do and how to do it. If you don’t that’s fine, thanks for the help anyway!

65019-addthis.png

1 Like