Animation Integration
Documentation Unreal Engine AI Animation Combat
Author combat timing on the animation itself: hold a gameplay tag for a montage window, mirror it into an animation Blueprint bool, and steer an attack toward its target.
Timing that belongs to the animation, authored on the animation. A montage window holds a gameplay tag while it runs, and the rest of the game reads that tag.
Set it up
45 seconds- 1
Put a state tag window on the montage
Open the dodge montage, right-click a notify track, Add Notify State, SEC State Tag Window. Drag it across the frames the state should cover and fill Tags.AM_Dodge_Roll▾State TagsTagsThe track reads State Tag [SEC.State.Intangible], so the window says what it holds. - 2
Reparent the animation Blueprint
Open the pawn's animation Blueprint, Class Settings, and set Parent Class to SEC Anim Instance Base. - 3
Map the tag to a bool
Add a bool variable,IsDodging. Then open Class Defaults and add a row to Gameplay Tag Property Map, naming the tag and picking that variable.ABP_Enemy▾Gameplay TagsTag To MapProperty To EditThe bool tracks the tag for as long as the window holds it, with no event graph nodes. - 4
Play, and watch it work
Roll, and the bool flips on for the window and off at its end. An enemy sweep crossing those frames lands nothing and keeps travelling, because a melee trace carriesSEC.State.Intangiblein its Pass Through Tags by default.AM_SEC_DodgeBackin the showcase content ships with the window already on it.
Tags live on the pawn's Ability System Component. A pawn without one has nowhere to put them, so the window holds nothing and the bool never flips. Enemy Character Base creates one; a custom pawn needs one added. Give the window a positive duration as well, since a zero-length window opens and closes on the same frame.
Hold a tag for part of an animation
SEC State Tag Window has one field. Tags names what the owner holds while the window runs, and empty applies nothing.
Because the timing lives on the montage, retiming the animation moves the window with it. An interrupted montage releases its tags too: a cancelled dodge drops its invulnerability rather than stranding it.
Overlapping windows compose. Two windows holding the same tag keep it until the second one closes.
These tags ship as starting points. The plugin adds none of them by itself; your montages do.
| Tag | Author it on |
|---|---|
SEC.State.Intangible | The i-frames of a dodge or roll. The one tag combat code reads on its own, through Pass Through Tags on a melee trace. |
SEC.State.Dodging | The whole roll, for the movement slowdown below. |
SEC.State.Blocking | A raised guard, for the slow walk it costs. |
SEC.State.Staggered | The reaction montage after a hit lands. |
SEC.State.Recovering | The recovery section of an attack, to gate other actions through Requires Tags and Block Tags. |
SEC.State.Sprinting | A sprint, with a speed multiplier above 1. |
Author your own for a parry window, a hyper-armor stretch, or anything else your project needs. A tag is a name; what it means is up to the code that reads it.
For the attack itself to deal damage, the montage also needs a SEC Melee Trace Window over the swing frames. See Melee Trace.
Invulnerability frames
A window holding
SEC.State.Intangible is the whole setup. A sweep reaching a target that holds it drops the contact: no damage, no impact effect, and the swing is not spent, so it carries on to whatever stands behind and can land on the same target once the window closes.Nothing needs setting on the attacker. A melee trace component ships with that tag in Pass Through Tags.
For a dodge that costs the attacker their swing, the way a parry does, resolve the hit in the pawn's own damage handling instead and leave the tag out of Pass Through Tags. Melee Trace covers the difference between a hit that passes through and one that resolves.
Mirror a tag into an animation bool
SEC Anim Instance Base keeps a Blueprint bool in step with a gameplay tag. One row in Gameplay Tag Property Map per pair, then read the bool in a state machine, a blend, or an animation layer.
Loose tags and tags granted by a Gameplay Effect both drive it, so the same bool covers a montage window and a buff.
Binding needs no setup. The animation instance looks for the owner's ability system each frame until it finds one, which covers a pawn that builds its ability system as a Blueprint component and a pawn that builds one later still. To point the map at an ability system the pawn does not carry, such as one living on a Player State, call Initialize With Ability System on the animation instance.
Fire a one-off signal from a frame
Some moments need no window and no state: a pose snapshot, a prop spawn, a camera shake. Add Notify, SEC Gameplay Event at the frame, and set Event Tag.
Wait on that exact tag from an ability, or from a Blueprint through Wait Gameplay Event. Nothing is added to the pawn and nothing is taken off afterwards, so a listener bound after the frame has passed hears nothing.
AM_SEC_Unarmed_Combo uses one.The pawn needs an ability system to receive it. A pawn without one names itself in the Output Log and nothing is sent.
Readable notify tracks
The track shows the tag's last segment, so an event tag ending in PoseSnapshot reads as PoseSnapshot. Several stay legible side by side on one timeline.
AdvancedWhat the event carries
The pawn is named as both the event's instigator and its target, and the animation it came from arrives as Optional Object. A handler bound to one tag that several montages send reads that to tell which montage fired it.
Ask the character for its own effect
A footstep sounds different under a barefoot rogue and a plated knight, and authoring that per character means authoring the animation twice. Two notifies ask the character instead, and the character answers.
| Notify | Use it for |
|---|---|
| SEC Play Anim Effect | A single frame: a footstep, a landing, gear rustling. |
| SEC Anim Effect Window | A stretch: a weapon trail, a charge glow, a sustained whoosh. The window opens at the first frame and closes at the last. |
Both carry Effect Tags, what the frame asks for, and Socket Name, where on the body it belongs. Leave the socket as None and the effect sits at the mesh's own position.
To answer, add the SEC Anim Effect Handler interface to the pawn, or to any component it carries, and implement Handle Anim Effect (plus Handle Anim Effect Begin and Handle Anim Effect End for a window). Spawn the Niagara system, play the sound, whatever the effect is. A pawn that answers nowhere does nothing at all.
These tags ship, and a handler asking for a parent tag catches every tag beneath it.
| Tag | Frame it belongs on |
|---|---|
SEC.AnimEffect.Footstep.Left / .Right | The foot-plant frames of a walk or run. |
SEC.AnimEffect.Land | The landing frame after a fall. |
SEC.AnimEffect.WeaponTrail | The swing frames a trail should cross. AM_SEC_TwoHanded_SingleAttack has one. |
SEC.AnimEffect.Foley | Wherever cloth, armour or gear should move. |
A weapon trail is authored by the pawn passing the same call on to whatever it has equipped, which runs its own trail. Each handler on the actor is called once, so a handler does not pass a request to another handler on the same actor.
MultiplayerWhich machines run an effect
Nothing replicates and nothing runs on a dedicated server. The notify fires on each machine playing the animation, which is where the effect is wanted.
An animation cut short mid-window can leave the close uncalled, so stop anything expensive on the pawn's own teardown as well.
Steer an attack toward its target
An attack animated on the spot whiffs the moment its target steps aside. SEC Approach Window turns the character toward what it is fighting and glides it into range across the frames you mark, then stops a set distance short so the swing lands.
Add Notify State, SEC Approach Window over the wind-up frames. On an enemy attack that is the whole setup: the enemy character carries a SEC Approach component, and an SEC ability stores its target under the same name the window looks for.
AM_SEC_TwoHanded_SingleAttack has one authored.Details
SEC Approach Window
Approach
Move By Offset
Offset Direction
X -1.0 Y 0.0 Z 0.0
Offset Distance
50
Approach Target Name
Target
Mode
Move and Face
Stop Distance Override
-1
Max Approach Distance Override
-1
Facing Interp Speed Override
-1
Override Speed Limit
Speed Limit Override
Unlimited
Max Approach Speed Override
600
Time Mapping Curve Override
None
Dragged across the wind-up frames. Approach Target Name picks which stored target it steers toward, or Move By Offset steps a set distance instead. Every override left at -1 takes the value on that target, then the matching Default on the Approach component.
Mode picks which half runs.
| Mode | What it does |
|---|---|
| Move and Face | Glides toward the target and turns to face it. The gap-close for an in-place attack. |
| Face Only | Turns to face without moving, for an attack that aims and stays put. |
| Move Only | Glides without turning, for a lunge that keeps the direction the animation gives it. |
Move By Offset replaces the target entirely. Tick it and the window steps the character a set distance along a direction of its own: Offset Direction
(-1, 0, 0) with Offset Distance 50 is a step straight back, whatever way the character faces. Nothing has to be stored for it, and the target fields grey out. It suits a hit reaction or a block that should knock the character back over the animation's own frames.An attack whose animation already carries root motion travels on its own, and the window makes up only the distance it falls short by, so a window on one of those lands its hit too. On a character a player controls, reach for Motion Warping instead: it bends the motion the animator authored rather than adding to it, and it predicts through the ability playing the montage.
Motion Warping is the alternative to the approach window rather than a companion to it, so a character wants one or the other on a given attack. Taking that route means adding a Motion Warping component to the character yourself: the enemy character does not ship with one, and an ability looks the component up when it activates and gives up quietly when it finds none, so a montage with a warp notify plays on the spot and nothing says why. See Motion warping.
Pointing a window at a target
What a window steers toward comes out of a named slot on the character's SEC Approach component, the same handover Motion Warping uses for its warp targets. Something stores the target; the animation decides when the steering happens.
An SEC ability stores it on activation under the name in its Motion Warping Target Name, which defaults to
Target, and so does the window's Approach Target Name. Matching those two names is what makes an attack steer at the right thing.From a Blueprint graph, Set Approach Target To Actor stores an actor under a name, Set Approach Target To Location stores a spot, Set Approach Target takes the whole struct when you want per-target distances on it, and Remove Approach Target clears one. A window whose name holds nothing plays the attack where the character stands.
The distance and facing overrides on the window can be left at -1, which hands the choice to the stored target, then to the matching Default on the Approach component: Default Stop Distance 150 cm, Default Max Approach Distance 750 cm, Default Facing Interp Speed 12. Past the max approach distance the window turns the character toward its target without closing on it, so the attack plays where the character stands.
Speed Limit on the Approach component is Unlimited, so a window covers whatever distance separates the two in the span it was given, which can cross a room in a fraction of a second. Set it to Character's Max Speed for a gap-close that reads like running, or to Fixed Speed with a Max Approach Speed in cm/s.
Steering without a montage
The same steering runs from Blueprint with no montage or notify involved, for a chase, a scripted reposition, or a boss beat you drive yourself. Get the character's SEC Approach component and call:
- Approach Actor: turn a character toward an actor for a number of seconds, gliding it into range when the mode asks for it.
- Approach Location: turn it toward a spot and glide it there over a number of seconds. The spot is exact, so no stop distance comes off it.
- Approach Offset: move it a set distance along a direction of its own, for a step back or a sidestep with nothing to aim at. The direction is in the character's own space, and it defaults to Move Only so a knockback does not turn the character.
These start at once rather than waiting on an animation. Seconds is how long the glide takes as well as how long the call runs, so at or below zero the character turns without gliding and keeps turning until Stop Approach stops it.
AdvancedChasing a target that keeps moving
Moving Target on the Approach component decides where a glide aims while the target moves, and a window can override it per attack.
| Setting | Aims at |
|---|---|
| Lead | Where the target is heading. The default, and the smoothest against a target that keeps moving, since it covers a dodge without lurching. |
| Chase | Where the target stands right now. Follows every step, which bunches up whenever the target changes direction. |
| Committed | Where the target stood when the window opened. For an attack that commits, so a target that got out of the way is missed. |
Lead Strength is how much of the target's own motion a leading glide steers ahead of, from 0 for none to 1 for all of it (the default). Lower it to aim nearer where the target stands, so a target sprinting away is followed rather than cut off.
AdvancedWhen the glide stays home
The turn runs whenever the window does. The glide is the part with conditions on it, and each one leaves the attack playing in place rather than sliding it somewhere wrong.
- The target sits past Max Approach Distance Override, so a swing thrown across the arena does not turn into a charge.
- The character is already inside the stop distance, measured between the two capsules rather than the two origins, so a wide enemy stops with room for its own body.
- A speed bound is in force and the target is further than it reaches in the window's span. The character approaches as far as it can and the attack lands short.
- The target is destroyed mid-window. The glide stops rather than travelling to the spot it left behind.
- The montage stops, blends out or is replaced. The window ends with it and hands the facing back.
Time Mapping Curve Override eases the travel: X is the window's time from 0 to 1, Y the fraction of the distance covered by then. Author an ease-out for a lunge that arrives soft. Unset takes the curve on the stored target, and glides at a constant rate when that has none either.
AdvancedWho owns the character's facing
While the window runs, whatever else turns the character stands down, and gets its settings back when the window closes. Several things can hold the facing at once and release in any order, so a window inside a paired animation composes instead of fighting.
For an enemy, the controller stops writing facing for the length of the window, then resumes tracking. An ability that also sets Lock AI Rotation on the same montage composes without error, though the two ask for opposite things: the lock stops the controller aiming, and the window turns the character itself.
A second window opening on a character that is already being steered takes over, so the window that opened last is the one steering. A move already told exactly where to land is the exception: it keeps the character until it gets there.
Acquire Facing Control and Release Facing Control take the facing for anything else that needs it, and On Facing Control Changed fires on both. Bind it from code that writes the character's rotation settings, so it stands down for the window and re-resolves once the facing comes back.
MultiplayerWhich machines steer
The turn runs on the server and on a player's own machine, and does nothing on a copy of someone else's character, which receives the motion already resolved.
The travel has one rule: play the montage on every machine. Each machine running the window works out its own glide toward the same target, and character movement settles the difference. An AI attack gets this for free, since its montage plays on the server anyway. A montage played on one machine alone is the failure case: that machine glides, the server does not, and the server hauls the character back every frame.
Against a stationary target both machines pick the same landing spot and the motion is smooth. The faster the target moves, the further apart the two spots land, and the difference shows up as a tug.
Prediction removes that, and prediction means an ability. Four things have to line up:
- The pawn carries an Ability System Component.
- The ability's Net Execution Policy is Local Predicted.
- The montage plays through the Play Montage and Wait ability task. The window borrows the ability the ability system recorded against the montage, and only that task registers one.
- Section changes go through the ability's Montage Jump To Section, so the server jumps to the same section.
A player character gliding without an ability names itself once in the Output Log, so the tug has an explanation rather than looking like a bug.
A montage played from a Blueprint plays only on the machine that played it. On a client, the server never runs the window at all, so nothing turns or glides there and server-side hit checks read a character facing the wrong way.
A target stored on the server reaches the machine playing that character when Set Approach Target To Actor is called with Replicate ticked, so a target set server-side steers a player's own machine without a multicast. The server's answer is the one that lasts.
An animation carrying its own root motion is the one case that does not predict: root motion takes precedence, so the window closes the remaining distance directly instead. On an AI that costs nothing. On a character a player controls it reads as a tug, and the Output Log names the character.
Scale movement speed while a tag is held
A character holding full walk speed through a dodge slides out of its own animation. SEC Speed Modifier scales walk speed while a tag is held, so the slowdown begins and ends with the animation.
- Add SEC Speed Modifier to the character.
- Add a row to Speed Scale By Tag: the tag, and the multiplier it applies.
SEC.State.Dodgingat0.2leaves a fifth of the normal speed, enough to steer a roll without walking out of it. - Put a SEC State Tag Window across the dodge frames with that same tag in Tags.
Details
SEC Speed Modifier
Movement
Speed Scale By Tag
1 element
SEC.State.Dodging
0.20
Scales walk speed while a tag sits on the owner. Each entry pairs a tag with the multiplier it applies.
Tags held at the same time multiply, so a 0.5 slow alongside a 0.2 dodge leaves a tenth of the speed. A parent tag in the table matches the tags beneath it, so one row covers a branch. A multiplier above 1 speeds the character up, which is how
SEC.State.Sprinting uses the same table.With no tag held, the character walks at the speed it started with. The component reads that speed when play begins, so set the character's own Max Walk Speed as usual and let the table scale it.
AdvancedSlows that no tag stands for
Some slows belong to a projectile or a pickup rather than to a montage. Add Speed Modifier applies one under an id you pick and holds it until Remove Speed Modifier drops that id. Calling it again with the same id replaces that id's multiplier. Has Speed Modifier reports what is held, and Clear Speed Modifiers drops every id while leaving the tag table alone.
That path needs no ability system component, so it works on a character with no combat systems attached. Ids and tags land in the same pool and multiply together.
Set Base Max Walk Speed changes the speed every multiplier works from, for a sprint or an upgrade that raises the character's own walk speed. Write it through that function rather than setting Max Walk Speed directly, or the next tag change overwrites the value.
Set Speed Scale For Tag and Remove Speed Scale For Tag edit the table while play runs, and the first starts watching a tag the table did not carry. A negative or non-finite multiplier is refused wherever it enters, so one bad row cannot reach the movement component.
AdvancedDriving your own movement system
On Speed Scale Changed fires with the combined multiplier whenever it changes. A character with no Character Movement Component still tracks tags and still broadcasts, so a project with its own movement code can bind that event and ignore the walk speed side.
Subclass the component in Blueprint to override Combine Speed Scales, which decides how several multipliers stack, or Apply Speed Scale, which decides what the multiplier drives. Override the second to scale acceleration and rotation rate alongside walk speed.
MultiplayerKeeping speed in step across the network
Walk speed is not a replicated property, so each machine works its own value out from the tags it can see. Add the driving tag through a Gameplay Effect or Add Replicated Loose Gameplay Tag so every machine agrees. A tag added with Add Loose Gameplay Tag exists only where it was added, which leaves the server and the clients disagreeing about how fast the character moves.
A montage window adds loose tags per machine, and the montage plays on the server too, so a window-driven slow stays consistent without extra work.
Debug it
SEC.Debug.Approach 1 // What each approach window decides, and a block above each character
SEC.Debug.Steering.Draw 1 // Orange is an approach window, green is a motion warp
SEC.Debug.Warp 1 // What an ability's motion warping reach check decides
SEC.Debug.Melee.DrawTracing 1 // The sweeps a melee trace window runs
ShowDebug AbilitySystem lists the tags a pawn holds right now, which is how you check that a window opened and closed. The SEC Approach component also carries a Debug Overlay Approach checkbox that turns the approach view on for that one character and needs no console.AdvancedReading the steering draw
Both steering systems draw the same arrangement, which is what makes the colour the answer to which one is moving the character. A line runs from the character to where the motion is taking it and a sphere marks that spot, a ring around the target shows how far short of it the motion stops, and a silver line joins the goal to the target. White is the way the character points, magenta the way the motion wants it to point: two arrows half a turn apart means the wrong facing is being asked for rather than the wrong goal being given. On a listen server the two machines draw at different heights, so both are readable at once.
AdvancedNothing happens
| Problem | Likely cause | Fix |
|---|---|---|
| Tag never appears | The pawn has no ability system component | Add one, or derive the pawn from Enemy Character Base. |
| Tag never appears | Tags left empty on the notify | Fill Tags. |
| Tag sticks after the montage | Animation Blueprint recompiled mid-window in Play In Editor | Restart Play In Editor. Unreal skips notify ends while reinstancing Blueprints. |
| Bool never flips | The variable is not mapped, or the row names another tag | Check the row in Gameplay Tag Property Map. |
| i-frames ignored on the server | Trigger On Dedicated Server cleared on the placed notify | Re-enable it. |
| i-frames ignored on the server | The mesh pose is not ticking | Set Visibility Based Anim Tick Option to Always Tick Pose And Refresh Bones. |
| Nothing answers an effect notify | No handler on the pawn or its components | Add the SEC Anim Effect Handler interface and implement it. |
| Attack neither turns nor closes | Nothing stored under the window's Approach Target Name, or no SEC Approach component on the character | Add the component, and store the target with Set Approach Target To Actor. SEC.Debug.Approach 1 names which one is missing. |
| Attack steers at the wrong thing | The window's Approach Target Name and the name the ability or graph writes disagree | Match the two. An SEC ability writes its Motion Warping Target Name. |
| Attack turns but stays put | The target is past Max Approach Distance Override, or already inside the stop distance | Raise the limit, or lower Stop Distance Override. |
| Attack crosses a huge distance instantly | Speed Limit is Unlimited | Set Character's Max Speed, or Fixed Speed with a Max Approach Speed. |
| The server sees the attack facing the wrong way | The montage plays from a Blueprint, so it never plays on the server | Play the attack through an ability, or play the montage on the server as well. |
| Damage lands during i-frames | The window holds a tag the melee trace does not read | Use SEC.State.Intangible, or add your tag to Pass Through Tags on the attacker's trace component. |
MultiplayerWindows on a dedicated server
A window runs wherever the montage plays, the server included, and adds loose tags to that machine's ability system component. Nothing replicates, because the server plays the montage too and its own window is what server-side damage checks read.
The server runs the notify while the mesh ticks its pose, and skips it otherwise. Enemy Character Base sets Visibility Based Anim Tick Option to Always Tick Pose And Refresh Bones on a dedicated server to keep that tick alive. A custom pawn that skips that step leaves sockets and notify timing at the reference pose.
Clearing Trigger On Dedicated Server on the placed notify makes a window client-only, which drops server-side i-frames.
AdvancedOverlapping windows and restarts
Unreal treats one notify object on one mesh as a single window. Play a montage twice on the same mesh while the first copy blends out and you get one begin and one end, not a double count. A window that begins again with no end between, as a jump to an earlier section can do, releases the earlier record before re-adding.
Ending a window twice removes its tags once, and a duplicate end leaves a tag held by another system untouched. A window also survives a mid-window change to the owner's resolved ability system, since the tags come off whichever one they went onto.