Course contentsShow
← Unreal Engine Game Development
Lesson 653 of 8809. Gameplay Ability System (GAS)Free lesson

Handling Periodic Effects with Execution Calculations

Configure execution calculations to trigger logic repeatedly over time, enabling complex damage-over-time or healing-over-time systems in your game.

In this lesson, you will learn how to leverage UGameplayEffectExecutionCalculation to inject custom logic into periodic Gameplay Effects, allowing for dynamic damage-over-time or healing-over-time calculations.

The Role of Periodic Execution

When you configure a Gameplay Effect with a Period, GAS automatically triggers the effect's modifiers repeatedly based on that duration. However, a standard Modifier is static—it simply adds or multiplies a value. To make periodic effects responsive to the current game state (e.g., a "Poison" effect that deals more damage if the target is currently "Wet"), you must move your logic into an ExecutionCalculation.

When a periodic effect fires, the Execute_Implementation function in your UGameplayEffectExecutionCalculation class is called every time the period elapses. This allows you to perform a fresh capture of attributes and run a custom formula each tick.

Implementation Logic

To handle periodic effects, ensure your FGameplayEffectSpec has the correct Period and Duration configured in the editor. Within your execution calculation, you capture the relevant source and target attributes just as you would for an instant effect:

void UMyPeriodicExecution::Execute_Implementation(const FGameplayEffectCustomExecutionParameters& ExecutionParams, FGameplayEffectCustomExecutionOutput& OutExecutionOutput) const
{
    // Capture attributes every time the period elapses
    FAggregatorEvaluateParameters EvaluationParameters;
    float TargetDefense = 0.0f;
    ExecutionParams.AttemptCalculateCapturedAttributeMagnitude(DefenseDef, EvaluationParameters, TargetDefense);

    // Calculate dynamic damage based on the current tick's attributes
    float Damage = BaseDamage - TargetDefense;

    // Apply the modifier output
    OutExecutionOutput.AddOutputModifier(FGameplayModifierEvaluatedData(
        AttributeSet::GetHealthAttribute(), 
        EGameplayModOp::Additive, 
        -Damage
    ));
}

Critical Considerations

Because the Execute_Implementation runs every tick of the period, keep the logic inside lightweight. Avoid complex line traces or expensive spawning here, as these can quickly become performance bottlenecks in multiplayer games with many active periodic effects. Instead, focus on using the captured attributes to drive the math. By calculating values dynamically at runtime, your damage-over-time effects will feel alive and reactive to the evolving combat environment.

Key Takeaway: Periodic Execution Calculations allow you to bypass static modifier values, enabling your periodic effects to recalculate their magnitude based on dynamic attribute snapshots every time the period fires.