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”- Open (or create) an Actor Blueprint that represents something the player can damage, e.g.
BP_EnemyBot. - In the Event Graph, add the built-in
Event AnyDamagenode (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). - From
Event AnyDamage, you’ll have access toDamage(float) andDamagedActor(self).
🎯 Step 2: Build the Combat Text Event
Section titled “🎯 Step 2: Build the Combat Text Event”- Right-click in the Event Graph and add
Get MageItCombatTextSubsystem. - Drag off its return value and add
Add Damage Event. - Build the
FMageItCombatTextEventpayload:Location:Get Actor Locationonself, plus aZoffset (e.g.+ 100) so the number spawns above the enemy’s head instead of at its feet.DamageAmount: TheDamagepin fromEvent 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.
- Connect
Add Damage EventafterEvent AnyDamage.
🏷️ Step 3: Register the Tag
Section titled “🏷️ Step 3: Register the Tag”Make sure Damage.Melee resolves to a renderer:
- Go to Edit > Project Settings > Plugins > Combat Text.
- Under Renderer Registry, either add a specific entry for
Damage.Melee, or rely on the broaderDamageentry you registered in Getting Started — the subsystem will walk up the tag hierarchy fromDamage.MeleetoDamageautomatically. SeeGetRendererfor the exact lookup order.
🎨 Step 4: Style the Widget (Optional)
Section titled “🎨 Step 4: Style the Widget (Optional)”If you’re using the UMG renderer, you can create your own widget instead of the example:
- In your Content Browser, right-click and select User Interface > Widget Blueprint.
- Expand All Classes, search for
MageItCombatTextWidget, and select it as the parent. - Name it
WBP_MyDamageNumberand open it. - Add a Text Block bound to the
Damagevariable (inherited,BlueprintReadOnly). - Override
Fade InandFade Out(seeUMageItCombatTextWidget) to play your own show/hide animations instead of relying on the default visibility toggle. - Assign
WBP_MyDamageNumberas the Widget Class on your UMG renderer instance (BP_MCT_ExampleUMGRenderer, or your own child Blueprint ofUMageItCombatTextRendererUMG).
▶️ Step 5: Test It
Section titled “▶️ Step 5: Test It”- Hit Play.
- Deal damage to your enemy multiple times in quick succession.
- 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. - Stop dealing damage. After
FadeOutDelayseconds (default0.5), the number should fade out and the widget returns to the pool.
🎉 Congratulations!
Section titled “🎉 Congratulations!”You’ve wired a real gameplay event into a fully pooled, accumulating combat text system.
Next Steps:
- Read Configuring Renderers to learn when to switch a damage type over to Niagara for scale, or Slate for a zero-widget-allocation float/fade effect.
- Explore the Blueprint API Reference to discover the full set of overridable events across all three renderers.