How to use AI team sense in blueprint? I created a AI using behaviour tree… If one AI see player character he start follow the player character but i want if one see character other also start follow player
AI teams is not exposed in blueprints, you could create a component and set up your own filtering system.
can you give me an example?
Following this, I used to add an ActorComponent to any Pawn defining a custom “team” for blueprints. Now you got me interested.
For blueprints, you could create an enumerator containing teams “Red, Blue, Green”.
Then create an ActorComponent called “TeamComponent”, containing a Team property of said enum.
When your AI senses Actors, check all of the pawns int it if they hold a TeamComponent, then from the TeamComponent request the team and see if it matches the team of the Pawn controlled by the AIController.
I have the enum only in the component, and I use a function called setMyTeam.
I also call a pure function on the component called IsEnemy with the input from the detected actor. That way, all the logic of teams stays in the component.