Any NPCs · Documentation

NPC Types, Reactions and Your Own Characters

Every NPC is drawn from an NPC Type: a data asset that sets how it looks, how fast it walks, how much it takes and how it reacts. Make as many types as you like and the manager mixes them by Spawn Weight.

← All Any NPCs documentation

1 · NPC Types

The NPC Type data asset

Duplicate DA_Npc_Pedestrian, or right-click in the Content Browser, choose Miscellaneous > Data Asset and pick Ax Npc Type. Then add it to Npc Types on the manager.

▾ Ax Npc Type

Meshes Skeletal meshes on the Unreal mannequin skeleton; each NPC picks one
Anim Class ABP_AnyNpc, or your own Animation Blueprint based on Ax Npc Anim Instance
Spawn Weight How often this type spawns against the other types. 0 never spawns. Default 1
Walk Speed Min / Max Each NPC walks at a speed in this range. Default 110 to 150 cm/s
Run Speed / Hurry Speed Scale Speed when fleeing or chasing, 450 cm/s; walking speed is multiplied by 1.4 when hurrying in the rain
Max Health / Attack Damage Health, 100, and the damage of each of its strikes in a fight, 10

Optional: an Umbrella Mesh held in the Umbrella Socket (hand_r), an Attack Montage and a Get Up Montage. Umbrella Chance and Shelter Chance set the rain responses, covered in Weather, Night and Engine Noise.

2 · Reactions

Ignore, watch, flee, call for help or fight back

Under Reactions, each kind of event has five weights: Ignore, Watch, Flee, Call For Help and Fight Back. An NPC that notices the event draws one reaction in proportion to them. The defaults, used by DA_Npc_Pedestrian:

▾ Ax Npc Type > Reactions

Crash A vehicle hit someone nearby. Watch 45%, flee 55%
Violence Shots, explosions, someone hurt or killed. Watch 10%, flee 90%
Loud Noise A revving engine, a backfire, thunder. Ignore 60%, watch 35%, flee 5%
Help Call Another NPC called for help. Ignore 20%, watch 35%, flee 30%, fight back 15%
Antagonized Hit, shot or otherwise damaged by an actor. Ignore 10%, flee 45%, call for help 25%, fight back 20%
Bumped Walked into by a player character. Ignore 60%, watch 35%, fight back 5%
  • Watch: the NPC stops and looks at what happened for 2 to 5 seconds.
  • Flee: it runs away along the sidewalks for 6 to 12 seconds.
  • Call For Help: it calls for 6 seconds, fires On Npc Called For Help on the manager, and NPCs within 30 m react to the call. Then it flees.
  • Fight Back: it chases the actor responsible at run speed and strikes from 1.3 m every 1.3 seconds, for up to 20 seconds or until they are 30 m away, then walks back. Nobody fights a traffic car; without someone to fight, the NPC flees instead.

DA_Npc_Tough shows the other end. It spawns a quarter as often, has 150 health and fights back 80% of the time when it is hit or when someone calls for help.

3 · Animation

The Animation Blueprint

ABP_AnyNpc is a copy of the mannequin's ABP_Unarmed with Ax Npc Anim Instance as its parent class. Its Event Graph feeds Ground Speed and Should Move from the NPC instead of a Character, and it keeps the Default slot for montages and the foot IK. Your own Animation Blueprints can read the same values:

▾ Ax Npc Anim Instance

Speed The NPC's speed, for idle, walk and run
Activity Walking, Waiting, Waiting To Cross, Fleeing, Calling For Help, Fighting, Dodging, Knocked Down, Getting Up and more
Is Moving / Is Running Speed above Idle Speed Threshold (10 cm/s) or Run Speed Threshold (300 cm/s)
Umbrella Open, Is Calling For Help, Is Fighting, Is Panicking Flags for poses and layers, such as an arm holding an umbrella
Focus Location What the NPC watches or runs from, for a look-at

4 · Your own characters

Put your characters on the street

Any character on the Unreal mannequin skeleton can be an NPC:

  1. Check that its skeletal mesh uses the mannequin skeleton (SK_Mannequin) and has a physics asset for ragdolls.
  2. Duplicate DA_Npc_Pedestrian and replace its Meshes. Add several meshes for variety.
  3. Keep ABP_AnyNpc as Anim Class, or set your own Animation Blueprint based on Ax Npc Anim Instance.
  4. Add the type to Npc Types on the manager and set its Spawn Weight.

For more than a mesh, make a Blueprint child of Ax Npc Actor and set it as the type's Actor Class. Its events On Npc Activated, On Npc Deactivated and On Npc Activity Changed let you add hats, voices or effects.

Actors are reused. Only the nearest NPCs have an actor, and an actor is handed to another NPC when its own walks away. Set up anything per NPC in On Npc Activated and undo it in On Npc Deactivated.

Next: make NPCs respond to rain, night and loud engines with Any Weather and Any Car Engine.