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 documentation1 · 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
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
- 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
4 · Your own characters
Put your characters on the street
Any character on the Unreal mannequin skeleton can be an NPC:
- Check that its skeletal mesh uses the mannequin skeleton (SK_Mannequin) and has a physics asset for ragdolls.
- Duplicate DA_Npc_Pedestrian and replace its Meshes. Add several meshes for variety.
- Keep ABP_AnyNpc as Anim Class, or set your own Animation Blueprint based on Ax Npc Anim Instance.
- 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.