Skip to content

Derived Attribute GE (UMIPDerivedAttributeGE)

Overview

UMIPDerivedAttributesGE is an Infinite UGameplayEffect that continuously drives every derived combat stat from the character's five primary attributes. It uses GAS's built-in Attribute Based modifier type — no C++ execution calculation is needed. Because the modifiers reference live attribute values (non-snapshotted), derived stats automatically recompute whenever a primary attribute changes (level up, buff, equipment bonus, etc.).

The GE is applied once at character initialisation and lives for the lifetime of the ASC. It targets the same actor it is applied to (AttributeSource = Target).

All paths below are relative to Plugins/ModularInventoryPlus/Source/ModularInventoryPlus/.


Key Classes & Files

Class File
UMIPDerivedAttributesGE Public/AbilitySystem/GameplayEffects/MIPDerivedAttributesGE.h
UMIPWithPrimaryAttributeSet Public/AbilitySystem/Attributes/MIPWithPrimaryAttributeSet.h
UMIPWithDerivedAttributeSet Public/AbilitySystem/Attributes/MIPWithDerivedAttributeSet.h
MIPBaseAttributeSet Public/AbilitySystem/Attributes/MIPBaseAttributeSet.h

Primary Attributes (source)

Defined on UMIPWithPrimaryAttributeSet — the backing inputs for all derived formulas.

Attribute Symbol Role
Strength STR Physical power
Intelligence INT Magical power & magic defence
Agility AGI Attack cadence
Vitality VIT Survivability (HP, defence, regen)
Precision PRC Hit chance & critical potential

Derived Attribute Formulas

The GE ships with ten Additive modifiers. Each modifier is MagnitudeCalculationType = AttributeBased with a configurable Coefficient. GAS evaluates each modifier as:

DerivedAttribute += Coefficient × PrimaryAttribute.CurrentValue

Because the modifier operation is Additive (not Multiply), and the GE is the only source driving these derived attributes from zero, the effective formula is simply:

DerivedAttribute = Coefficient × PrimaryAttribute

Offensive

Derived Attribute Set Backing Primary Coefficient Effective Formula
PhysicalAttack MIPWithDerivedAttributeSet Strength 1.0 PhysicalAttack = Strength
MagicalAttack MIPWithDerivedAttributeSet Intelligence 1.0 MagicalAttack = Intelligence
AttackSpeed MIPWithDerivedAttributeSet Agility 0.01 AttackSpeed = Agility × 0.01
Accuracy MIPWithDerivedAttributeSet Precision 0.1 Accuracy = Precision × 0.1

Defensive

Derived Attribute Set Backing Primary Coefficient Effective Formula
PhysicalDefense MIPWithDerivedAttributeSet Vitality 0.5 PhysicalDefense = Vitality × 0.5
MagicalDefense MIPWithDerivedAttributeSet Intelligence 0.5 MagicalDefense = Intelligence × 0.5

Critical

Derived Attribute Set Backing Primary Coefficient Effective Formula
CriticalChance MIPWithDerivedAttributeSet Precision 0.01 CriticalChance = Precision × 0.01
CriticalDamage MIPWithDerivedAttributeSet Precision 0.02 CriticalDamage = Precision × 0.02

Vitals (from MIPBaseAttributeSet)

Derived Attribute Set Backing Primary Coefficient Effective Formula
MaxHealth MIPBaseAttributeSet Vitality 10.0 MaxHealth = Vitality × 10
HealthRegeneration MIPBaseAttributeSet Vitality 0.1 HealthRegeneration = Vitality × 0.1

Worked Examples

Given a character with STR 50 / INT 40 / AGI 80 / VIT 60 / PRC 100:

Derived Stat Calculation Result
PhysicalAttack 50 × 1.0 50
MagicalAttack 40 × 1.0 40
AttackSpeed 80 × 0.01 0.80
Accuracy 100 × 0.1 10.0
PhysicalDefense 60 × 0.5 30
MagicalDefense 40 × 0.5 20
CriticalChance 100 × 0.01 1.0
CriticalDamage 100 × 0.02 2.0
MaxHealth 60 × 10.0 600
HealthRegeneration 60 × 0.1 6.0

GAS Configuration Reference

The modifier block below is the verbatim content of the GE asset's Modifiers array. Each entry follows the standard GAS Attribute Based modifier pattern.

Field Value Notes
Duration Policy Infinite Never expires; lives as long as the ASC does
MagnitudeCalculationType AttributeBased No custom MMC or ExecCalc required
AttributeSource Target Reads the primary attribute from the GE target (self)
bSnapshot false (default) Re-evaluates live whenever the primary attribute changes
ModifierOp Additive Adds the result to the derived attribute's current value

Non-snapshotted means live updates

Because bSnapshot is false, the derived attribute recalculates automatically the moment its backing primary attribute changes — no manual refresh, no secondary GE needed.

Order of application matters

Apply UMIPDerivedAttributesGE after the primary attributes have been initialised (e.g. after the level-up GE or base stat init GE). Applying it before primary attributes are set will compute derived values from 0.


How to Apply

Apply the GE once from C++ or Blueprint during character initialisation — typically in PostInitializeComponents, BeginPlay, or PossessedBy (server only):

// C++ — server only, called after primary attribute init
if (UAbilitySystemComponent* ASC = GetAbilitySystemComponent())
{
    FGameplayEffectContextHandle Context = ASC->MakeEffectContext();
    FGameplayEffectSpecHandle Spec = ASC->MakeOutgoingSpec(
        UMIPDerivedAttributesGE::StaticClass(), 1.f, Context);
    ASC->ApplyGameplayEffectSpecToSelf(*Spec.Data.Get());
}

In Blueprint use Apply Gameplay Effect to Self with UMIPDerivedAttributesGE as the effect class, level 1, and no additional modifiers.


Modifying a Coefficient

All coefficient values live in the GE asset's Modifiers array in the Unreal Editor. To change a formula:

  1. Open the BP_MIPDerivedAttributeGE Blueprint (or the native CDO in-editor).
  2. Locate the modifier row for the desired derived attribute.
  3. Change AttributeBasedMagnitude → Coefficient → Value.
  4. Save — the change takes effect immediately on the next apply.

No code changes are required.


Adding a New Derived Attribute

To wire a new derived attribute into this GE:

  1. Declare the attribute on UMIPWithDerivedAttributeSet (or another attribute set) with ATTRIBUTE_ACCESSORS, an OnRep, and GetLifetimeReplicatedProps entry.
  2. Add a new modifier row to the GE asset:
    • Attribute → select the new FGameplayAttributeData property.
    • Modifier OpAdditive.
    • Magnitude Calculation TypeAttributeBased.
    • Backing Attribute → Attribute To Capture → select the primary attribute (from UMIPWithPrimaryAttributeSet).
    • Attribute SourceTarget.
    • Coefficient → desired scaling factor.
  3. Save the GE asset.

Don't snapshot new attributes

Leave bSnapshot unchecked so the derived value tracks the primary attribute in real time.


Integration