How do i make friendly Ai attack enemy Ai in unreal engine 4??
I am working in a historical shooting game, i finished all the shooting and attacking animations for the Ai but i cant get to make the enemy attack the friendly Ai and the game then just started to look retarded
asked Mar 28 '17 at 08:13 PM in Blueprint Scripting
I would recommend having a tag on each Ai actor that represents their 'team'. Then when you are selecting a target to fire at, only select targets with tags that that Ai considers to be an enemy.
Another way to do this would be cleaner if all your Ai classes were somehow related in the class hierarchy. Find their common ancestor, and add a field that is an enumeration type denoting their team. Set this somewhere reasonable (likely in a child class that represents a member of one team). Then when selecting a target for attack, you'd cast any candidates to the type of the shared ancestor, if the cast succeeded check its team, then decide what to do appropriately.
Follow this question
Once you sign in you will be able to subscribe for any updates here