# Drive Combat from AI

> For the complete documentation index, see [llms.txt](llms.txt).

Have an AI character start an attack and choose a follow-up when the animation allows it. Use a possessed combatant with the [branching Combo Ability](cbt-guide-combos.html) already working.

Procedure: Start the move and observe completion

1. Give the AI a reachable target. In its Behavior Tree or State Tree, check for a live combatant and an appropriate distance, then activate the granted Combo Ability on the pawn's ability system. The built-in Combatant Dead decorator or condition can exclude a defeated actor.

2. Keep the attack branch active while the combo runs. Bind `BindToComboFinishedDelegate` before activation, handle a failed activation immediately, and finish the attack branch when the callback arrives. Remove the binding when the branch exits.

Procedure: Send a follow-up when the window opens

1. In a Behavior Tree, attach the Advance Combo service to the active combat branch. Choose Gameplay Tag as its event mode and set the default tag to the primary event in your combo. Keep the service active before the opening move reaches its window.

2. In a State Tree, activate the ability from a parent state and run Advance Combo in its child. Bind the AI controller and set the same default transition tag. The task uses the stock Combo Manager or a subclass. Use the Combo Advances output to see whether a follow-up was requested.

For a Behavior Tree that branches based on distance or stamina, override `GetComboGameplayTag` on the service in Blueprint. If the combo maps Input Actions, override `GetComboInputAction` instead. In C++, the State Tree task exposes the corresponding virtual functions on `FStateTreeAdvanceComboTask`. [Bot and Combat](integration-bot-combat.html) connects perception to acquiring and releasing a target.

## Try It in Play

Watch the AI perform the opening and light follow-up without a player button press. Change the service or task to the secondary event and check that the heavy animation plays. After the combo finishes, the AI should be able to return to its movement or decision branch.

