About Behavior Tree Quick Start Guide: one strange situation occurred when I modifiy "CloseEnough"

Hello everyBody, I am a beginner of behavior Tree.

Folow the Quick Start Guide,the orignal judgment is “AcceptableDistance” >= 100.

And I modifiy “CloseEnough” like that …

(1) add one variable “AcceptableDistanceMax”.

(2) the new judement is ( “AcceptableDistance” >= 100 and “AcceptableDistanceMax” <= 500 ).

Then I run the game and then one strange situation occurred.

but If using the original judgment ( “AcceptableDistance” >= 100), the strange situation will not occur.

Can you show a screenshot of “close enough”'s BP code?

This is “close enough” BP.
And May I ask a question. how to get the full BP screenshot like that.

I thought node[2] will abort executing task always (when “notify observer” is "on result change " and “observer aborts” is “Both”), but it’s wrong.

Visual Logger give me the real snap.

When AI in node[6] (RapidMoveTo) and next frame “targetToFollow” being set to “null”, node[6] will be deactive. (I guess Node[3] did not executive BP here beacuse its BP need “targetToFollow”)

But when AI in node[16] (MoveTo HomePos) and next frame “targetToFollow” being set to “not null”, node[16] will not be deactive. (because node[3] do not return true)

is there a simple rule to determine where if node[2] abort the running task ?

Node[2] doesn’t abort the current task because it wouldn’t result in picking a new behavior, because [3] will not allow this. By design we don’t abort behaviors just to get back to them. The real problem in your BT is that there’s no fallback behavior. If TargetToFollow is set, but it’s too far, then the BT has no “legal” behavior. I always say adding a fallback “wait” behavior, even a half a second one, allows one to avoid all sorts of “intuitive” situations like this. I say “intuitive”, because BT does exactly what it’s told do do :slight_smile: If you marked the [7] as aborting “Self” your behavior would get aborted, but you’d end up with a BT that will try to find new behavior every single frame due to not being able to find one (and costing you performance while doing so).

Add a wait task at the end :wink: