AI Behavior Tree MoveTo : How to dynamically change target?

Hello !

I currently have an AI that follows the player, but at one point I am changing the value of the ‘objective’ of the AI, switching it from the player to a random point.
However when I change the value, the AI that already spawned is not changing the target, instead it needs to arrives at destination ( the player ) and then going to the correct point.

I do have the ‘observe BB value’ checked, but none of it seems to make the change during runtime.

Any idea how I could handle this ?

Thanks

Welcome back Craze, it is great to have your question here.

Since you are using a behavior tree, I would like to ask how your decorator aborts? If you changed the ‘Observer Aborts’ value on your decorator, would there be any difference?

I noticed that when I set my ‘Observer Aborts’ value to ‘None’, my AI will also complete their previous action (patrol). When I use aborts both, the AI immediately stops trying to patrol and pursues the player.

I look forward to an update on your current circumstance.

Hello !

Thanks for your reply ! :smiling_face_with_three_hearts:

So when I talked about Observing the value, I was speaking about this :

Basicly with this I am expecting the new goal to update if I am changing the blackboard key. In the AI controller, I am checking on the tick time if there is a value changing in the gameMode blueprint. When there is, I am adjusting the value in the ‘objective’ BB key, and expecting the ‘Observe Blackboard Value’ to pick up on it, and reorienting the ‘Move To’ node to the correct new location.

Sadly it is not, I tried another approach : using a Decorator to make the moveTo sequence tree fail, then reactivate it again. While it succeeds to stop the AI during the moveTo process, it doesn’t pick up again and I didn’t find a way to ‘reboot it’.

I ended up doing something like this :

While this works, I am not satisfied as this is a solution that works if you want to different behaviors based on what the current objective is, but I find it redundant if the actions will be the same in both trees.