llms.txt: machine-readable documentation index. Markdown version of this page is also available.

Ninja Bear Studio Plugins Help

Factions and Memberships

Town Watch is a faction. The fact that a particular character belongs to the Watch is a membership. Create one faction asset for the whole town, then give each member its own starting reputation and main faction.

What Belongs on the Asset?

Give the faction a unique Faction Tag under Factions.ID and a Team ID for Unreal's team system. Use different team IDs for teams Unreal should tell apart. Display Name and Color are useful in a faction menu. Additional Tags let you group factions, for example when listing every guild in a region.

The asset also says how this faction sees its own members and other factions. A faction can make exceptions for particular neighbors. See Reputation and Attitude.

What Belongs on the Character?

The Faction Component holds the character's memberships. A player can represent Players and also have a reputation with the Town Watch. Mark exactly one starting membership as Main Faction. That membership supplies the character's team ID and represents the character when it judges another actor. A secondary membership lets the Watch track the player's standing while the player still represents Players.

Use Default Factions for memberships an actor starts with. To grant membership through recruitment, a quest, or an active Game Feature, see Assign and Change Memberships.

How Controllers Find the Faction

Get Faction Component checks the actor you pass in. If it can't find the component there, it checks the pawn's controller or the controller's possessed pawn. Keeping one component on the character lets both use the same memberships. If teams should follow the controller across possessions, you can put the component there instead.

If your actor implements Faction Member Interface (IFactionMemberInterface), return its component from Get Faction Component (GetFactionComponent). This gives the lookup a direct route. For actors without the interface, it searches for an attached component.

Faction Component on a character Blueprint
Get Faction Component returns the character's component
#pragma once #include "CoreMinimal.h" #include "GameFramework/Character.h" #include "Interfaces/FactionMemberInterface.h" #include "PluginLabsCharacter.generated.h" class UNinjaFactionComponent; UCLASS() class PLUGINLABS_API APluginLabsCharacter : public ACharacter, public IFactionMemberInterface { GENERATED_BODY() public: APluginLabsCharacter(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get()); // -- Begin Faction Member implementation virtual UNinjaFactionComponent* GetFactionComponent_Implementation() const override; // -- End Faction Member implementation private: UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Components", meta = (AllowPrivateAccess = true)) TObjectPtr<UNinjaFactionComponent> FactionManager; };
#include "GameFramework/PluginLabsCharacter.h" #include "Components/NinjaFactionComponent.h" APluginLabsCharacter::APluginLabsCharacter(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) { static const FName FactionComponentName = TEXT("FactionManager"); FactionManager = CreateOptionalDefaultSubobject<UNinjaFactionComponent>(FactionComponentName); } UNinjaFactionComponent* APluginLabsCharacter::GetFactionComponent_Implementation() const { return FactionManager; }

For your own C++ controller, implement Unreal's IGenericTeamAgentInterface. Return the member's main team ID from GetGenericTeamId. On an AI controller, use the faction attitude from the possessed pawn toward the other actor in GetTeamAttitudeTowards. The first steps use controllers that already do this.

Choose Where Factions Come From

The built-in database finds faction assets in the folders registered in the Asset Manager. To supply your own list, create a Blueprint or C++ subclass of NinjaFactionDatabase, override Get Factions (GetFactions) to return your assets, and select it as Faction Database Class. The inherited Get Faction can then find an entry in that list by its exact faction tag.

A custom database returning a list of faction assets
#pragma once #include "CoreMinimal.h" #include "GameFramework/NinjaFactionDatabase.h" #include "FactionDatabase_DataList.generated.h" UCLASS(DisplayName = "Faction Database: Data List") class PLUGINLABS_API UFactionDatabase_DataList : public UNinjaFactionDatabase { GENERATED_BODY() public: // -- Begin Faction Database implementation virtual void GetFactions_Implementation(TArray<UNinjaFactionDataAsset*>& OutFactions) const override; // -- End Faction Database implementation protected: UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Factions") TArray<UNinjaFactionDataAsset*> Factions; };
#include "FactionDatabase_DataList.h" void UFactionDatabase_DataList::GetFactions_Implementation(TArray<UNinjaFactionDataAsset*>& OutFactions) const { // Easy-peasy! ;) OutFactions = Factions; }
25 November 2026