Getting AI to interrupt/abort Behavior Tree MoveTo Task

My service checks for possible target and sets the “Enemy” BB variable when one gets within the unit attack range. This is change, is noticed and notifies the decorator which cancels its own branch(self). I don’t change the Destination because I want the unit to, after finishing the Attack task and clearing the Enemy variable, to move from its current location to the Destination.

Also, on your Service you can just grab the distance vector(target location - self location) and do a “Vector Length Squared” then check if its less than you Max squared. It would simplify it a bit.

In your BT the condition should be set to abort “lower”, this way when the unit is in the right branch(the lower priority branch) and the variable get set, it will notify the decorator and abort. After this, it will restart from the root and this time it will pass the decorator, just remember to clear the variable when the giant is no longer an issue, so that he can resume going to the lower priority branch.