Add an enemy type¶
Designer · 90 min · No code
Result: a new enemy type with its own body, animations, gameplay abilities, stats and loot, built from its own assets rather than borrowing the melee minion's. You can then place as many as you like.
Before you start¶
- Your first enemy. That tutorial makes a variant of the minion (new name and level, same everything else). This recipe makes a new type.
- Enemies and AI.
- A skeletal mesh for the new enemy, with attack, hit-reaction and death animations on its skeleton.
What an enemy type owns¶
Every asset below belongs to one enemy type. Make your own copy of each; share nothing except the parts in the last table.
| Piece | Minion sample | Holds |
|---|---|---|
| Enemy Blueprint | Characters/Enemies/Minion/B_XenoCore_Minion_Melee |
Mesh, anim class, name, level, rewards, loot, death, Arts, patrol |
| Anim Blueprint | ABP_XenoCore_Minion_Melee |
Locomotion for this skeleton |
| Locomotion blend space | Minion/Animations/BS_XenoCore_Minion_Locomotion2D |
Idle, walk, jog, and side and back jogs, by direction and speed |
| Pawn data | PawnData_XenoCore_Minion_Melee |
Which ability sets the enemy is given |
| Ability set | AbilitySet_XenoCore_Minion_Melee |
Auto-attack, hit reaction, knock-downs, guard, recoil, dodge |
| Auto-attack | GA_XenoCore_Minion_Attack |
Swing montages, range, damage effect |
| Hit reaction | GA_XenoCore_Minion_HitReact |
Flinch montages |
| Knock-downs | GA_XenoCore_Minion_Topple / _Daze |
The Topple and Daze montages, held while the reaction lasts |
| Guard, recoil, dodge | GA_XenoCore_Minion_Guard / _Recoil / _Evade |
Clips for a block, being blocked, and a dodge |
| Arts | Minion/Arts/DA_XenoCore_Minion_Rend / _Sweep |
Art definitions on the Blueprint's Arts list. See Give an enemy Arts |
| Stats effect | Battle/Attributes/GE_XenoCore_BaseStats_Minion_Melee |
Stats at its level. See Set an enemy's statline |
| Drop table | Inventory/Loot/DA_XenoCore_Drops_Minion |
See Build a drop table |
Shared by every enemy, and not to be copied:
| Shared piece | What it gives |
|---|---|
Characters/Enemies/Core/B_XenoCore_Enemy_Base |
Parent Blueprint: health bar, target chevron, AI controller, death sequence |
Characters/Enemies/Core/AbilitySet_XenoCore_Enemy_Common |
Death, and the stat attributes |
Characters/Enemies/Core/BP_AIC_XenoCore_Enemy |
The AI controller, its team, and the shared behaviour tree ST_XenoCore_EnemyFreeroam |
Steps¶
1. Make the Golem from the minion's set¶
- Create
MyGame/Enemies/Golem. - Right-click
Characters/Enemies/Minion/B_XenoCore_Minion_Melee, choose Create Child Blueprint Class, and save it in your folder asB_MyGame_Golem. A child keeps every component and setting that already works, and picks up fixes to the minion. - Duplicate into your folder:
PawnData_XenoCore_Minion_Melee,AbilitySet_XenoCore_Minion_Melee,GA_XenoCore_Minion_Attack,GA_XenoCore_Minion_HitReact,GA_XenoCore_Minion_Topple,GA_XenoCore_Minion_Daze,GA_XenoCore_Minion_Guard,GA_XenoCore_Minion_Recoil,GA_XenoCore_Minion_Evade. Rename each withMyGamein place ofXenoCoreandGolemin place ofMinion_Melee(orMinion), for examplePawnData_MyGame_GolemandAbilitySet_MyGame_Golem. - Duplicate
Battle/Attributes/GE_XenoCore_BaseStats_Minion_Melee→GE_MyGame_BaseStats_Golem.
The seven sample enemy types in Characters/Enemies/Minion/Variants/ are made the same way: each is
an empty child of B_XenoCore_Minion_Melee. If your enemy shares the minion's skeleton (or a
compatible one), the child alone is enough:
keep the minion's pawn data and abilities and change only its class defaults.
2. Give it its body¶
- Open
B_MyGame_Golemand select the Mesh component. - Set Skeletal Mesh Asset to your mesh and adjust its location so the feet sit at the bottom of the capsule.
- Set Anim Class. For a new skeleton, create an Animation Blueprint for it whose parent class
is
XenoCoreAnimInstance, and copy the shape ofABP_XenoCore_Minion_Melee:- A 2D blend space on your skeleton: Direction from -180 to 180 across, speed up the
side. Put idle along the bottom, a forward walk and jog at their own speeds at direction 0,
a left jog at -90, a right jog at 90, and a back jog at both -180 and 180.
BS_XenoCore_Minion_Locomotion2Dis the worked example. - An Idle and a Move state. Move plays the blend space, its two axes driven by the Direction and Ground Speed variables the parent class provides.
- Transitions on Ground Speed with a gap between them: Idle to Move above
20, Move to Idle below8. Play Idle at a play rate of 1.
- A 2D blend space on your skeleton: Direction from -180 to 180 across, speed up the
side. Put idle along the bottom, a forward walk and jog at their own speeds at direction 0,
a left jog at -90, a right jog at 90, and a back jog at both -180 and 180.
- On
B_MyGame_Golem, set Patrol Speed (XenoCore › AI › Patrol) to the speed your walk clip covers the ground at, so a patrol plays the walk without sliding. - Resize the Capsule Component to fit.
- Under XenoCore › Death, set Death Montages to one or more death montages on your skeleton.
Fails silently: a forward-only blend space
A blend space with speed but no direction has nothing to play when the enemy strafes round its attackers or backs away. The legs run forward, or half-idle, while the body slides sideways, and nothing is logged. Give it side and back clips.
Fails silently: transitions that read the pawn's velocity
Read Ground Speed and Direction from the parent class, never the pawn's own velocity. The parent class treats a hit's knockback as standing still, so a shove slides the body under a held pose. Velocity read directly turns every hit into a burst of forward running while the body moves backwards.
Anim Blueprints: parent to the C++ class, never to another ABP
An Anim Blueprint made as a child of another Anim Blueprint loses its own AnimGraph. Always
parent a new one to XenoCoreAnimInstance.
3. Give it its moves¶
- Open
GA_MyGame_Golem_Attack. Under XenoCore › AutoAttack:- Attack Montages: your attack montages. One is picked per swing.
- Attack Range: how far the swing reaches, in centimetres.
- Leave Target Source on
Nearest Hostile, Requires Arming off and Damage Effect onGE_XenoCore_Damage.
- Open
GA_MyGame_Golem_HitReact. Under XenoCore › Reaction, set Directional Montages to your flinch montages, in the order Front, Back, Left, Right. An empty entry means no flinch from that side. A flinch must layer over the Golem's swing, not replace it, so:- Make each flinch clip additive: duplicate the animation sequence, open the copy, and in its Asset Details set Additive Settings › Additive Anim Type to Local Space and Base Pose Type to Selected animation frame, with the original clip and frame 0.
- Make a montage from each additive clip and set its slot to
AdditiveHitReact. - Register that slot on the Golem's skeleton in its own slot group. Open the skeleton,
choose Window › Anim Slot Manager, click Add Group and name it
AdditiveGroup, then Add SlotAdditiveHitReactand right-click it › Set Slot AdditiveHitReact Group to ›AdditiveGroup. - Give the Golem's Animation Blueprint an additive branch just before Output Pose: open
ABP_XenoCore_Minion_Melee's AnimGraph and copy its last three nodes into yours: Additive Identity Pose feeds theAdditiveHitReactSlot's Source, the Slot feeds Apply Additive's Additive pin, your existing pose goes into its Base, and Apply Additive feeds Output Pose. Apply Additive's Alpha sets how hard the jolt reads.
Under XenoCore › HitReact › Push, lower Push Distance for a heavy enemy, or set it to 0
so it is never knocked back.
!!! warning "Fails silently: the flinch slot in DefaultGroup"
Compiling the anim Blueprint registers `AdditiveHitReact` in `DefaultGroup`, beside the
attack slots. Montages in one group stop each other: every hit cuts the Golem's swing short
and its next swing cuts the flinch off, so you rarely see a flinch at all. Nothing is logged. Check the slot's group in the **Anim Slot
Manager** after compiling, and move it back to `AdditiveGroup` if it changed.
- Open
GA_MyGame_Golem_ToppleandGA_MyGame_Golem_Daze. Under XenoCore › Reaction, set Directional Montages to your knock-down montage (one entry is enough). Leave Hold While Trigger Tag Present on, so the Golem stays down for exactly as long as the reaction lasts. Add a get-up as Follow Up Montage if you have one. The trigger and the hold come from the parent class; there is nothing else to set. - Open
GA_MyGame_Golem_Guard,_Recoiland_Evade(copies of the minion's). Under XenoCore › Reaction, set Directional Montages to your block, recoil and dodge clips. See Blocks and dodges for which side each slot means. No clips for one of them? Leave it out of the ability set: the Golem still blocks, recoils and dodges in the rules, just without an animation.
!!! tip "Same skeleton as an existing enemy? Skip the copies"
If the Golem shares a skeleton with an enemy you already have, keep that enemy's reaction
abilities in the set and give the Golem its own clips through an Anim Profile instead
(XenoCore › Animation › Anim Profile on B_MyGame_Golem). See
Give a character its own combat animations.
5. Open AbilitySet_MyGame_Golem. Replace the attack, hit-react, Topple, Daze, guard, recoil and
evade entries with yours. Arts are not in the ability set; they come in step 5.
6. Compile and Save each.
Fails silently: Requires Arming on an enemy
Requires Arming must be off. Enemies have no draw animation, so an enemy auto-attack waiting to be armed waits forever and never swings.
4. Wire the pawn data¶
- Open
PawnData_MyGame_Golem. - Set Pawn Class to
B_MyGame_Golem. - Ability Sets: keep
AbilitySet_XenoCore_Enemy_Commonand replace the minion's set withAbilitySet_MyGame_Golem. - Save.
5. Wire the Blueprint¶
- Open
B_MyGame_Golem, Class Defaults. - Under XenoCore › Enemy: Enemy Pawn Data
PawnData_MyGame_Golem, Stats EffectGE_MyGame_BaseStats_Golem, Display NameGolem, Enemy Level, Experience Reward. Experience Reward is the type's weight; Experience Level Scale (a curve row, the minion's isMinion.ExperienceScaleinCT_XenoCore_EnemyStats) scales it by the enemy's level. Leave that row empty for a flat reward. - Under XenoCore › Enemy › Arts: the Arts it should use. A child of the minion keeps Rend and Sweep, which play the minion's montages; replace them with your own. See Give an enemy Arts.
- Under XenoCore › Loot: your Drop Table.
- Under XenoCore › Enemy, adjust Health Bar Height and Chevron Height so both clear the new mesh's head.
- Compile and Save.
Test it¶
- Place
B_MyGame_GoleminMaps/L_XenoCore_Gym, on the navigation mesh, and press Play. (In a real level, put it on an enemy spawner instead: Place enemies.) - Walk up to it. Whether it attacks first depends on its Detection (XenoCore › AI › Detection): with None (passive) it waits to be hit. Set Sight to have it charge when it sees you.
- Hit it. It turns, chases you if you back off, and swings with your montages. Circle round it while it fights: its legs step sideways and backwards to follow you, never running forward.
- Lock on: the badge shows Golem. Defeat it: it plays your death montage, disappears, and drops a chest.
If it doesn't work¶
It cannot be damaged and cannot die
Enemy Pawn Data is empty, or its ability sets do not include
AbilitySet_XenoCore_Enemy_Common. An error naming the enemy is logged.
It stands still when hit
There is no navigation mesh where it stands, or AI Controller Class is no longer
BP_AIC_XenoCore_Enemy. Press P in the editor viewport to show the nav mesh.
Its stats are the attribute defaults
Stats Effect is empty. The log says the enemy "will run on attribute defaults, not its statline".
Its Arts play no animation, or do nothing
The Arts list still holds the minion's Rend and Sweep, whose montages are on the minion's skeleton. Replace them with Arts that play montages on the Golem's skeleton.
Toppled, it stands still instead of falling
Its ability set has no Topple or Daze ability, or they still point at the minion's montages on another skeleton. The Golem still cannot act while Toppled (that rule is on the auto-attack), so the only symptom is the missing animation.
It is friendly
The team comes only from the AI controller. A Blueprint AI controller of your own cannot carry a
team; always use BP_AIC_XenoCore_Enemy or a child of it.