Download

GameplayEffect not capturing Owner Attributes from TargetData

I’ve been trying to utilise the Gameplay Ability system in 4.13, and even without support in prior questions here I’ve managed to get a solid system working from it with multiple Abilities. I cannot however get past this problem no matter what method I try.

On a server authorative, 1 player setup, I cannot utilise Source Attributes when firing a GameplayEffect from a GameplayAbility. If I utilise Target attributes, it all works well. However using Source attributes comes up blank. I’ve tried using the Ability ApplytoTarget, the Ability Make Outgoing Handle and ApplySpecToTarget, the Ability System Component ApplyToTarget, none of it works. I searched the forums and found something about the GameplayCueManager, but I’ve already set it up and it loads correctly in the logs.

Neither of these methods works:
1c50327bc831b9000295e21ec86c47fe6eb9edcd.png

Here’s how I’m declaring my Attributes (they are loading correctly, the Player attributes are used for HP correctly and the Spell attributes values do print to the log correctly)



UCLASS(Blueprintable)
class MAGEDUEL_API UPlayerAttributes : public UAttributeSet
{
	GENERATED_UCLASS_BODY()

public:
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category = "Attribute")
		FGameplayAttributeData baseHealth;
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category = "Attribute")
		FGameplayAttributeData health;
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category = "Attribute")
		FGameplayAttributeData maxSpellpower;
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category = "Attribute")
		FGameplayAttributeData spellpower;
};

UCLASS(Blueprintable)
class MAGEDUEL_API USpellAttributes : public UAttributeSet
{
	GENERATED_UCLASS_BODY()

public:
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category = "Attribute")
		FGameplayAttributeData currentSpellpower;
};


The gameplay effect is super simple:
7bb052c797e2dc4e9e1b43ead28ae372e8d90dbf.png

Any help from a developer/user familiar with the GameplayAbilities module would be incredibly helpful. I’ve been trying to solve this and have wasted hours upon hours just trying to get the Source Attributes from a GameplayEffect.

Been looking for a solution through how its applied, executed, replicated, I just can’t figure out how to provide a ‘Source’ actor/ability system for a GameplayEffect. There’s still no docs either, and the C++ headers/files don’t clue much in either.

Found the solution. My C++ Base Actor classes that had an AbilitySystemComponent did not implement the IAbilitySystemInterface or its virtual function, meaning the Source actor checks were not returning any AbilitySystem data. Also explained why half the helper functions weren’t working.

Heres an example of the correct C++ header declaration for actors that have an AbilitySystemComponent (meaning, your blueprint must be based off a C++ actor, since this interface isn’t Blueprint-ready yet):



UCLASS(Blueprintable)
class YOUR_API ABaseCharacter : public ACharacter, public IAbilitySystemInterface
{
	GENERATED_BODY()

public:
	// Sets default values for this character's properties
	ABaseCharacter();

	UPROPERTY(Category = AbilitySystem, VisibleAnywhere, BlueprintReadWrite)
		UAbilitySystemComponent* AbilitySystem;

	/** For Interface, Returns AbilitySystemComponent subobject **/
	virtual UAbilitySystemComponent* GetAbilitySystemComponent() const override { return AbilitySystem; };
}