AI vs AI

Hello, new to ue4 and im having trouble setting up a system in which AI attack each other.
They can attack the player fine but im not sure how to go about the AI attacking each other,
there is no clear tutorials i can find about it.

I would like to set it up in a team based system with ID’s

Any help would be greatly appreciated!

If you already have a script to make the AI attack the player, change any “player” references to “pawn”, which covers both player and NPCs.

Here is my BP on defining the player as the enemy how would i change it to as your suggesting?
This is from my AI controller bp


So ive added in an id system but they attack each other regardless and some just stand idle, also ignore the player. Help?

All have team id of 3

Looks like you are comparing the team ID with itself. You are pulling team ID and saying is this teamID DIFFERENT than this teamID. This will always be false (they are the same). You want to compare the teamID from the array element and the teamID of the local NPC.

I am doing NPC vs NPC in my current project and Im doing things a bit different:

Im using AI Perception component on each NPC to detect other pawns in sight. Then I filter all seen pawns by tag (teamID)
Then I compare the local tag with the sensed actor tag and if they are different I make that actor the enemy.

Another recommendation - try not to use Get All Actors with Tag at runtime (its very expensive). Use Perception AI or a smaller sphere trace to get nearby pawns and do your filtering with that list. It will make a big difference if you have a lot of NPCs running around.

This is a sample of what Im working on in case you are curious:

Let me know if you have any other questions.

Hope this helps!

Thanks for the help! but im having trouble setting up a system in which you suggest.
The pawn sensing works great but its setting up the tag flitering im having issue with, could i see an example of how your AI filters the tags?

This was my attempt at it, i removed the team two filter in this screenshot.
Also i have a AI character and a AI controller