How to execute two nodes in parallel in the behaviour tree

I have a behaviour tree for my enemy.

I have a task for my enemy - go closer to the player.

The problem is that the enemy picks a spot that is close to the player and goes to it. But the player in the meantime changes the location, for example, goes to meet the enemy. I would like to do something like … if the enemy is on the way to the player and the player approaches, shoot.

How do I do that?

Thank you for any help

can you show what’s inside the first task?
I guess the main issue might be there.
ofc all tree screenshots will be better

edit:

I assume you didn’t plug in the player ref to the AI move node. Instead you did a extra “get actor location ” for the target location.
if that’s the case just plug in the player ref to the target directly.
if you give it target reference it will continuously chase the target until reach the acceptance radius .

There is a first task:

Second:

Third:

I am using Target Actor property on MoveToClose task, and this property is Player from AI Ai Perception component.

Behavior tree is different than the usual blueprints. It has stricter priorities therefore it is actually not possible to execute multiple tasks at the same time. (Priorities are indicated by the numbers on each node’s corner) But if you want to have different functions working at the same time, why don’t you combine them in a single task and use sequences to achieve that objective? (I’m talking about the sequence node and not the one in the behavior tree)

As for your main objective, you can use decorators in a selector, and make the AI to move to that shooting task you mentioned if a blackboard key that’s a bool type variable changes it’s value. You can update that variable continuously in your AI controller blueprint.

Of course I can. But there is no event in Ai Perception component on player location change. There is only ENTER, LEAVE sight sence event.

You can store the player’s location by casting to your player, getting the actor location and assigning it’s location into a vector type variable. Then you can subtract that from the AI’s location, get the result’s vector length and check if it gets shorter.


is this part important to your gameplay?
if not,you can use it as target directly.