1. Home
  2. Docs
  3. Starter Guides
  4. Damage Resource and Stat System
  5. Create Gameplay Effect

Create Gameplay Effect

This section describes how to add a new Gameplay effect that affects a stat.

Im using the project created in the “Integration in new project” section for this guide and the created stat from “Bind Custom Values”, but you can use any other stat.

Step 1 - Base Class

To add a new effect, simply create a child class of one of the base classes.
I also created some subclasses for common cases.

  • GE_Duration is the basic effect that lasts for x seconds
  • GE_Ticking is a extended version and has a function that ticks x times while active (time between ticks will be calculated by the duration and ticks)
  • GE_Duration_DamageProcessing can be used for shield effects / absorbs / damage reduction
  • GE_Duration_ApplyModifier can be used for increasing/decreasing stats
  • GE_Ticking_DamageOverTime can be used for damage effects
  • GE_OneTimeEffect is a base class for one time effects, they will only execute the start function

I create a subclass of GE_Duration for this guide and name it GE_Duration_IncreaseAttackSpeed

Step 2 - Custom functions

Open the new class and change the defaults.

I set the duration to 15s, isStackable to true and the max stack size to 5.

The image is optional and used in the effect bar as icon.

Add the OnGameplayEffectStart and OnGameplayEffectEnd events to the event graph.

In this case im adding 0.2 attackspeed when the effect starts.

When using a stacking effect you need to update the existing modifier when the stack size is changing.

Make sure you check “OverrideExistingModifier” to ensure the old modifier will be overridden with the new.

The value of the modifier is stacksize × value. In this case im adding 0.2 attackspeed per stack.

Step 3 - Testing

Place a BP_GameplayEffectTester in you level and set the “GameplayEffect” variable in the details panel to “GE_Duration_IncreaseAttackSpeed”

Im adding a print string to the screen, to ensure the value is updating correctly.

When Pressing Play and walking over the gameplay effect tester, the effect should be visible in the effect bar and the print string should be 0.2 per stack.

How can we help?