AAIController::SetGenericTeamId
#include "AIController.h"
Access: public
Specifiers: virtualoverrideAIMODULE_API
Description
Assigns a team ID to this AI controller, implementing the IGenericTeamAgentInterface. Used by the perception and team-damage systems to determine friend/foe relationships.
Caveats & Gotchas
- • The team ID is stored per-controller, not per-pawn. If the controller possesses a new pawn, the pawn does not automatically inherit the team ID unless the pawn also implements IGenericTeamAgentInterface and forwards the call.
- • Calling this on a client in a multiplayer game has no effect on server-side team queries — team ID is not replicated by default, so set it authoritatively on the server.
Signature
AIMODULE_API virtual void SetGenericTeamId(const FGenericTeamId& NewTeamID) override; Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| NewTeamID | const FGenericTeamId& | The new team identifier to assign to this AI controller. | — |
Return Type
void Example
Assign team at possession time C++
void AMyAIController::OnPossess(APawn* InPawn)
{
Super::OnPossess(InPawn);
// Assign team 1 so AI perception can distinguish friends from foes
SetGenericTeamId(FGenericTeamId(1));
} See Also
Version History
Introduced in: 4.12
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?