I’m trying to make a hack and slash single player and I recently came across gameplay abilities and thought its perfect for the type of game I’m making.
So I tried to create the initial setup that looks like this
#pragma region Abilities
public:
UAbilitySystemComponent * GetAbilitySystemComponent() const override;
/** The component used to handle ability system interactions */
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Abilities, meta = (AllowPrivateAccess = "true"))
UAbilitySystemComponent* AbilitySystemComponent;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Abilities)
TSubclassOf<class UGameplayAbility> Ability;
/** List of attributes modified by the ability system */
UPROPERTY()
UCharacterAttributeSet* AttributeSet;
/** Passive gameplay effects applied on creation */
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Abilities")
TArray<TSubclassOf<UGameplayEffect>> PassiveGameplayEffects;
#pragma endregion
and in beginplay of the character i did this
Super::BeginPlay();
if (AbilitySystemComponent)
{
if (HasAuthority() && Ability)
{
AbilitySystemComponent->GiveAbility(FGameplayAbilitySpec(Ability.GetDefaultObject(), 1, 0));
}
AbilitySystemComponent->InitAbilityActorInfo(this, this);
}
also in blueprints begin play of character i did this
I’m doing the same thing in both begin play of C++ and in blueprints
I get true when i call tryactivateability in blueprint but the ability is never activated.
Even the montage I mentioned in the gameplayeffect is being played but ActivateAbility is never called.
this is how the gameplay ability looks, the print is not coming but the montage i assign is playing
I do have gameplay effect assigned to ability.
I’m returning true in CanActivateAbility in gameplay ability.
But the control is never coming to ActivateAbility event. I dont know what i’m missing.
Thanks.