Blueprint recipes
Each recipe is drawn as a node chain: execution runs left to right, and each node lists the pins to set. “from” means the pin is wired from that source.
Make guards notice things#
Footsteps#
Where it goesThe player's Animation Blueprint
- Add an Anim Notify named Footstep to the walk and run animations, and this event appears in the Animation Blueprint.
- To tell walking, sprinting and crouching apart, use Make Movement Noise and feed State from a Select: Crouching when crouched, Sprinting above 450 horizontal speed, Walking otherwise.
- The return value is how many guards heard that step, handy for a UI hint.
Make an object noisy (doors, bottles, alarms)#
Where it goesThe Blueprint of the object making the sound
- Radius is how far it can be heard (cm). Wall Attenuation 0.5 halves what's left at each wall; 0 goes through walls completely.
- Guards walk to where the sound was made, which is exactly what a thrown-object distraction needs.
- To know who heard it, use Report Sound With Feedback, which returns the guards that heard it.
Report a custom clue#
Where it goesAny Blueprint, for example a cabinet left open
- Lifetime is how many seconds the clue lasts; 0 means permanent. Keep the returned Id and call Remove Evidence when things are restored.
- A guard notices it within 1200 cm when it can see the spot. Set Source to the object itself so a trace that hits it still counts.
- For items that can be taken it's simpler to add an AI Evidence component; see the setup guide.
Restricted area: being seen counts as witnessed#
Where it goesA trigger volume Blueprint
- Only guards that can see the spot right now count as witnesses; if nobody sees it, nothing happens.
- Witnesses go straight to Alerted, warn allies within 2000 cm, and add 0.1 Belief (more with more witnesses).
- Staying inside doesn't report again; leaving and coming back does.
React to what guards do#
Player captured#
Where it goesOption A goes in the guard Blueprint; option B in the GameMode or Level Blueprint
- The event fires every frame while in range, so the Do Once is required.
- Option B leaves the shared Guard Blueprint untouched, but only binds guards that exist at BeginPlay; bind spawned guards when you spawn them.
- Capture needs an Alerted guard, distance within Capture Range (150 cm) and a player who isn't invisible. It doesn't check line of sight.
Act on alert state changes (call allies, change looks)#
Where it goesThe guard Blueprint (Guard or a child of it)
- A guard that goes Alerted by seeing the player doesn't warn others on its own; Share Alert warns every guard within Alert Share Radius (2000 cm).
- Every Share Alert also reports an Alarm Raised score event.
- To switch animations by behavior (patrol, chase, search), use Event On Behavior Changed, which gives the old and new behavior.
Show a guard's emotion color#
Where it goesThe guard Blueprint
- The material needs a Vector parameter named EmotionColor.
- Get Display Color already includes the flicker during a change. Each emotion's color is set in the emotion component's Emotion Colors.
- For a quick look while debugging, turn on the emotion component's Draw Debug to draw a ring in that color at the guard's feet.
Player abilities and cards#
Kill or knock out a guard#
Where it goesThe player or ability Blueprint
- After Report Killed the guard plays its death, leaves a permanent body as evidence, and guards that see it go Alerted.
- Take Punch needs 10 punches to knock out; use Knock Out for an instant knockout. The guard wakes after 8 seconds.
- Cast To AIEnemy works for the Guard Blueprint and every child of it.
Steal an emotion#
Where it goesThe steal ability Blueprint
- A false Return Value means nothing was stolen, for example because the guard is dead.
- Stealing anything other than Calm pacifies the guard for 10 seconds: it returns to patrol and neither sees nor hears.
- A steal is a witnessable event, so guards watching it go Alerted.
Anger card: make nearby guards fight#
Where it goesThe card or ability Blueprint
- Every living, conscious guard in the radius attacks its nearest fellow guard; the return value is how many were affected.
- A Duration of 0 or less lasts until Clear Forced State is called.
- Fighting guards don't capture the player, and their emotions don't change.
Lights out: one lamp or an area#
Where it goesThe snuff ability or blackout card Blueprint
- Set Intensity(0) on the light component works too; the AI Light notices it. Dimming without reaching 0 doesn't count.
- Turn lights back on the same way: Turn On, or Set Lights In Radius with On ticked.
- Nearby guards come to check when a light goes out; untick Investigate When Turned Off on the AI Light to stop that.
Distraction: lure guards away#
Where it goesThe ability or card Blueprint
- A noise draws every guard within its radius; Request Investigate moves just one guard.
- Both make the guard Suspicious for at least 8 seconds. Request Investigate is ignored by a guard that is already Alerted.
Calm nearby guards#
Where it goesThe ability or card Blueprint
- Pacified guards forget everything and go back to patrol, seeing and hearing nothing meanwhile.
- A Duration of 0 uses the emotion component's Emotion Suppress Time (10 seconds).
Turn invisible for a while#
Where it goesThe player or ability Blueprint
- Tags is the player actor's own tag array. With InvisibleToAI in it, guards can't see, hear or capture the player, and nothing it does has witnesses.
- A body left behind is still found: that's evidence, not witnessing.
UI and scoring#
Listen to score events#
Where it goesThe GameMode, HUD or your scoring system
- Five events: Spotted Player, Detected Player, Noise Heard, Alarm Raised, Guard Dead. A guard reports Spotted Player and Noise Heard once per alert cycle.
- Put the Ghost Score component on the player and it scores automatically (starting at 1000); On Score Changed gives the new total, the change and the reason.
Tell the player they're in the dark#
Where it goesThe player Blueprint or HUD
- Is Location Dark uses the same rule as guards: dark only where an AI Light covers the spot and every light covering it is off.
- It doesn't need to run every frame; a Set Timer by Event every 0.2 seconds is plenty.