Skip to content

Your First Damage Event

In the Getting Started guide, we fired a test event from a key press. Now, it’s time to wire combat text into an actual gameplay flow!

In this tutorial, we will hook up a simple “Take Damage” event on an enemy Actor so it spawns an accumulating damage number using the UMG renderer.


⚔️ Step 1: Add a Damage Entry Point to Your Actor

Section titled “⚔️ Step 1: Add a Damage Entry Point to Your Actor”
  1. Open (or create) an Actor Blueprint that represents something the player can damage, e.g. BP_EnemyBot.
  2. In the Event Graph, add the built-in Event AnyDamage node (or your own custom “Take Damage” function — any place in your gameplay code where you already know the damage amount and the hit location works).
  3. From Event AnyDamage, you’ll have access to Damage (float) and DamagedActor (self).

  1. Right-click in the Event Graph and add Get MageItCombatTextSubsystem.
  2. Drag off its return value and add Add Damage Event.
  3. Build the FMageItCombatTextEvent payload:
    • Location: Get Actor Location on self, plus a Z offset (e.g. + 100) so the number spawns above the enemy’s head instead of at its feet.
    • DamageAmount: The Damage pin from Event AnyDamage.
    • DamageTag: A tag describing this damage, e.g. Damage.Melee.
    • TargetActor: self. This is what lets the UMG renderer track the actor and accumulate repeated hits into a single growing number instead of spawning a new widget every time.
  4. Connect Add Damage Event after Event AnyDamage.

Make sure Damage.Melee resolves to a renderer:

  1. Go to Edit > Project Settings > Plugins > Combat Text.
  2. Under Renderer Registry, either add a specific entry for Damage.Melee, or rely on the broader Damage entry you registered in Getting Started — the subsystem will walk up the tag hierarchy from Damage.Melee to Damage automatically. See GetRenderer for the exact lookup order.

If you’re using the UMG renderer, you can create your own widget instead of the example:

  1. In your Content Browser, right-click and select User Interface > Widget Blueprint.
  2. Expand All Classes, search for MageItCombatTextWidget, and select it as the parent.
  3. Name it WBP_MyDamageNumber and open it.
  4. Add a Text Block bound to the Damage variable (inherited, BlueprintReadOnly).
  5. Override Fade In and Fade Out (see UMageItCombatTextWidget) to play your own show/hide animations instead of relying on the default visibility toggle.
  6. Assign WBP_MyDamageNumber as the Widget Class on your UMG renderer instance (BP_MCT_ExampleUMGRenderer, or your own child Blueprint of UMageItCombatTextRendererUMG).

  1. Hit Play.
  2. Deal damage to your enemy multiple times in quick succession.
  3. You should see a single damage number appear above the enemy and grow with each hit, instead of stacking multiple separate numbers. This is the built-in accumulation behavior of UMageItCombatTextWidget::UpdateDamage — each new hit resets the fade-out timer and adds to the running total.
  4. Stop dealing damage. After FadeOutDelay seconds (default 0.5), the number should fade out and the widget returns to the pool.

You’ve wired a real gameplay event into a fully pooled, accumulating combat text system.

Next Steps: