I going through setting up a basic AI but am having a bit of trouble with the transition from attacking to movement when the last enemy is killed. My understanding of the Selector node was that it would execute untl success then collapse up the tree ignoring un-executed tasks. This seems to work fine on the attacking side of my tree but not on the movement side of things.
As you can see my Behavior Tree uses a selector to execute two tasks. One finds the location it is going to go to and the other tells the character to move there. This in general works fine until one final use case where the last visible enemy is killed and the AI returns to the movement branch of the tree. They are technically still animating their attack so they need to delay just a little bit before moving again.
Every tick my pawn enters a gate and updates attack delay until it is <= 0 at that point the gate closes and the attack is ready to be used again because the animation has finished. I figured this number could be reused as a “isAttacking” queue.
To account for this delay before movement as well, I do a quick check at the end of my BTT_FindRoute. The pawn calculates how long is left on the animation (modified by attack speed buffs / debuffs which are not implemented yet so can be considered modifiers of 0) So, grabbing the AttackDelay from the pawn, I check if it’s <=0 If it is I finish execute with success false so it will execute the next node and allow movement. If it is not I finish execute with success true so it will collapse up and ignore the move to task.
However, it always does the move to regardless of which finish execute is used. Is my understand of how finish execute works incorrect? When collapsing up the tree does it not skip unexecuted tasks? Should this be done a different way all together?