CToolAI

Overview

AI blackboard key management and team attitude utilities.

Struct: CBlackBoardKey<T>

Name Description
name FName key identifier.
entry FBlackboardEntry associated with this key.
// Create a typed blackboard key
CBlackBoardKey<UBlackboardKeyType_Object> targetKey(FName("Target"));
CBlackBoardKey<UBlackboardKeyType_Vector> destKey(FName("Destination"));

Blackboard functions

Name Description
trySetBlackBoardKey Set a blackboard key value. Logs warning if key not found. Overloads for CBlackBoardKey and FBlackboardKeySelector.
tryGetBlackBoardKey Get a blackboard key value. Overloads for CBlackBoardKey and FBlackboardKeySelector.
clearBlackBoardKey Clear a blackboard key. Overloads for FName and CBlackBoardKey.
defineKey Define a key in a UBlackboardData. Overload for Object keys typed to a class, and generic keys with customization lambda.
// Define a typed blackboard key
CBlackBoardKey<UBlackboardKeyType_Object> targetKey(FName("Target"));
defineKey<AMyCharacter>(myBlackboardData, targetKey);

// Set a blackboard key
trySetBlackBoardKey<UBlackboardKeyType_Object>(aiController, targetKey, targetActor);

// Get a blackboard key
UObject* target = tryGetBlackBoardKey<UBlackboardKeyType_Object>(aiController, targetKey);

// Clear
clearBlackBoardKey(aiController, targetKey);

Team attitude functions

Name Description
retrieveTeamAttitude Get team attitude between two actors.
isAForBOneOf Check if A’s attitude toward B matches one or more attitudes. Overloads for single attitude, array, and TEnumAsByte.
getController Get the controller of a pawn.
ETeamAttitude::Type attitude = retrieveTeamAttitude(actorA, actorB);

bool isHostile = isAForBOneOf(actorA, actorB, ETeamAttitude::Hostile);
bool isFriendlyOrNeutral = isAForBOneOf(actorA, actorB, TArray({ETeamAttitude::Friendly, ETeamAttitude::Neutral}));

AController* ctrl = getController(myPawn);