Task Nodes

Overview

Custom Behavior Tree task nodes provided by CAIUMODULE. All extend UBTTaskNode (or a UE built-in task subclass) and are usable directly in Behavior Tree assets.

Task Nodes

Name Description
UCTNAttack Triggers an attack via UCCombotterComponent_. Latent — finishes when the montage ends.
UCTNAutomation Reads the next automation command from UCAutomationComponent_. Supports LOCATION (room-relative positions A–H, M) and WAIT commands.
UCTNChooseRandomExtremityOfClosestEdge Picks a random reachable point near the closest room edge within the navigation invoker radius. Falls back to spawn origin if no edge is close enough.
UCTNClearValue Clears one or more blackboard keys.
UCTNMove Extends UBTTask_MoveTo. Adjusts AcceptableRadius by adding both the target and the pawn capsule radii.
UCTNMoveOnNavMeshIfRequired Checks if the pawn is on the NavMesh. If not, projects to the nearest navigable point and teleports.
UCTNTeleportToACloseNavigablePoint Teleports the pawn to a close navigable point. Tries projection first, then random point in closest room. Updates the pawn’s origin transform.
UCTNWait Extends UBTTask_Wait. Reads wait duration from a blackboard key instead of using a fixed value.
// --- UCTNAttack ---
// Requires: UCCombotterComponent_ on the possessed pawn.
// Triggers proceedAttack and waits for montage completion.
// Returns InProgress while the montage plays, Failed if no combotter component.

// --- UCTNAutomation ---
// Properties:
//   FBlackboardKeySelector targetLocationBBkey  — receives the computed location
//   FBlackboardKeySelector waitBBKey            — receives the wait duration
// Reads commands from UCAutomationComponent_::read().
// LOCATION command: resolves room-relative position codes (A=top-left, B=top-right,
//   C=bottom-right, D=bottom-left, E=top-center, F=right-center, G=bottom-center,
//   H=left-center, M=center). Sets targetLocationBBkey with world Z.
// WAIT command: sets waitBBKey with the float duration.
// Advances to next command via i->next().

// --- UCTNChooseRandomExtremityOfClosestEdge ---
// Properties:
//   FBlackboardKeySelector locationToReach  — receives the chosen location
// Requires: UNavigationInvokerComponent on the pawn.
// Picks a random distance within [25%, 75%] of the navigation generation radius.
// Finds the closest room edge; if within range, picks extremity A or B (checking cell ownership).
// Falls back to spawn origin if no edge is close enough.
// Normalizes direction in 2D, clamps to navigation radius, then finds a random reachable point.

// --- UCTNClearValue ---
// Properties:
//   TArray<FBlackboardKeySelector> keyToClearArray  — keys to clear
// Iterates and clears each blackboard key.

// --- UCTNMove ---
// Extends UBTTask_MoveTo.
// If the blackboard key references an actor, adds both capsule radii (target + pawn)
// to AcceptableRadius, minus 10% tolerance.

// --- UCTNMoveOnNavMeshIfRequired ---
// Projects the pawn location onto the NavMesh.
// First tries a vertical projection (UpVector * capsuleSize).
// If that fails, tries a wider sphere (OneVector * capsuleSize * 2) and teleports.

// --- UCTNTeleportToACloseNavigablePoint ---
// Attempts to place the pawn on the NavMesh:
//   1. ProjectPointToNavigation with capsule extent * 2
//   2. If that fails, GetRandomPointInNavigableRadius within the closest room
// On success, sets ensureNavigation blackboard key and updates the pawn's origin.

// --- UCTNWait ---
// Properties:
//   FBlackboardKeySelector waitBBKey  — blackboard key holding the wait duration (float)
// Reads the float value and passes it to UBTTask_Wait::WaitTime before executing.