How-To: Drive Combos from AI

Goal: have an NPC run the same authored combo graph a player runs - starting it, choosing its follow-ups and finishing it - from whatever AI you already use, with no input, no prediction and no special graph authoring.

Prerequisites
How-To: Get the Building Blocks step 7 (the combo system must be enabled) and How-To: Author a Combo (the graph the NPC will run). The NPC needs an ability system component and a UCrimsonComboController, exactly like a player pawn.
Authority only, and never on a player
Every function on this page runs on the authority and is refused outright when the owning pawn is player-controlled. A server-initiated step on a human's pawn is never predicted by that client, so each driven step would land there as a divergence and roll the client back. Drive AI with these; drive players with input.

No Behavior Tree nodes ship with this plugin, and none are needed: these are ordinary Blueprint-callable functions on the combo controller. Call them from a BTTask, a StateTree task, an AI controller or a plain component - anywhere that runs on the server.

1. Give the NPC a combo controller and a grant

Add a Crimson Combo Controller component to the NPC pawn. Then, on the server, grant it the combo: a drive request only starts a combo that is granted and unlocked on that controller.

On the NPC pawn: Event BeginPlay -> Switch Has Authority (Authority) -> Get Component By Class (CrimsonComboController) -> Grant Dynamic Combo (Root Ability Class = the ability the combo hangs off in the graph, Combo = your graph asset).

If the combo is already a Default Combo on an ability the NPC is granted, call Unlock Combo Grant with the same two pins instead of granting a new one.

Verify
Play In Editor, open Tools -> Crimson Ability Dev Tools, select the NPC in the Target picker and go to the Combo tab. The Grants section lists the combo with a Status of UNLOCKED.

2. Pre-flight the step abilities

Every step of the combo activates a real ability on the NPC's ability system component, and a driven combo tears itself down on the first step ability it cannot activate. Two calls make that a checked condition instead of a surprise.

CallDoes
Preload Combo AbilitiesWarms every step ability class the combo references, so the first step is a pointer read instead of a blocking package load mid-frame. Safe to call repeatedly.
Get Ungranted Step AbilitiesReturns every step ability of that combo that is not currently granted on the bound ability system component. Call it after the preload and let a frame or two pass: a class that is not resident yet is reported as ungranted, because its grant state cannot be read.

Get Component By Class (CrimsonComboController) -> Preload Combo Abilities (Combo = your graph asset) -> Get Ungranted Step Abilities (same asset) -> Length. Anything above 0 is a step the NPC cannot perform - add those abilities to the ability set the NPC is granted.

Verify
Get Ungranted Step Abilities returns an empty array for the NPC and a combo-sized array for a pawn that was granted nothing.

3. Start the combo

Start Combo By Asset begins the combo at its first step. No starting handshake is matched and no rooting ability is canceled, because there is no press. A combo already running on that controller is ended first, with reset reason Manual. It returns false and sets its Out Result pin on every refusal - see the result table below. A step node that lists Manual in its Reset Ignore Reasons does not see that teardown and survives it, so keep Manual off any node a driven start has to be able to interrupt.

Get Component By Class (CrimsonComboController) -> Start Combo By Asset (Combo = your graph asset) -> Branch on the return value. The Out Result pin carries an ECrimsonComboDriveResult you can switch on when it fails.

Verify
With the NPC selected in the dev tools Combo tab, the Status section leaves IDLE and the Active Step Timeline starts running the first step.

4. Chain to the next step

Request Transition To Node fires the active step's transition whose target is the node you name - or an end point, since a step may wire straight into one. When several edges target the same node, the highest-priority eligible one wins. Get Available Combo Inputs is where the candidate targets come from: each entry carries its Target Node ID, its Priority and whether it would fire right now.

TimingBehavior
ImmediateFires only if the transition window is open at this moment. If it is not, the request fails, returns false, and nothing is stored.
WhenWindowOpensFires now if the window is already open. Otherwise it latches the request on the active step and fires the instant the window opens, returning true with a result of Latched. One latch per step - a second request replaces it - and the latch is dropped when the step ends for any reason. Cancel Pending Drive Request drops it early.

A drive request is not a synthetic button press, and the edge is read accordingly:

Part of the edgeOn a drive request
Input actionIgnored. There is no press to match.
Kind (Tap, Hold, Release)Ignored.
Fire Mode (IASA, PressBuffer, HoldBuffer)Ignored. A driven transition fires when the request is granted.
DirectionIgnored.
Modifier chordsIgnored.
The transition window, including Cancel Open Override and Cancel Close OverrideRespected. No ping leniency is applied on either side - the requester and the authority are the same machine, so the authority's own clock is the whole rule.
Edge Required Tags QueryRespected, evaluated against the NPC's current ability system tags - which include the live Combo.Phase.* tag and the active node's Node Tags. See How-To: Drive Behavior from Step Phases.
Transition conditionsNever block a transition in this system, for players or AI alike. They only select conditional augments - see How-To: Gate Combo Branches with Conditions.

Get Available Combo Inputs -> For Each Loop, and keep the entries whose Availability is Continuation and whose Would Fire If Pressed Now is true. Feed the chosen entry's Target Node ID into Request Transition To Node with Timing = Immediate, then break out of the loop.

To commit to a follow-up before the window opens, call Request Transition To Node with Timing = WhenWindowOpens as soon as the step begins. Cancel Pending Drive Request takes it back if the NPC changes its mind.

Verify
In the dev tools Combo tab, the History Log records the transition and the Active Step Timeline restarts on the new node. A request made with the window shut returns false with WindowNotOpen or WindowClosed and changes nothing.

5. Know when the combo finished

There are no drive-specific delegates, because polled AI does not need them. Get Completion Counter is bumped every time the controller reaches an End node. Snapshot it before starting; when Is Combo Active goes false, a counter that changed means the combo finished cleanly and a counter that did not means it was reset. Compare for inequality only - the underlying value is a byte and wraps.

Before Start Combo By Asset, store Get Completion Counter in a variable. Each tick afterwards: Is Combo Active -> Branch (False) -> Get Completion Counter -> Not Equal (integer) against the stored value. True is a clean finish; false is a reset.

Verify
Run the combo to an End node: the counter changes. Reset it instead (walk the NPC out of range so the window lapses) and the counter stays put, while Is Combo Active goes false either way.

Drive result codes

Every drive call sets an ECrimsonComboDriveResult. These are distinct from the server's rejection reasons for a client's predicted transition - these describe a request the authority made itself.

ResultMeans
SuccessThe request was granted.
ComboSystemDisabledThe combo system is off in Project Settings -> Crimson -> Crimson Ability System.
NotAuthorityThe caller is not authoritative.
OwnerIsPlayerControlledThe owning pawn is player-controlled, so the drive was refused.
NoASCNo ability system component is bound to the controller.
ComboNotGrantedThe combo is not granted, or not unlocked, on this controller. Also reported when the combo ended during its first step, which usually means a step ability the NPC was never granted.
ComboNotActiveNo combo is running, so there is nothing to transition out of.
NoMatchingTransitionThe active step has no transition toward that target.
TargetNotReachableThe target node or end point is not in this combo.
WindowNotOpenThe transition window has not opened yet.
WindowClosedThe transition window already closed.
EdgeTagsNotSatisfiedThe edge's Edge Required Tags Query is not satisfied by the NPC's current tags.
LatchedTiming was WhenWindowOpens and the request is now latched on the active step. It fires when the window opens.

What clients see

An NPC has no owning connection
The combo controller's replicated state - its grants and its current node - is owner-only, and an AI pawn has no owning connection, so none of it reaches any client. Clients see an NPC's combo through the replicated ability montages, which is what they need. Build NPC-facing UI from your own replicated gameplay state, never from an NPC's combo controller.
Verify
Play As Client with 2 players. The NPC swings the same string on the server and on both clients, because the server drives every step and the clients see it through the replicated ability montages.

What you will not see on a client is any of the NPC's combo controller state - no grants, no current node. That is correct, not a bug: the state is owner-only and an AI pawn has no owning connection.
Have all the Crimson plugins? *(CrimsonCore - requires all Crimson plugins)*
CrimsonCore ships a StateTree task, Crimson Perform Combo, that wraps everything on this page: it finds the controller on the pawn, preloads, starts the combo, picks a follow-up each tick by a Policy, and reports Completed Cleanly when the combo ends. CrimsonCore is free to download, but compiles only with all Crimson plugins installed - the steps above are the standalone equivalent, so the only question is whether you want the shipped task or your own logic. CrimsonCore -> How-To: NPC Combos documents it.

See also

  • How-To: Author a Combo - the graph an NPC runs is the same graph a player runs.
  • How-To: Drive Behavior from Step Phases - the tag query a driven transition respects.
  • How-To: Gate Combo Branches with Conditions - why conditions never block a transition.
  • How-To: Debug Combos (Dev Tools) - watching a driven combo live.
  • Concept: Combo System - the model behind the graph.