Not logged in - Login
< back

PreGameplayEffectExecute

Overriding PreGameplayEffectExecute in your class derived from UAttributeSet will allow you to modify incoming Gameplay Effect magnitudes before they are applied. This is a great place to modify incoming transient attributes like Damage, Healing, etc.

PreGameplayEffectExecute only runs on the server side.

How to check the incoming attribute type

UProperty *DamageProperty = FindFieldChecked>UProperty<(UOWSAttributeSet::StaticClass(),FindFieldChecked<UProperty>(UOWSAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED(UOWSAttributeSet, Damage));
UProperty* ModifiedProperty = Data.EvaluatedData.Attribute.GetUProperty();

// Is Damage about to be applied?
if (DamageProperty == ModifiedProperty)
{

}

In this example UOWSAttributeSet is the name of your derived class.

How to check if the incoming Gameplay Effect has a certain Asset tag

FGameplayTagContainer EffectTags;
Data.EffectSpec.GetAllAssetTags(EffectTags);

FName ElectricDamageTagName = FName(TEXT("Combat.DamageTypes.Electric"));
FGameplayTag ElectricDamageTag = UGameplayTagsManager::Get().RequestGameplayTag(ElectricDamageTagName);

if (EffectTags.HasTag(ElectricDamageTag))
{

}