How to get two tasks at the same time in a behavior tree?

I am looking for a way to run a task at the same time as any other tasks.
That is, for the moment I have managed to execute only one task at a time.
(Task1 OR Task2 OR Task3)

But I want to get behavior like this
Task0 AND (Task 1 OR Task 2 OR Task 3)

In short I want my AI to be able to shoot while it does anything else.

I am trying with a simple parallel node but I am not getting the desired behavior. in fact it works even worse.

So, how should the tree be structured to achieve that behavior?

Thank you very much!!

Hi there,

Check if the both condition checks inside your shoot task should be set to true. Also check if this shoot task logic ends with a “finish execute” set to true.

You could also convert you shoot task into a service and stack it up in all three cube branches and remove the “simple parallel” node. But I see a potential flaw in this approach given that you enemies should “keep focus” at player while shooting, otherwise they will be shooting backwards if that makes sense. If you examine the Lyra Starter Game, the behavior tree uses a logic which enemies will stop shooting before switching to other tasks, and thus “clear focus” is called.

2 Likes

Thank you so much!!

2 Likes

Glad it helps. Keep up the good work.

2 Likes