How do i set things to happen per actor?

Wasn’t really sure how to phrase the question but basically:

i have a bunch of zombie Ai’s that have health and a laser that will take off health and kill them, but when their health hits 0 and the destroy actor happens it destroys every zombie actor in the level at the time instead of just the single zombie that was hit. how can i make it so only the zombie that gets hit dies

Thanks for any help.

and the destroy actor happens

How are you calling destroy? GetAllActorsOfClass?

Depends on how you access them

F.ex. if you are using “OnBeginOverlap” - it returns much information and you can use a Cast to affect only selected BP’s

If only one Char overlaps you and you cast to it - you are referring to the one who touched you

If you use LineTrace - similar thing - you get info about what the line encountered on the way and if it hits some Actor - if you Cast to them you will be able to change them as you wish

There are nodes like f.ex. @Everynone suggested - Get All Actors of Class but you can imagine what that one will do if you loop through All existing Actors of choice ;]

But basically once you get a Reference to an Actor - you edit it directly

How you access it - it’s another story

1 Like

To make it more clear:

You have 1000 AI’s

All of them are same Blueprint, just multiple Instances

you shoot a Projectile and it produces f.ex. Hit Event

On the Hit Event - you cast to the AI and perform a Function (that’s inside of AI) ‘RemoveHealth’

This Function will:
1st remove HP, then check with a Branch if it’s <= 0 and if yes - Destroy Actor (Self)

So basically now when you hit an AI it will run a Function only in the AI you shoot

1 Like

Normally this would be done like so:

  • in the laser actor:

  • in the zombie actor:


That’s pretty much it, assuming you’re aiming at zombies with traces. This will also work with Hits, Overlaps, Sweeps, Mouse Clicks, hard references…

1 Like

It’s difficult to say what you’re doing incorrectly without knowing what you’re doing.

1 Like