I am trying to set up the ability class that will activate the ability when a specific GameplayEffect is triggered. I add the AbilityTrigger OnGiveAbility.
void UBaseGameplayAbility::OnGiveAbility(const FGameplayAbilityActorInfo* ActorInfo, const FGameplayAbilitySpec& Spec)
{
// Always call the Super implementation
Super::OnGiveAbility(ActorInfo, Spec);
// Add the trigger to the ability instance
FAbilityTriggerData TriggerData;
TriggerData.TriggerTag = GameplayTags::Ability_Activation_AutoFire;
TriggerData.TriggerSource = EGameplayAbilityTriggerSource::GameplayEvent;
AbilityTriggers.Add(TriggerData);
// Check if the trigger already exists to prevent duplication (Good practice)
bool bTriggerExists = false;
// --- CRITICAL LOGGING STEP ---
// Log to confirm the trigger was successfully added to the spec's list.
for (const FAbilityTriggerData& Trigger : AbilityTriggers)
{
if (Trigger.TriggerTag == GameplayTags::Ability_Activation_AutoFire)
{
UE_LOG(LogTemp, Warning,
TEXT("Ability %s successfully registered Trigger: %s (Source: %s)"),
*GetName(),
*Trigger.TriggerTag.ToString(),
*UEnum::GetValueAsString(Trigger.TriggerSource)
);
return; // Once confirmed, exit
}
}
}
So I check that ability triggers are granted in my logs, all good here.
Inside my Character class, I tried different ways to trigger abilities with events, but no trigger actually goes to ActivateAbility.
FGameplayEventData Payload;
AbilitySystemComponent->HandleGameplayEvent(GameplayTags::Ability_Activation_AutoFire, &Payload);
// OR
UAbilitySystemBlueprintLibrary::SendGameplayEventToActor(this, GameplayTags::Ability_Activation_AutoFire, Payload);
I also tried to apply tags to the Character, but nothing triggers the ability Activation. I am totally lost on it at the moment.
I am able to trigger the abilities from the same place by activation call, but not with events. And there are no good tools to check out how the event is triggered and processed.
If anyone has an idea about what I may be missing, I would appreciate it, as I have been stuck on this for a few days now.