How do I create AI Teams?

Hi everyone I am trying to make AI teams that should go like this (Team 1 has a bunch of AI and the player character. The AI will attack Team 2. Team 2 has a bunch of AI. The AI will attack Team 1). Basically a Team vs Team. I am having one problem that is just making AI know what team is a enemy and what is not. I been looking for tutorials everywhere but they are only in C++… I am using only Blueprints.

Please help!

I am new to UE4, but what I have learned and this might not be the most technical answer, so you can take this advice as such.

You can set up tags, Player Tag, Team 1 tag, Team 2 Tag, and so on, you can assign how AI or players interact with other players and AI on different teams,

So Anything assigns as a player, can be seen as hostile by anyone setup as Team 1 or Team 2, and so on!

You can also set up neutral characters, like civilians by making and assigning these tags to them.

Click on a character you have placed in the world, scroll down in the detail panel, until you find TAGS, from here you can assign and create tags, you have then a few options on how to set up your AI to interact with these tags. Usually, this is done through the Behaviour tree and Blackboard as a sequence, a discovery check, usually done with a preception sight or sound. Then an action or choice, if the AI sees a friendly tag, it ignores it, if they see an enemy tag(Team2) then move to or attack.

I know this is not maybe the complete answer you were looking for, but maybe it will give you some ideas on how to progress forward.

Looking in the AI documentation section should help it explain some of the more advanced parts. As I said, I am fairly new to UE development, so take my advice as such, but I hope it helps!

1 Like

I like to add ActorComponents to my Actors that hold logic like this, because ACs are reusable on basicly any Actor. In this case I’d start creating a new ActorComponent “AC_Behavior” that holds an enumerator “Team” (TeamA, TeamB). This AC_Behavior will also contain a function to check if ActorA (the owner of the AC) is an enemy of ActorB by checking if enum Team is equal to its own or not, which would mean enemy. That’s a very basic example of how to store that kind of configuration on an Actor. Of course any “team behavior” or AI in general is a bigger topic…
Mathew Wadstein’s YT channel got lots of useful information on the basics.

Thanks I will look into it.

I could do tags but the only problem I am having is this. How to get the Team number of what the AI is looking at.

Alright I was able to use your advice on the tags and now everything works!! Thanks for everything!!!

1 Like