Add an ability
Most abilities are a Data Asset and nothing else: an Ability Definition on one of the ten cast types, with its numbers. When no cast type does what you want, the ability's behaviour can be a Blueprint, and the Data Asset still holds its numbers. This guide makes one of each.
Abilities describes every field and cast type.
A Data Asset ability
The example is Frost Lance, a skillshot that pierces and slows: Marlow's new Q.
Step 1: Make the asset
In your champion's folder, choose Add > Miscellaneous > Data Asset, pick Ability Definition, and name it
DA_Marlow_Q_FrostLance. Or duplicate a sample ability of the same cast type and change it; Varra's
DA_Varra_Q_PiercingBolt is a piercing, slowing skillshot.
Step 2: Fill in the Ability section
| Field | Value |
|---|---|
| Display Name | Frost Lance |
| Icon | your icon texture |
| Ability Tag | Ability.Marlow.Q (add it in Project Settings > Gameplay Tags) |
| Slot | Q |
| Ability Class | MobaSkillshotAbility |
| Max Rank | 5 |
Step 3: Casting and targeting
| Field | Value |
|---|---|
| Cast Type | Skillshot (Line) |
| Default Cast Mode | Quick Cast with Indicator |
| Cast Time | 0.25 |
| Range, Width | 1100, 120 |
| Projectile Speed | 2000 |
| Pierces Units | on |
| Affects | Enemies |
Step 4: Ranks and damage
Fill one value per rank, rank 1 first:
| Field | Value |
|---|---|
| Cooldown | 9, 8.5, 8, 7.5, 7 |
| Mana Cost | 50, 55, 60, 65, 70 |
| Base Damage | 60, 95, 130, 165, 200 |
| Scaling Attribute, Scaling Ratio | Bonus Attack Damage, 0.9 for every rank |
| Damage Type | Physical |
Step 5: The slow
Add an entry to Effects: Effect Class MobaSlowEffect, Applied To Units Hit, Duration 1.5 for every rank, and
Magnitude 0.3 (a 30% slow). Give it a Cue, such as the shared GameplayCue.Sample.State.Slow, to show the slow on the
unit.
Step 6: The tooltip
Write the Description with tokens:
Fires a lance {Range} cm ahead that deals {Damage} {DamageType} damage to every enemy it passes and slows them
by {Percent1}% for {Duration1} s.
The HUD fills in the numbers for the champion's rank and stats.
Step 7: Effects, clip and bots
- Cues: name your Cast, Travel and Hit cues; see Make an effect.
- Cast Clip and Clip Effect Time: the clip the champion plays, and the moment in it the lance leaves.
- Bot: Usage
Bot.Usage.Damage, so bots cast it at enemies. Without a Usage, bots never cast it.
Step 8: Put it on the champion
Open the Champion Definition and set it under Abilities > Q. Save. The message log reports anything the cast type needs and is missing; an ability with an error is not granted. Play, put a point into Q with Ctrl + Q, and cast.
Values are read at each cast, so you can change numbers while the game runs in the editor and try them at once.
A Blueprint ability
The example is a slam that hits every enemy around the caster. (An AoE ability with Range 0 does this with numbers alone; the Blueprint is where your own behaviour would go.) Targeting, cost, cooldown, the cast time, interrupts and prediction stay in the C++ base class, so a Blueprint ability needs no networking of its own.
Step 1: Make the Blueprint
- Add > Blueprint Class, open All Classes, and pick MobaGameplayAbility as the parent. Name it
GA_Marlow_Slam. - In its Event Graph, add the event On Cast Fired. It runs when the cast time is over.
- From it, call Hit Units. For its Targets, call Find Units In Radius:
- Center: Get Caster, then Get Actor Location.
- Radius: Get Definition, then its Radius.
- After Hit Units, call Finish Cast.
- Compile and save.
Step 2: Make its Ability Definition
Make an Ability Definition as above, with Cast Type AoE, Range 0, a Radius such as 300, a Base Damage per rank,
and Ability Class set to GA_Marlow_Slam. Put it on a slot of the champion.
The definition still decides who is hit: Find Units and Hit Unit honor its Affects, so a Blueprint cannot hit an ally with an ability whose Affects is Enemies. The cast type decides how the ability is aimed and which indicator shows.
The hooks
| Event | When it runs | Where |
|---|---|---|
| On Cast Started | The cast has started: cost and cooldown are paid, the cast time begins | Server and the caster's own game |
| On Cast Fired | The cast time is over: do what the ability does, then call Finish Cast | Server and the caster's own game |
| On Targets Found | Units are about to be hit; remove one from the list to spare it | Server |
| On Hit | A unit has been hit: its damage, heal and effects are applied | Server |
| On Cast Ended | The ability has ended. Cancelled: it was interrupted, or the server refused it | Server and the caster's own game |
What a graph can call
| Function | What it does |
|---|---|
| Get Definition, Get Rank, Get Slot | The ability's data and rank |
| Get Caster, Get Aim, Get Aim Direction | Who casts, and at what |
| Get Damage, Get Heal | The rank's numbers with their scaling |
| Find Units In Radius, Find Units In Line, Find Units In Cone | The units the definition's Affects allows in a shape, nearest first, no more than its Max Targets |
| Can Affect | Whether the definition's Affects lets the ability hit a unit |
| Hit Unit, Hit Units | Damage, heal and the definition's effects for units hit. Server only |
| Apply Caster Effects | The definition's effects for the caster. Server only |
| Refund Cast | Gives the mana back and takes the cooldown away. Server only |
| Play Cue | Plays a Gameplay Cue of your own |
| Is Server Cast | True on the server |
| Is Predicted Cast | True on the caster's own game while it runs ahead of the server |
| Finish Cast | Ends the ability on this machine |
What you can rely on
- The caster's own game runs On Cast Started and On Cast Fired too, at once, to predict. Whatever is only for show belongs there. Whatever changes the game belongs behind the server-only calls, which do nothing on a player's game.
- An ability that never calls Finish Cast is ended after the definition's Max Duration (10 s by default), so its slot is never blocked for good.
- A Blueprint ability is granted, cast, refused and interrupted like a C++ one.
The sample's own Blueprint ability is Isolde's Ice Wall, GA_Isolde_IceWall in /PioneerMOBA/Sample/Champions/Isolde:
its On Cast Fired calls Raise For Ability, which raises the wall its Ability Definition describes at the aim, and
then Finish Cast.
A summoner spell
A summoner spell is an Ability Definition too: Slot D, Max Rank 1, one value in each rank array. Add it to Project Settings > Pioneer MOBA Framework > Match Flow > Spell Pool, and champion select offers it. See Summoner spells.