Attack with cooldown
Gate the attack branch on a countdown your own component owns, so the graph never keeps a second copy of the timer.
On this page
The component that refuses the swing is the component that should be timing the wait.
The problem
Section titled “The problem”An enemy should swing, then wait, then swing again. If the graph owns the wait, you have two timers: the one in your combat component that decides whether the hit lands, and the one in the graph that decides whether to try. They drift, and the enemy swings at nothing.
The shape
Section titled “The shape”Keep the countdown in the component and read it as a guard at the top of the attack branch.
EnemyBrain.bqbehavior in Horde Survival runs a priority Selector named Attack, Chase, or Hold. The attack Sequence puts its cheap guards first: Has Target, Enemy Alive, then Cooldown Ready. Only once those pass does it run the Distance Squared method and compare the answer in In Contact Radius. Cooldown Ready is a member condition that reads the field ContactAttack.CooldownRemaining and tests it with ≤ against 0. When the countdown is still running the guard fails, the Sequence fails, and the Selector falls through to chase.

EnemyBrain in Live. The selector settled on the chase branch for this tick, which is what happens while the attack branch’s guards say no.The countdown already lives in a component, so the graph reads it as a fact instead of keeping a second clock.
Nodes it uses
Section titled “Nodes it uses”- Selector with attack above chase above hold.
- Sequence for the attack branch, so the first failing guard ends it.
- Member condition reading the field
ContactAttack.CooldownRemaining, and again readingHealth.Currentfor the alive check. - Method for the static distance calculation the range check compares against.
Reuse it
Section titled “Reuse it”Two rules make this shape work in your own game. Put the countdown where the ability already lives, so the component that refuses the swing is the component that measures the wait. Then make the guard the first child of the attack branch, so a swing that is impossible costs one comparison.
- Director with weighted choices: the graph that decides what this enemy is part of.
- Horde Survival chapter: entity agents, and how to play it.