Decision tree decorators behaving in an unexpected way?

Hello. I am trying to do something fairly simple. If my agent is already near MyAICore, I want it to start walking to EnemyAICore. If my agent is not standing near MyAICore, I want it to start walking to MyAICore.

The trouble is: When it walks from MyAICore to EnemyAICore, I want it to (as soon as it’s not nearby MyAICore) turn around and walk back to the AICore.

As it stands, they successfully alternate locations, but the agent doesn’t turn around when they go out of range of MyAICore (they walk all the way to the goal instead). They are never meant to reach EnemyAICore, only walk that direction for a little bit.

EnemyAICore and MyAICore are Actors.

I wrote some custom decorators and tasks to help with this, but I’ve tried to boil it down to its basics and I feel like this should work. But it does not. Can anyone advise as to what I’m doing wrong? Many thanks!

Ended up adding a blackboard value to track distance to enemy and friendly AI to get set by the AI Controller tick function. Then I used a blackboard decorator and observer aborts self to get the behavior I want. Behavior Tree and tick function (which I set to run every 1 second so it doesn’t do those distance calculations each frame) attached.

alt text