Best practice to stop ability when interrupted

longshotsg

New member
Hi,

I was wondering what's the best practice to stop an ability that does for example clapping hands on the spot, if a lower priority left branch interrupts it.
Just a simple basic example, there are 4 branches under a sequence task.
In the 4th branch, it does 3 things.
1) Start clapping ability
2) Wait for 5 seconds
3) Stop clapping ability.

While in the 2nd task waiting for 5 seconds, a left lower priority branch (say branch 2) interrupts it, the ability will not be stopped and branch 2 will start to execute its child tasks.
Right now, I can put a stop ability(always success) as the first child tasks of EACH of the 3 branches to the left, but there should be a better way to do this?
It will get a lot messier if we have more abilities to start.

Things I have tried:
1) Add a check of "Moving is false" in the transition to the clapping animation but it doesn't work. As I wanted the ability to stop if it starts walking again.
2) Automatic stop type in the ability stops the ability almost immediately after it started.

Appreciate any help, thanks.
 
issueBehavior.png

Hi Justin,

As indicated, if the branch 2(red) starts an ability and before it can stop due to the wait, branch 1 of lower priority(green) interrupts it, then the ability in branch 2 will not be stopped.
One solution as I mentioned is to put a always stop ability task in branch 1 but they will be very messy.

Any recommended solution or better approach?
Thanks.
 
Thanks. In cases like that you'll I have a set of tasks which perform the reset in case of a conditional abort. You can see this in action with the Deathmatch AI Kit tree - as an example the search branch will reset the necessary variables in case of an abort.


You could do something similar where you stop the ability before performing the seek.
 
This does not really address the issue as it is resetting at the lowest priority branch(rightmost branch). If there is a conditional abort, it will never reach the lowest priority branch till sometime later.
But you do give me an idea what I can do.
Most probably creating a custom task and passing the strings of abilities that I want to force turn off, so that I have one task instead of multiple tasks.
Thanks.
 
Top