Patrol and chase
Put the urgent branch above the routine one under a Selector so chasing always beats patrolling, without a single flag.
On this page
Chasing has to beat patrolling whenever the guard gets the choice, and one Selector is the whole mechanism.
The problem
Section titled “The problem”A guard walks a route. When it sees the player it must chase, and when sight breaks it must go back to walking that same route. Written with flags, “am I chasing” ends up read by movement, by animation, and by the alarm, and one of them reads it a frame late.
The shape
Section titled “The shape”One Selector with the branches in priority order: the most urgent first, the routine job last. The Selector tries each child in turn and stops at the first one that runs or succeeds, so patrol is reached only when nothing above it wanted the tick.

DocumentationFlowControls.bqbehavior. Chase sits first, the search routine second, the standing job last.Dungeon Heist runs the production version. Guard2.bqbehavior has a single root Selector whose children are, in order: reset, catch, chase, capture stimulus, investigate, search, return to route, and patrol. Patrol is the last child, which is exactly why a guard that can see you never walks its route.
Reuse it
Section titled “Reuse it”Reach for this the moment one behavior has to outrank another: a guard that must break off its route, a companion that must stop fetching when you take damage, a turret that must abandon its sweep for a real target. Put the branch you would interrupt for at the top, put the thing it is allowed to interrupt at the bottom, and let the Selector be the priority document. Each branch keeps its own guard, so no branch has to know the others exist.
When the top branch has to win while a lower one is still mid-action, set the Selector’s Reactive abort > Abort to Lower priority. Without it the running branch keeps the tick until it finishes.
Nodes it uses
Section titled “Nodes it uses”- Selector as the priority list.
- Sequence inside each branch, so a branch fails fast when its first guard says no.
- Member condition as each branch’s guard.
Guard2usesclear player sightandchase runningat the top of its catch branch. - Repeat inside the chase branch, so pursuit keeps running until sight breaks.
- Guard and investigate: what happens between patrol and chase.
- Dungeon Heist chapter: the scene, the controls, and what stays in C#.