CrimsonTeams · Lesson 2 of 6

Agents & Attitude

Beginner6 minSetupBlueprints

Before you start

  • Completed: How Crimson Teams Works
  • An Unreal Engine 5.8+ project
  • A couple of team tags (e.g. Team.Red, Team.Blue)
Video coming soon

Chapters

1. Enable the plugin

Open Edit → Plugins, type Crimson, tick CrimsonTeams (and CrimsonCommon, its dependency), and restart the editor. For a Blueprint project that's the whole install.

C++ projects: add the module to your build file:

csharp
// YourGame.Build.cs
PublicDependencyModuleNames.Add("CrimsonTeams");

2. Make two actors team agents

Add a Crimson Team Agent Component to each actor. For players, prefer the Player State — it survives pawn respawns. Give one actor Team.Red and the other Team.Blue, and mark each hostile to the other.

In Blueprint, set Team Tags and Hostile To Tags in the component's Details panel for static actors, or call the mutators on the server at runtime.

In C++, mutate on the server:

cpp
// Server only — team state is authoritative.
if (HasAuthority())
{
UCrimsonTeamAgentComponent* Team = FindComponentByClass<UCrimsonTeamAgentComponent>();
Team->JoinTeam(Tag_Team_Red);
Team->AddHostileTags(FGameplayTagContainer(Tag_Team_Blue));
}
Server authority — no client RPC
All team mutations (JoinTeam, AddHostileTags, …) are BlueprintAuthorityOnly and run only where HasAuthority() is true. Clients receive the result by replication; a client-side call is a silent no-op. Route client-initiated changes through your own server event.

3. Check attitude

Ask the statics whether two actors are friend or foe — it resolves the component on an actor, its pawn, or its player state automatically.

cpp
const ETeamAttitude::Type Att = UCrimsonTeamStatics::GetTeamAttitudeBetween(RedActor, BlueActor);
// Att == ETeamAttitude::Hostile -> enemies
// Quick damage gate (Hostile or Neutral can be damaged; Friendly is blocked):
if (UCrimsonTeamStatics::ShouldCauseDamageToTarget(Instigator, Target))
{
// apply damage
}
Verify
Team.Red vs Team.Blue returns Hostile; two Team.Red actors return Friendly; an actor with no team returns Neutral.