0
Answered

Wait Till Complete not working

Crispy 3 weeks ago in Behavior updated by Marti (Lead Developer) 3 weeks ago 1

Very simple tree:

Left Task:

Right Task:

I want the zombie to finish its attack, but this is what happens: https://streamable.com/36hmt

Unity version:
2018.4.11f1
Game Creator version:
1.0.4

Answer

Answer
Answered

This is actually how it should work. Nodes on the far left take higher priority in the standard behavior tree implementation; so if the distance between the enemy and the player is lower than a certain threshold, it will stop whatever it's doing and jump to the higher priority node.

In order to lock the animation clip, you'll need to make use of a Blackboard variable. Create a boolean variable called "is-attacking" and set it to true before playing the gesture and revert to false when the enemy completes the animation. Also, on the Condition that checks the distance between the player and the enemy, add also a variable check whether the enemy is attacking or not.

This should be a good solution.

Answer
Answered

This is actually how it should work. Nodes on the far left take higher priority in the standard behavior tree implementation; so if the distance between the enemy and the player is lower than a certain threshold, it will stop whatever it's doing and jump to the higher priority node.

In order to lock the animation clip, you'll need to make use of a Blackboard variable. Create a boolean variable called "is-attacking" and set it to true before playing the gesture and revert to false when the enemy completes the animation. Also, on the Condition that checks the distance between the player and the enemy, add also a variable check whether the enemy is attacking or not.

This should be a good solution.