Hey ,
I’m having some trouble getting the CancelAbility task to perform how I’d expect.
I’m using an active ability called HealOverTime to play some effects, add a tag to the player and play a looping passive ability on the player called RegenerateHealth. For the passive ability, I want to use the CancelAbility task to check if the player is at full health, if not it keeps looping and healing, if they are then cancel the RegenerateHealth ability. I’m overriding the ShouldCancelAbility function in the abilitie’s event graph but can’t reach any breakpoints inside the blueprint. In the source, the task always exits after this line:
void UAblCancelAbilityTask::OnTaskStart(const TWeakObjectPtr<const UAblAbilityContext>& Context) const
{
check(Context.IsValid());
Super::OnTaskStart(Context);
TArray<TWeakObjectPtr<AActor>> TaskTargets;
GetActorsForTask(Context, TaskTargets);
for (TWeakObjectPtr<AActor> TargetActor : TaskTargets)
{
** if (TargetActor.IsValid())
{
continue;
}**
…
}
…
}
My target is self and the actor pointer is valid at this point (makes sense since it just continues then exits).
So I’m not sure if I’m misunderstanding the intended use of the cancel ability task or if it’s even sensible to use an active ability to add a passive ability and have it loop indefinitely in this way.