Navigation
API > API/Plugins > API/Plugins/GameplayAbilities
GameplayEffect Specification. Tells us: -What UGameplayEffect (const data) -What Level -Who instigated
FGameplayEffectSpec is modifiable. We start with initial conditions and modifications be applied to it. In this sense, it is stateful/mutable but it is still distinct from an FActiveGameplayEffect which in an applied instance of an FGameplayEffectSpec.
| Name | FGameplayEffectSpec |
| Type | struct |
| Header File | /Engine/Plugins/Runtime/GameplayAbilities/Source/GameplayAbilities/Public/GameplayEffect.h |
| Include Path | #include "GameplayEffect.h" |
Syntax
USTRUCT (BlueprintType )
struct FGameplayEffectSpec
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FGameplayEffectSpec
(
FGameplayEffectSpec&& Other |
GameplayEffect.h | ||
FGameplayEffectSpec
(
const FGameplayEffectSpec& Other, |
GameplayEffect.h | ||
FGameplayEffectSpec
(
const UGameplayEffect* InDef, |
GameplayEffect.h | ||
FGameplayEffectSpec
(
const FGameplayEffectSpec& Other |
GameplayEffect.h | ||
| IMPORTANT: Any state added to FGameplayEffectSpec must be handled in the move/copy constructor/operator! | GameplayEffect.h |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| bCompletedSourceAttributeCapture | uint32 | Whether the spec has had its source attribute capture completed or not yet | GameplayEffect.h |
|
| bCompletedTargetAttributeCapture | uint32 | Whether the spec has had its target attribute capture completed or not yet | GameplayEffect.h |
|
| bDurationLocked | uint32 | Whether the duration of the spec is locked or not; If it is, attempts to set it will fail | GameplayEffect.h |
|
| CapturedRelevantAttributes | FGameplayEffectAttributeCaptureSpecContainer | Attributes captured by the spec that are relevant to custom calculations, potentially in owned modifiers, etc.; NOT replicated to clients | GameplayEffect.h |
|
| CapturedSourceTags | FTagContainerAggregator | Captured Source Tags on GameplayEffectSpec creation | GameplayEffect.h |
|
| CapturedTargetTags | FTagContainerAggregator | Tags from the target, captured during execute | GameplayEffect.h |
|
| ChanceToApplyToTarget | float | GameplayEffect.h | ||
| Def | TObjectPtr< const UGameplayEffect > | GameplayEfect definition. The static data that this spec points to. | GameplayEffect.h | |
| Duration | float | The duration in seconds of this effect instantaneous effects should have a duration of FGameplayEffectConstants::INSTANT_APPLICATION effects that last forever should have a duration of FGameplayEffectConstants::INFINITE_DURATION | GameplayEffect.h | |
| DynamicAssetTags | FGameplayTagContainer | Tags that are on this effect spec and that did not come from the UGameplayEffect def. | GameplayEffect.h | |
| DynamicGrantedTags | FGameplayTagContainer | Tags that are granted and that did not come from the UGameplayEffect def. | GameplayEffect.h | |
| GrantedAbilitySpecs | TArray< FGameplayAbilitySpecDef > | List of abilities granted by this effect | GameplayEffect.h | |
| ModifiedAttributes | TArray< FGameplayEffectModifiedAttribute > | A list of attributes that were modified during the application of this spec | GameplayEffect.h | |
| Modifiers | TArray< FModifierSpec > | The calculated modifiers for this effect | GameplayEffect.h | |
| Period | float | The period in seconds of this effect, nonperiodic effects should have a period of FGameplayEffectConstants::NO_PERIOD | GameplayEffect.h | |
| SetByCallerNameMagnitudes | TMap< FName, float > | Map of set by caller magnitudes | GameplayEffect.h | |
| SetByCallerTagMagnitudes | TMap< FGameplayTag, float > | GameplayEffect.h | ||
| StackCount | int32 | Total number of stacks of this effect | GameplayEffect.h | |
| TargetEffectSpecs | TArray< FGameplayEffectSpecHandle > | Other effects that need to be applied to the target if this effect is successful | GameplayEffect.h |
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| EffectContext | FGameplayEffectContextHandle | This tells us how we got here (who / what applied us) | GameplayEffect.h | |
| Level | float | The level this effect was applied at | GameplayEffect.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void AddDynamicAssetTag
(
const FGameplayTag& TagToAdd |
Dynamically add an asset tag not originally from the source GE definition; Added to DynamicAssetTags as well as injected into the captured source spec tags | GameplayEffect.h | |
FGameplayEffectModifiedAttribute * AddModifiedAttribute
(
const FGameplayAttribute& Attribute |
Adds a new modified attribute struct, will always add so check to see if it exists first | GameplayEffect.h | |
void AppendDynamicAssetTags
(
const FGameplayTagContainer& TagsToAppend |
Dynamically append asset tags not originally from the source GE definition; Added to DynamicAssetTags as well as injected into the captured source spec tags | GameplayEffect.h | |
bool AttemptCalculateDurationFromDef
(
float& OutDefDuration |
Helper function to attempt to calculate the duration of the spec from its GE definition | GameplayEffect.h | |
float CalculateModifiedDuration() |
Helper function that returns the duration after applying relevant modifiers from the source and target ability system components | GameplayEffect.h | |
void CalculateModifierMagnitudes() |
Fills out the modifier magnitudes inside the Modifier Specs | GameplayEffect.h | |
void CaptureAttributeDataFromTarget
(
UAbilitySystemComponent* TargetAbilitySystemComponent |
GameplayEffect.h | ||
void CopySetByCallerMagnitudes
(
const FGameplayEffectSpec& OriginalSpec |
Copies SetbyCallerMagnitudes from OriginalSpec into this | GameplayEffect.h | |
void DuplicateEffectContext() |
GameplayEffect.h | ||
void GetAllAssetTags
(
FGameplayTagContainer& OutContainer |
Appends all tags that apply to this gameplay effect spec | GameplayEffect.h | |
void GetAllBlockedAbilityTags
(
FGameplayTagContainer& OutContainer |
Appends all blocked ability tags granted by this gameplay effect spec | GameplayEffect.h | |
void GetAllGrantedTags
(
FGameplayTagContainer& OutContainer |
Appends all tags granted by this gameplay effect spec | GameplayEffect.h | |
float GetChanceToApplyToTarget() |
GameplayEffect.h | ||
FGameplayEffectContextHandle GetContext() |
GameplayEffect.h | ||
float GetDuration() |
GameplayEffect.h | ||
const FGameplayTagContainer & GetDynamicAssetTags() |
Simple const accessor to the dynamic asset tags | GameplayEffect.h | |
const FGameplayEffectContextHandle & GetEffectContext() |
GameplayEffect.h | ||
float GetLevel() |
GameplayEffect.h | ||
FGameplayEffectModifiedAttribute * GetModifiedAttribute
(
const FGameplayAttribute& Attribute |
GameplayEffect.h | ||
const FGameplayEffectModifiedAttribute * GetModifiedAttribute
(
const FGameplayAttribute& Attribute |
Looks for an existing modified attribute struct, may return NULL | GameplayEffect.h | |
float GetModifierMagnitude
(
int32 ModifierIdx, |
Get the computed magnitude of the modifier on the spec with the specified index | GameplayEffect.h | |
float GetModifierMagnitude
(
int32 ModifierIdx |
Get the computed magnitude of the modifier on the spec with the specified index | GameplayEffect.h | |
float GetPeriod() |
Returns the Period for the effect. If DurationPolicy is Instant this will forcibly return NO_PERIOD | GameplayEffect.h | |
float GetSetByCallerMagnitude
(
FName DataName, |
Returns the magnitude of a SetByCaller modifier. | GameplayEffect.h | |
float GetSetByCallerMagnitude
(
FGameplayTag DataTag, |
Returns the magnitude of a SetByCaller modifier. | GameplayEffect.h | |
int32 GetStackCount() |
Returns the stack count for this GE spec. | GameplayEffect.h | |
FVisualLogStatusCategory GrabVisLogStatus() |
GameplayEffect.h | ||
bool HasValidCapturedAttributes
(
const TArray< FGameplayEffectAttributeCaptureDefinition >& InCaptureDefsToCheck |
Determines if the spec has capture specs with valid captures for all of the specified definitions. | GameplayEffect.h | |
void Initialize
(
const UGameplayEffect* InDef, |
Can be called manually but it is preferred to use the 3 parameter constructor | GameplayEffect.h | |
void InitializeFromLinkedSpec
(
const UGameplayEffect* InDef, |
Initialize the spec as a linked spec. | GameplayEffect.h | |
void MergeSetByCallerMagnitudes
(
const TMap< FGameplayTag, float >& Magnitudes |
Copies SetbuCallerMagnitudes, but only if magnitudes don't exist in our map (slower but preserves data) | GameplayEffect.h | |
void PrintAll() |
GameplayEffect.h | ||
void RecaptureAttributeDataForClone
(
UAbilitySystemComponent* OriginalASC, |
Recapture attributes from source and target for cloning | GameplayEffect.h | |
void RecaptureSourceActorTags() |
Recaptures source actor tags of this spec without modifying anything else | GameplayEffect.h | |
void SetContext
(
FGameplayEffectContextHandle NewEffectContext, |
Set the context info: who and where this spec came from. | GameplayEffect.h | |
void SetDuration
(
float NewDuration, |
Sets duration. | GameplayEffect.h | |
void SetLevel
(
float InLevel |
GameplayEffect.h | ||
void SetSetByCallerMagnitude
(
FName DataName, |
Sets the magnitude of a SetByCaller modifier | GameplayEffect.h | |
void SetSetByCallerMagnitude
(
FGameplayTag DataTag, |
Sets the magnitude of a SetByCaller modifier | GameplayEffect.h | |
void SetStackCount
(
int32 NewStackCount |
Sets the stack count for this GE to NewStackCount if stacking is supported. | GameplayEffect.h | |
void SetupAttributeCaptureDefinitions() |
Helper function to initialize all of the capture definitions required by the spec | GameplayEffect.h | |
FString ToSimpleString() |
GameplayEffect.h |
Operators
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FGameplayEffectSpec & operator=
(
FGameplayEffectSpec&& Other |
GameplayEffect.h | ||
FGameplayEffectSpec & operator=
(
const FGameplayEffectSpec& Other |
GameplayEffect.h |