Is there a way to cance MoveTo in behaviour tree on certain events?


so I am currently working on my AI. I have a simple beaviour tree where the AI follows a path in the patrol state. I use the SensingComponent to check, if my Bot sees the player. If so, I want him to immediatly chase him. The switching between state Patrol and Fight works, but it will always wait for the MoveTo Task to finish, before it switches to the Fight subtree. What I need, is to cancel this task, as soon as the bot sees the Player. Is this possible?

If i remember correctly, the AI Controller should have a Node / Function called “Stop Movement”. You should be able to stop the movement/walking.

Hm if I do this outside my BT, is there a way to access the BlackBoard Values somehow? Im in my controller and basically want to ask for the AIs State value from its blackboard. When I use GetBlackboard, it just says “None” for that.

Woot? Normaly you would call the Stop Movement Function inside your Behavior Tree where you changed the State. So the point where you switch from Patrol to Fight (i guess thats the point where he first finishes the moveTo) you add the Stop Movement Node. Than he should directly chase you :X

Well not really. The tree stays at the MoveTo Task, until it finishes. When it finishes, the tree continues and will then switch the state correctly. Thats why I need to abort the execution of the this particular task.

Hey thx man, are you doing this on your controller or your character? If i try this on my Controller, GetBlackboard does not return anything, even the BT is running.

This is how I do it using the SensingComponent, which is in my Monster Blueprint.

I just realized that maybe I should disable the sensing component when the monster finds the player :o !

The sensing component is not in the controller, but in the character. I remember seeing a tutorial where they put it in the controller, I think that was a mistake, because the sensing component wasn’t rotating with the character. And it makes more sense in the character.

So this event is in the Character blueprint.

I have the same problem : the MoveTo command is never interrupting, even if a condition in a decorator of the root node changes (ie a player has been seen by the character, and should be chased).
It’s quite strange… as my player is able to go near the AI character while he’s walking from a point A to a point B, and this character will quietly walk to B and there only start to chase the player… :confused:

If you scroll down, you find the answer for his problem. If it doesn’t help you for some reason, please open a new question with your specific problem. (:

I’m marking this question as resolved to keep track of unsolved problems (:

If you still have a problem with your setup after Ghar last answer, feel free to reopen this question.

I’ve read everything, but I don’t find any suitable answer. The tree is “locked” in the MoveTo task until it’s done, and it would be useless to add a Stop Movement. Even if the condition in the decorator at the top of the tree is supposed to interrupt any subtree with a lower priority, it doesn’t happen, the bot keeps on walking until the end.
Did I miss something that could allow me to stop the execution of MoveTo - even if the move target hasn’t been reached - whenever a specific BB data has been changed?