UGBAAttributeSetBlueprintBase#

  • Declared in "Abilities/GBAAttributeSetBlueprintBase.h"
UCLASS(
NotBlueprintable)
class BLUEPRINTATTRIBUTES_API UGBAAttributeSetBlueprintBase : public UAttributeSet

Defines the set of all GameplayAttributes for your game.

Games should subclass this and add FGameplayAttributeData properties to represent attributes like health, damage, etc

AttributeSets are added to the actors as subobjects, and then registered with the AbilitySystemComponent It is often desired to have several sets per project that inherit from each other You could make a base health set, then have a player set that inherits from it and adds more attributes

Methods#

  • public
    • BeginDestroy&
    virtual void
  • UFUNCTION(​BlueprintCallable)

    virtual void
    ClampAttributeValue(​
    const FGameplayAttribute Attribute,
    float MinValue,
    float MaxValue
    )

    Clamps the Attribute from MinValue to MaxValue

    • GetAttributeBaseValue&
    float
    GetAttributeBaseValue(​
    const FGameplayAttribute& Attribute,
    bool& bSuccessfullyFoundAttribute
    ) const
    • GetAttributesMetaData&
    TMap<FString, TSharedPtr<FAttributeMetaData>>

    Getter to return current state of AttributesMetaData map

    • GetAttributeValue&
    float
    GetAttributeValue(​
    const FGameplayAttribute& Attribute,
    bool& bSuccessfullyFoundAttribute
    ) const
    • GetLifetimeReplicatedProps&
    virtual void
    GetLifetimeReplicatedProps(​
    TArray<FLifetimeProperty>& OutLifetimeProps
    ) const
    • HandleRepNotifyForGameplayAttribute&
    void
    HandleRepNotifyForGameplayAttribute(​
    FName InPropertyName
    )

    Internal implementation of Blueprint rep notifies GAMEPLAYATTRIBUTE_REPNOTIFY equivalent

  • UFUNCTION(​BlueprintCallable)

    void
    HandleRepNotifyForGameplayAttributeData(​
    const FGameplayAttributeData& InAttribute
    )

    To be called from Blueprint rep notifies for a given Gameplay Attribute Data member variable.

  • UFUNCTION(​BlueprintCallable)

    void

    To be called from Blueprint rep notifies for a given (Clamped) Gameplay Attribute Data member variable.

    • InitFromMetaDataTable&
    virtual void
    InitFromMetaDataTable(​
    const UDataTable* DataTable
    )

    Initializes attribute data from a meta DataTable.

    • IsGameplayAttributeDataClampedProperty&
    static bool
    IsGameplayAttributeDataClampedProperty(​
    const FProperty* Property
    )

    Returns true if the variable associated with Property is of type FGBAGameplayClampedAttributeData or one of its subclasses

  • UFUNCTION(​BlueprintCallable)

    FGameplayAbilityActorInfo
    K2_GetActorInfo(​) const

    Returns the Owner's Ability System Component cached data about the owning actor that abilities will need to frequently access (movement component, mesh component, anim instance, etc)

  • UFUNCTION(​BlueprintPure)

    float
    K2_GetAttributeBaseValue(​
    FGameplayAttribute Attribute,
    bool& bSuccessfullyFoundAttribute
    ) const

    Returns the base (as opposed to current) value of an Attribute.

  • UFUNCTION(​BlueprintPure)

    float
    K2_GetAttributeValue(​
    FGameplayAttribute Attribute,
    bool& bSuccessfullyFoundAttribute
    ) const

    Returns the current (as opposed to base) value of an Attribute.

  • UFUNCTION(​BlueprintCallable)

    UAbilitySystemComponent*

    Returns the Ability System Component of the Owning Actor

  • UFUNCTION(​BlueprintCallable)

    AActor*
    K2_GetOwningActor(​) const

    Gets information about owning actor

  • UFUNCTION(​BlueprintImplementableEvent)

    void
    K2_PostAttributeBaseChange(​
    const FGameplayAttribute& InAttribute,
    float OldValue,
    float NewValue
    ) const

    Called just after any modification happens to an attribute's base value right after aggregation (when an attribute aggregator exists).

  • UFUNCTION(​BlueprintImplementableEvent)

    void
    K2_PostAttributeChange(​
    const FGameplayAttribute& Attribute,
    float OldValue,
    float NewValue
    )

    Called just after any modification happens to an attribute.

  • UFUNCTION(​BlueprintImplementableEvent)

    void
    K2_PostGameplayEffectExecute(​
    const FGameplayAttribute& Attribute,
    const FGBAAttributeSetExecutionData& Data
    )

    Called just after a GameplayEffect is executed to modify the base value of an attribute. No more changes can be made.

  • UFUNCTION(​BlueprintImplementableEvent)

    void
    K2_PreAttributeBaseChange(​
    const FGameplayAttribute& InAttribute,
    float InValue,
    float& OutValue
    ) const

    This is called just before any modification happens to an attribute's base value when an attribute aggregator exists. This function should enforce clamping (presuming you wish to clamp the base value along with the final value in PreAttributeChange) This function should NOT invoke gameplay related events or callbacks. Do those in PreAttributeChange() which will be called prior to the final value of the attribute actually changing.

  • UFUNCTION(​BlueprintImplementableEvent)

    void
    K2_PreAttributeChange(​
    const FGameplayAttribute& InAttribute,
    float InValue,
    float& OutValue
    )

    Called just before any modification happens to an attribute. This is lower level than PreAttributeModify/PostAttribute modify.

  • UFUNCTION(​BlueprintNativeEvent)

    bool
    K2_PreGameplayEffectExecute(​
    const FGameplayAttribute& InAttribute,
    const FGBAAttributeSetExecutionData& InData
    )

    Called just before modifying the value of an attribute. AttributeSet can make additional modifications here.

  • UFUNCTION(​BlueprintCallable)

    void
    K2_SetAttributeValue(​
    FGameplayAttribute Attribute,
    float NewValue
    )

    Sets the base (as opposed to current) value of an Attribute.

    • OnAttributeAggregatorCreated&
    virtual void
    OnAttributeAggregatorCreated(​
    const FGameplayAttribute& Attribute,
    FAggregator* NewAggregator
    ) const

    Callback for when an FAggregator is created for an attribute in this set. Allows custom setup of FAggregator::EvaluationMetaData

    • PostAttributeBaseChange&
    virtual void
    PostAttributeBaseChange(​
    const FGameplayAttribute& Attribute,
    float OldValue,
    float NewValue
    ) const
    • PostAttributeChange&
    virtual void
    PostAttributeChange(​
    const FGameplayAttribute& Attribute,
    float OldValue,
    float NewValue
    )
    • PostGameplayEffectExecute&
    virtual void
    PostGameplayEffectExecute(​
    const FGameplayEffectModCallbackData& Data
    )
    • PreAttributeBaseChange&
    virtual void
    PreAttributeBaseChange(​
    const FGameplayAttribute& Attribute,
    float& OutValue
    ) const
    • PreAttributeChange&
    virtual void
    PreAttributeChange(​
    const FGameplayAttribute& Attribute,
    float& OutValue
    )
    • PreGameplayEffectExecute&
    virtual bool
    PreGameplayEffectExecute(​
    FGameplayEffectModCallbackData& Data
    )
    • PreNetReceive&
    virtual void
    • PrintDebug&
    virtual void
    PrintDebug(​)

    Print debug information to the log (only called at the end of InitFromMetaDataTable)

    • SetAttributeValue&
    void
    SetAttributeValue(​
    const FGameplayAttribute& Attribute,
    float NewValue
    ) const
  • protected
    • GetAllBlueprintReplicatedProps&
    void
    GetAllBlueprintReplicatedProps(​
    TArray<FProperty*>& OutProperties,
    EPropertyFlags InCheckFlag = CPF_Net
    ) const

    Returns all Blueprint member variables marked as replicated for this class

    • GetAllBlueprintReplicatedProps&
    void
    GetAllBlueprintReplicatedProps(​
    UClass* InClass,
    TArray<FProperty*>& OutProperties,
    EPropertyFlags InCheckFlag = CPF_Net
    ) const

    Equivalent of UBlueprintGeneratedClass::GetLifetimeBlueprintReplicationList() but returns a list of FProperty instead.

    • GetAttributeDataPropertyName&
    bool
    GetAttributeDataPropertyName(​
    const FGameplayAttributeData& InAttributeData,
    FString& OutPropertyName
    )

    Returns the property name of a given FGameplayAttributeData (or one of its child struct)

    • GetClampedValueForClampedProperty&
    float
    GetClampedValueForClampedProperty(​
    const FGameplayAttribute& Attribute,
    float InValue
    )

    Returns the new value for an attribute after clamping via FGBAGameplayClampedAttributeData defaults Min / Max values

    • GetClampedValueForMetaData&
    float
    GetClampedValueForMetaData(​
    const FGameplayAttribute& Attribute,
    float InValue
    )

    Returns the new value for an attribute after clamping via stored MetaData (from DataTable)

    • HasClampedMetaData&
    bool
    HasClampedMetaData(​
    const FGameplayAttribute& Attribute
    )

    Returns whether given Attribute has stored MetaData, and if it has valid clamping values

    • IsValidClampedProperty&
    bool
    IsValidClampedProperty(​
    const FGameplayAttribute& Attribute
    )

    Returns whether given Attribute is defined using a FGBAGameplayClampedAttributeData property, and if it has valid clamping values

Fields#

  • protected
    • AttributeDataRepMap&
    TMap<FString, TSharedPtr<FGameplayAttributeData>> AttributeDataRepMap

    Stores cached values of FGameplayAttributeData during a PostNetReceive() for use later on within rep notifies

    • AttributesMetaData&
    TMap<FString, TSharedPtr<FAttributeMetaData>> AttributesMetaData

    Stores cached values of FAttributeMetaData that was read from an initialization data table during InitFromMetaDataTable()

    • RepNotifierHandlerNames&
    static TMap<FString, FString> RepNotifierHandlerNames

    List of valid rep notify handler for GameplayAttributes (HandleRepNotify...). Key is the CPP type, Value is the function name.