FGameplayEffectSpec

GameplayEffect Specification.

Windows
MacOS
Linux

References

Module

GameplayAbilities

Header

/Engine/Plugins/Runtime/GameplayAbilities/Source/GameplayAbilities/Public/GameplayEffect.h

Include

#include "GameplayEffect.h"

Syntax

[USTRUCT](Programming/UnrealArchitecture/Reference/Structs)([BlueprintType](Programming/UnrealArchitecture/Reference/Structs/Specifiers/BlueprintType))
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

Name Description

Public variable UProperty notreplicated

uint32: 1

 

bCompletedSourceAttributeCapture

Whether the spec has had its source attribute capture completed or not yet

Public variable UProperty notreplicated

uint32: 1

 

bCompletedTargetAttributeCapture

Whether the spec has had its target attribute capture completed or not yet

Public variable UProperty notreplicated

uint32: 1

 

bDurationLocked

Whether the duration of the spec is locked or not; If it is, attempts to set it will fail

Public variable UProperty notreplicated

FGameplayEffect...

 

CapturedRelevantAttributes

Attributes captured by the spec that are relevant to custom calculations, potentially in owned modifiers, etc.; NOT replicated to clients

Public variable UProperty notreplicated

FTagContainerAg...

 

CapturedSourceTags

Captured Source Tags on GameplayEffectSpec creation

Public variable UProperty notreplicated

FTagContainerAg...

 

CapturedTargetTags

Tags from the target, captured during execute

Public variable UProperty

float

 

ChanceToApplyToTarget

The chance, in a 0.0-1.0 range, that this GameplayEffect will be applied to the target Attribute or GameplayEffect

Public variable UProperty

const UGameplay...

 

Def

GameplayEfect definition. The static data that this spec points to.

Public variable UProperty

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

Public variable UProperty

FGameplayTagCon...

 

DynamicAssetTags

Tags that are on this effect spec and that did not come from the UGameplayEffect def.

Public variable UProperty

FGameplayTagCon...

 

DynamicGrantedTags

Tags that are granted and that did not come from the UGameplayEffect def.

Public variable UProperty

TArray< FGamepl...

 

GrantedAbilitySpecs

List of abilities granted by this effect

Public variable UProperty

TArray< FGamepl...

 

ModifiedAttributes

A list of attributes that were modified during the application of this spec

Public variable UProperty

TArray< FModifi...

 

Modifiers

The calcuated modifiers for this effect

Public variable UProperty

float

 

Period

The period in seconds of this effect, nonperiodic effects should have a period of FGameplayEffectConstants::NO_PERIOD

Public variable

TMap< FName, fl...

 

SetByCallerNameMagnitudes

Map of set by caller magnitudes

Public variable

TMap< FGameplay...

 

SetByCallerTagMagnitudes

Public variable UProperty

int32

 

StackCount

Total number of stacks of this effect

Public variable

TArray< FGamepl...

 

TargetEffectSpecs

Other effects that need to be applied to the target if this effect is successful

Constructors

Name Description

Public function

FGameplayEffectSpec()

IMPORTANT: Any state added to FGameplayEffectSpec must be handled in the move/copy constructor/operator!

Public function

FGameplayEffectSpec

(
    const FGameplayEffectSpec& Other
)

Public function

FGameplayEffectSpec

(
    FGameplayEffectSpec&& Other
)

Public function

FGameplayEffectSpec

(
    const FGameplayEffectSpec& Other,
    const FGameplayEffectContextHandle ...
)

Public function

FGameplayEffectSpec

(
    const UGameplayEffect* InDef,
    const FGameplayEffectContextHandle ...,
    float Level
)

Functions

Name Description

Public function

FGameplayEff...

 

AddModifiedAttribute

(
    const FGameplayAttribute& Attribut...
)

Adds a new modified attribute struct, will always add so check to see if it exists first

Public function Const

bool

 

AttemptCalculateDurationFromDef

(
    OUT float& OutDefDuration
)

Helper function to attempt to calculate the duration of the spec from its GE definition

Public function Const

float

 

CalculateModifiedDuration()

Helper function that returns the duration after applying relevant modifiers from the source and target ability system components

Public function

void

 

CalculateModifierMagnitudes()

Fills out the modifier magnitudes inside the Modifier Specs

Public function

void

 

CaptureAttributeDataFromTarget

(
    UAbilitySystemComponent* Targe...
)

Public function

void

 

CopySetByCallerMagnitudes

(
    const FGameplayEffectSpec& Origina...
)

Copies SetbyCallerMagnitudes from OriginalSpec into this

Public function

void

 

DuplicateEffectContext()

Public function Const

void

 

GetAllAssetTags

(
    OUTFGameplayTagContainer& Containe...
)

Appends all tags that apply to this gameplay effect spec

Public function Const

void

 

GetAllGrantedTags

(
    OUTFGameplayTagContainer& Containe...
)

Appends all tags granted by this gameplay effect spec

Public function Const

float

 

GetChanceToApplyToTarget()

Public function Const

FGameplayEff...

 

GetContext()

Public function Const

float

 

GetDuration()

Public function Const

const FGamep...

 

GetEffectContext()

Public function Const

float

 

GetLevel()

Public function Const

const FGamep...

 

GetModifiedAttribute

(
    const FGameplayAttribute& Attribut...
)

Looks for an existing modified attribute struct, may return NULL

Public function

FGameplayEff...

 

GetModifiedAttribute

(
    const FGameplayAttribute& Attribut...
)

Looks for an existing modified attribute struct, may return NULL

Public function Const

float

 

GetModifierMagnitude

(
    int32 ModifierIdx,
    bool bFactorInStackCount
)

Get the computed magnitude of the modifier on the spec with the specified index

Public function Const

float

 

GetPeriod()

Public function Const

float

 

GetSetByCallerMagnitude

(
    FName DataName,
    bool WarnIfNotFound,
    float DefaultIfNotFound
)

Returns the magnitude of a SetByCaller modifier.

Public function Const

float

 

GetSetByCallerMagnitude

(
    FGameplayTag DataTag,
    bool WarnIfNotFound,
    float DefaultIfNotFound
)

Returns the magnitude of a SetByCaller modifier.

Public function Const

bool

 

HasValidCapturedAttributes

(
    const TArray< FGameplayEffectAttrib...
)

Determines if the spec has capture specs with valid captures for all of the specified definitions.

Public function

void

 

Initialize

(
    const UGameplayEffect* InDef,
    const FGameplayEffectContextHandle ...,
    float Level
)

Can be called manually but it is preferred to use the 3 parameter constructor

Public function

void

 

InitializeFromLinkedSpec

(
    const UGameplayEffect* InDef,
    const FGameplayEffectSpec& Origina...
)

Initialize the spec as a linked spec.

Public function

void

 

MergeSetByCallerMagnitudes

(
    const TMap< FGameplayTag, float >&...
)

Copies SetbuCallerMagnitudes, but only if magnitudes don't exist in our map (slower but preserves data)

Public function Const

void

 

PrintAll()

Public function

void

 

RecaptureAttributeDataForClone

(
    UAbilitySystemComponent* Origi...,
    UAbilitySystemComponent* NewAS...
)

Recapture attributes from source and target for cloning

Public function

void

 

RecaptureSourceActorTags()

Recaptures source actor tags of this spec without modifying anything else

Public function

void

 

SetContext

(
    FGameplayEffectContextHandle NewEff...
)

Set the context info: who and where this spec came from.

Public function

void

 

SetDuration

(
    float NewDuration,
    bool bLockDuration
)

Sets duration.

Public function

void

 

SetLevel

(
    float InLevel
)

Public function

void

 

SetSetByCallerMagnitude

(
    FName DataName,
    float Magnitude
)

Sets the magnitude of a SetByCaller modifier

Public function

void

 

SetSetByCallerMagnitude

(
    FGameplayTag DataTag,
    float Magnitude
)

Sets the magnitude of a SetByCaller modifier

Public function

void

 

SetupAttributeCaptureDefinitions()

Helper function to initialize all of the capture definitions required by the spec

Public function Const

FString

 

ToSimpleString()

Operators

Name Description

Public function

FGameplayEff...

 

operator=

(
    const FGameplayEffectSpec& Other
)

Public function

FGameplayEff...

 

operator=

(
    FGameplayEffectSpec&& Other
)

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss