Download

[Help] [Gameplay Ability System] Give health to a wall piece? Multiple Attribute Set types?

I have a wall in my game that I want to give health to, so it can be damageable (and eventually be destroyed).

how can I do it though? I tried to do it with multiple attribute set types, but it seems you can’t capture attributes with 2 different types of attribute sets

It is possible to have multiple attribute sets, and its quite common to do.

I have HealthSet, DamageSet, MovementSet, WeaponSet.

From what I understood each ability system component can only use 1 type of attribute set. How are you using them for a character for example, which I assume needs HealthSet, DamageSet and MovementSet (if not WeaponSet as well) ?

I just add them to the ASC, i do mine via different methods than the norm, but in a nutshell, i just add them. ASC’s can have as many sets as you like. just not multiple of the same set, like two health sets. or if i had HealthSet and RegenHealthSet derives from HealthSet, i cant have both RegenHealthSet and HealthSet.

If you haven’t found this, it is helpful. GitHub - tranek/GASDocumentation: My understanding of Unreal Engine 4's GameplayAbilitySystem plugin with a simple multiplayer sample project.

Regarding your issue, I have multiple sets of attributes assigned

In the constructor (both inherit from UAttributeSet):



    AttributeCore = CreateDefaultSubobject<UAWAttributeCore>(TEXT("AWAttributeCore"));
    AttributeDamage = CreateDefaultSubobject<UAWAttributeDamage>(TEXT("AWAttributeDamage"));

In a UGameplayEffectExecutionCalculation (from an example project I modifed)

I can capture attributes using


        DEFINE_ATTRIBUTE_CAPTUREDEF(UAWAttributeCore, DefenseBase, Target, false);

        DEFINE_ATTRIBUTE_CAPTUREDEF(UAWAttributeDamage, Damage, Source, true);

        // Capture the Source's AttackPower. We do want to snapshot this at the moment we create the GameplayEffectSpec that will execute the damage.
        // (imagine we fire a projectile: we create the GE Spec when the projectile is fired. When it hits the target, we want to use the AttackPower at the moment
        // the projectile was launched, not when it hits).
        DEFINE_ATTRIBUTE_CAPTUREDEF(UAWAttributeDamage, AttackBase, Source, true);


TheKaosSpectrum - Nice! It took me a bit to refactor my code to use multiple attribute sets, but everything works now, thanks!
acxsasx - Yeah I’m aware of it. I am using it a lot!

Thanks for the explaining anyway though ^^