Parallel Task Breaks Tree

chickenharm

New member
Hey all,

In my Behavior Tree, I want this enemy to go through a sequence that will use a random selector to have the enemy either shoot a projectile and walk, or just walk. But, while they're at this point in the tree, if the player is close enough I want the enemy to use their melee attack, without interrupting the projectile / walking sequence.

I've set up a Parallel task and then have two sequences underneath, one with an IsPlayerInRange conditional and another that goes the projectile / walking tasks. This works mostly fine, except if the player is not in range for the melee attack during the first time the Parallel task is called, the tree stops entirely and does not repeat the behavior flow.

any idea what I'm doing wrong? attached is section in question and the code for IsPlayerInRange conditional. thank you in advance!
 

Attachments

  • using melee if player in range.png
    using melee if player in range.png
    30.4 KB · Views: 3
  • IsPlayerInRange.cs
    774 bytes · Views: 0
The Parallel task will stop execution when a child task returns failure. If you want it to continue you can use the Parallel Selector.

With that said, I recommend using conditional aborts for this situation. This page has a good overview of a complete behavior tree, even if you aren't using our character controllers:

 
Top