Download

AI creating a list of enemies and removing when enemy is dead

Hi, im currently developing a game in which AI fight each other but im having difficulties in getting the AI to create a list of Enemies seen and remove those enemies if they are dead and engage the rest of the Enemies in the enemy list.

If anyone has developed a system like this would love some help with creating my own, have been stuck on this for awhile now. Still fairly new to UE4 and blueprint scripting. Any help would be greatly appreciated!

What exactly are you having issues with? Simple way would just be adding enemies to an array and looping through it when you need to check if they’re dead.

Telling the ai to remove dead ai from their enemies array

You could add a death event to the dying character, tell it to Get all Actors of Class and get all the enemies, then for each of these get their enemies array, then remove ‘self’ from that array.

If you have set up your NPCs as a parent class, then say, a child class for each ‘team’ you can search for the team class in the Get all Actors of Class

Better yet use an event dispatcher.