Conditional Abort Not Working

Denali95

New member
I have a selector and two sequences, each starting with a conditional. If my right sequence has a lower priority conditional abort, shouldn't it interrupt the right sequence while it's executing if it turns out to be true? This behavior doesn't seem to be working (it continues to run "Seek" in the right branch).
 
I'm hoping that when my conditional "Health Check" becomes true, I can play a quick animation that interrupts all other action. For context, this is a "Stagger" animation that plays when the player hits the enemy multiple times in quick succession.
 

Attachments

  • behaviortreew.PNG
    behaviortreew.PNG
    114.3 KB · Views: 18
You have a priority selector parented to the conditional branches which is going to cause problems. You should instead use a regular selector.
 
I changed out the selector type but still have an issue. What abort type should be on the Sequences to enable the left most condition to abort any of the right ones? Shouldn't it be the left most sequence has a lower priority abort, and then the right branch has a self abort or am I misunderstanding?
 
Could part of the issue come down to the fact that the task that the right branch seems to be unable from exiting is a "running" task, so the behavior tree is not re-running its checks until that finishes? If I let the branch to the right finish, it will proceed to the conditional abort left branch, but I'd like it to interrupt the running behavior.
 
I retired this with a Within Distance conditional, and I was able to get the abort to work. One issue I seem to be running into is that my conditional is true for a second, then not true, causing the conditional to exit.

Essentially, what I'm doing is checking if 4 hits have happened in the last 3 seconds, and if that's true, I want to run a stagger animation. I think the problem here is that the condition returns success, but then aborts a tick later when it's no longer true. Any thoughts on how best to approach this?

Here's my code:
public class HealthCheck : Conditional
{
public BossBehavior bossBehavior;
public float comboStart = 0;
public int limit = 4;

public override TaskStatus OnUpdate()
{
if (comboStart == 0)
{
comboStart = bossBehavior.timeOfHit;
}
if ((bossBehavior.timeOfHit - 3 > comboStart))
{
comboStart = 0;
}
else
{
if (bossBehavior.numHits >= limit)
{
Debug.Log("staggered");
shouldStagger = true;
bossBehavior.numHits = 0;
return TaskStatus.Success;
}
}
return TaskStatus.Failure;
}
}
 
Glad you are making progress.

Essentially, what I'm doing is checking if 4 hits have happened in the last 3 seconds, and if that's true, I want to run a stagger animation. I think the problem here is that the condition returns success, but then aborts a tick later when it's no longer true. Any thoughts on how best to approach this?
Conditional aborts will trigger whenever the status changes from success to failure or failure to success. If you don't want the conditional abort to be reevaluated when the same branch is running as the conditional task then you should use a lower priority abort instead of a self or both abort type.
 
Top