Navigation
API > API/Plugins > API/Plugins/GameplayAbilities
References
| Module | GameplayAbilities |
| Header | /Engine/Plugins/Runtime/GameplayAbilities/Source/GameplayAbilities/Public/GameplayEffect.h |
| Include | #include "GameplayEffect.h" |
Syntax
USTRUCT&40;BlueprintType&41;
struct FGameplayEffectSpec
Remarks
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.
Variables
| Type | Name | Description | |
|---|---|---|---|
| uint32: 1 | bCompletedSourceAttributeCapture | Whether the spec has had its source attribute capture completed or not yet | |
| uint32: 1 | bCompletedTargetAttributeCapture | Whether the spec has had its target attribute capture completed or not yet | |
| uint32: 1 | bDurationLocked | Whether the duration of the spec is locked or not; If it is, attempts to set it will fail | |
| FGameplayEffectAttributeCaptureSpecContainer | CapturedRelevantAttributes | Attributes captured by the spec that are relevant to custom calculations, potentially in owned modifiers, etc.; NOT replicated to clients | |
| FTagContainerAggregator | CapturedSourceTags | Captured Source Tags on GameplayEffectSpec creation | |
| FTagContainerAggregator | CapturedTargetTags | Tags from the target, captured during execute | |
| TObjectPtr< const UGameplayEffect > | Def | GameplayEfect definition. The static data that this spec points to. | |
| float | Duration | 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 | |
| FGameplayTagContainer | DynamicGrantedTags | Tags that are granted and that did not come from the UGameplayEffect def. | |
| TArray< FGameplayEffectModifiedAttribute > | ModifiedAttributes | A list of attributes that were modified during the application of this spec | |
| TArray< FModifierSpec > | Modifiers | The calculated modifiers for this effect | |
| float | Period | The period in seconds of this effect, nonperiodic effects should have a period of FGameplayEffectConstants::NO_PERIOD | |
| TMap< FName, float > | SetByCallerNameMagnitudes | Map of set by caller magnitudes | |
| TMap< FGameplayTag, float > | SetByCallerTagMagnitudes |
Constructors
| Type | Name | Description | |
|---|---|---|---|
| IMPORTANT: Any state added to FGameplayEffectSpec must be handled in the move/copy constructor/operator! | |||
FGameplayEffectSpec
(
const FGameplayEffectSpec& Other |
|||
FGameplayEffectSpec
(
FGameplayEffectSpec&& Other |
|||
FGameplayEffectSpec
(
const FGameplayEffectSpec& Other, |
|||
FGameplayEffectSpec
(
const UGameplayEffect* InDef, |
Functions
| Type | Name | Description | |
|---|---|---|---|
| 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 | |
| FGameplayEffectModifiedAttribute * | AddModifiedAttribute
(
const FGameplayAttribute& Attribute |
Adds a new modified attribute struct, will always add so check to see if it exists first | |
| 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 | |
| bool | AttemptCalculateDurationFromDef
(
float& OutDefDuration |
Helper function to attempt to calculate the duration of the spec from its GE definition | |
| float | Helper function that returns the duration after applying relevant modifiers from the source and target ability system components | ||
| void | Fills out the modifier magnitudes inside the Modifier Specs | ||
| void | CaptureAttributeDataFromTarget
(
UAbilitySystemComponent* TargetAbilitySystemComponent |
||
| void | CopySetByCallerMagnitudes
(
const FGameplayEffectSpec& OriginalSpec |
Copies SetbyCallerMagnitudes from OriginalSpec into this | |
| void | |||
| void | GetAllAssetTags
(
FGameplayTagContainer& OutContainer |
Appends all tags that apply to this gameplay effect spec | |
| void | GetAllBlockedAbilityTags
(
FGameplayTagContainer& OutContainer |
Appends all blocked ability tags granted by this gameplay effect spec | |
| void | GetAllGrantedTags
(
FGameplayTagContainer& OutContainer |
Appends all tags granted by this gameplay effect spec | |
| FGameplayEffectContextHandle | GetContext () |
||
| float | GetDuration () |
||
| const FGameplayTagContainer & | Simple const accessor to the dynamic asset tags | ||
| const FGameplayEffectContextHandle & | |||
| float | GetLevel () |
||
| FGameplayEffectModifiedAttribute * | GetModifiedAttribute
(
const FGameplayAttribute& Attribute |
Looks for an existing modified attribute struct, may return NULL | |
| const FGameplayEffectModifiedAttribute * | GetModifiedAttribute
(
const FGameplayAttribute& Attribute |
Looks for an existing modified attribute struct, may return NULL | |
| float | GetModifierMagnitude
(
int32 ModifierIdx, |
Get the computed magnitude of the modifier on the spec with the specified index | |
| float | GetPeriod () |
||
| float | GetSetByCallerMagnitude
(
FGameplayTag DataTag, |
Returns the magnitude of a SetByCaller modifier. | |
| float | GetSetByCallerMagnitude
(
FName DataName, |
Returns the magnitude of a SetByCaller modifier. | |
| int32 | Returns the stack count for this GE spec. | ||
| bool | HasValidCapturedAttributes
(
const TArray< FGameplayEffectAttributeCaptureDefinition >& InCaptureDefsToCheck |
Determines if the spec has capture specs with valid captures for all of the specified definitions. | |
| void | Initialize
(
const UGameplayEffect* InDef, |
Can be called manually but it is preferred to use the 3 parameter constructor | |
| void | InitializeFromLinkedSpec
(
const UGameplayEffect* InDef, |
Initialize the spec as a linked spec. | |
| void | MergeSetByCallerMagnitudes
(
const TMap< FGameplayTag, float >& Magnitudes |
Copies SetbuCallerMagnitudes, but only if magnitudes don't exist in our map (slower but preserves data) | |
| void | PrintAll () |
||
| void | RecaptureAttributeDataForClone
(
UAbilitySystemComponent* OriginalASC, |
Recapture attributes from source and target for cloning | |
| void | Recaptures source actor tags of this spec without modifying anything else | ||
| void | SetContext
(
FGameplayEffectContextHandle NewEffectContext, |
Set the context info: who and where this spec came from. | |
| void | SetDuration
(
float NewDuration, |
Sets duration. | |
| void | SetLevel
(
float InLevel |
||
| void | SetSetByCallerMagnitude
(
FName DataName, |
Sets the magnitude of a SetByCaller modifier | |
| void | SetSetByCallerMagnitude
(
FGameplayTag DataTag, |
Sets the magnitude of a SetByCaller modifier | |
| void | SetStackCount
(
int32 NewStackCount |
Sets the stack count for this GE to NewStackCount if stacking is supported. | |
| void | Helper function to initialize all of the capture definitions required by the spec | ||
| FString |
Operators
| Type | Name | Description | |
|---|---|---|---|
| FGameplayEffectSpec & | operator=
(
FGameplayEffectSpec&& Other |
||
| FGameplayEffectSpec & | operator=
(
const FGameplayEffectSpec& Other |
Deprecated Variables
| Type | Name | Description | |
|---|---|---|---|
| float | ChanceToApplyToTarget | This variable no longer has any effect. See UChanceToApplyGameplayEffectComponent | |
| FGameplayTagContainer | DynamicAssetTags | This member will be made private. Please use AddDynamicAssetTag, AppendDynamicAssetTags, or GetDynamicAssetTags as appropriate. Note that dynamic asset tag removal will no longer be supported. | |
| TArray< FGameplayAbilitySpecDef > | GrantedAbilitySpecs | This variable will be removed in favor of (immutable) GASpecs that live on GameplayEffectComponents (e.g. AbilitiesGameplayEffectComponent) | |
| int32 | StackCount | This member will be moved to private in the future. Use GetStackCount and SetStackCount. | |
| TArray< FGameplayEffectSpecHandle > | TargetEffectSpecs | These TargetEffectSpecs are not replicated, thus can only apply to the server. Use UAdditionalGameplayEffectComponent instead (or roll your own solution) |
Deprecated Functions
| Type | Name | Description | |
|---|---|---|---|
| float | This no longer applies. Use UChanceToApplyGameplayEffectComponent instead |