How to make one enemy alert other enemies.

So. This is defeating me.

When I get within a certain distance of Enemy Type A, I want him to alert all of the enemy type B’s within a distance (of say 2500). Upon receiving the alert they would change into combat mode and seek the enemy out.

I’ve got a bool on Enemy Type A that sets to true whenever I get within the distance.

Is there a way to do an object trace within a certain distance but in every direction? If I could do that, I could put it on Enemy Type B, and just check if Enemy Type A is the result of the trace, if so, check if that particular enemy’s alert bool is true, and then change the behavior tree.

If you have a better way of doing this, I’m all ears. Just trying to figure it out.

I would try to get Every Actor of Class Enemy B and then check the distance between them and my Enemy A.

If you have too many enemies B in your level that might be bad to do it that way so you could just add a sphere collision around your enemy A and store whatever enemies B come inside. All these enemies should be warned when wanted.

You can also perform an action to check currently overlapped actor I believe.

This may help you : Get actors in range by Mhousse1247

Add a collision sphere to Enemy Type A and then whenever you get inside the distance simply get all the overlapping actors and loop trough them and set them to chase the player.

^this sounds the simplest and lowest cost. Any chance you could flesh this out a little more? Do I create an array from OnEventBeginOverlap? Sorry I’m pretty new at this still.

The way I would do it is when type a starts chasing the player character loop through an array of type b’s and if they are in range use the move to actor to make them chase the player character or move to the type a which ever you wanted.