How interrupt everything to go to Stun State

Matthew57

New member
Is there a way to jump anywhere in a tree (including Wait nodes) to a different branch, when an external event is called?
 
You can use the interrupt task and perform interruption tasks to stop executing a current branch. You can also use conditional aborts to stop a branch from running. Take a look at the RTS sample project for interrupt, and this video has an example of conditional aborts:

 
I looked at both the harvester and the Rocket soldier and neither of them use interrupts. This is my current tree. I want to restart the tree onStun (to the right) but have yet to find an example of getting that to trigger from an outside source.
BehaviorTree.JPG
 
Looks like you're right - I could have sworn there was an interrupt in the RTS example.

Anyway, in this case I think conditional aborts will be your better bet. Place the stun animation branch to the left on your idle/attack branch under the selector and add a Lower Priority conditional abort to the Stun Sequence selector. When Has Received Event evaluates to true it'll interrupt any lower priority branches (in this case, the idle/attack).
 
I just implemented this but am getting the same problem - it doesn't immediately jettison to the stun branch if it is in a wait node. It'll happen immediately afterward.

The wait is there to allow the attack animation to play before it does anything else. The use case I want is that a stun attack will interrupt the attack animation.
 
What does your tree look like? Is Has Received Event being reevaluated?

Assuming Has Received Event is being reevaluated the tree will switch to the stun branch and interrupt the current branch. This is very similar to the setup in the video above, just with more nodes.
 
You can remove the lower priority conditional abort on the selector, and then add it to the StunSequence.
 
Top