18{
19 Super::ExecuteTask(OwnerComp, NodeMemory);
20
21 const AAIController* AIController = OwnerComp.GetAIOwner();
22 if (!AIController)
23 {
24 return EBTNodeResult::Failed;
25 }
26
27 const APawn* ControllingPawn = AIController->GetPawn();
28 if (!ControllingPawn)
29 {
30 return EBTNodeResult::Failed;
31 }
32
33
34 UAbilitySystemComponent* ASC = UAbilitySystemGlobals::GetAbilitySystemComponentFromActor(ControllingPawn);
35 if (!ASC)
36 {
37 return EBTNodeResult::Failed;
38 }
39
40 FGameplayTagContainer TagContainer;
42
43 bool bSuccess = ASC->TryActivateAbilitiesByTag(TagContainer);
44
45
46 return bSuccess ? EBTNodeResult::Succeeded : EBTNodeResult::Failed;
47}
FGameplayTag AbilityTagToActivate
Definition BTTaskNode_ActivateAbility.h:25