AI that spawns with player

Hey guys , i am using the fps starter kit and i already created an AI bot , but how do i make it spawn with a player and target enemy team? Any help would be great , note i am new to UE4 , so please be specific in answers thanks :slight_smile:

Look for “Auto-possess AI” field in pawn class defaults/settings if working with blueprints, indicates moment when auto possess happens. This should have several options of when it should happen. Also there is a “AI Controller Class” which determines what AI Controller class should control this pawn.
With C++ situation is pretty much the same: enumerator AutoPossessAI (type: enum class EAutoPossessAI) and subclass AIControllerClass (type: TSubclassOf). Just set those variables in initializer of your pawn-derived class.
And AI Controller should be fully automatic, I mean Pawn shouldn’t tell something to Controller, it’s Controller should watch from PlayerState and Pawn “which team I’am in and who must I attack” according to this. If you need to change the team of some pawn you just need to get the PlayerState of this Pawn (if it’s controller by someone, otherwise it will be null) and change team there, at least variable which supposed to determine that.