Death, wake, shield, orb, arrival
Soul respawn internals
A complete replacement for the engine respawn flow. It is a respawn template, not a script you call: the engine runs the hooks, and the template holds the player's respawn until the orb reaches a destination.
Authority and entry points
The component registers CfgRespawnTemplates.FF_Horror_Soul with
onPlayerKilled and onPlayerRespawn pointing at
x\FF\addons\horror\scripts\*.sqf. Those files are thin execVM entry points for
FF_horror_fnc_onPlayerKilled and FF_horror_fnc_onPlayerRespawn.
Everything else runs locally on the dead player's machine, so no network round trip is required to animate a death.
| Stage | Function | Runs on |
|---|---|---|
| Arm the hold | armSoulRespawn | Local player, on unit change |
| Death | onPlayerKilled | Local player |
| Wake bar | wakeSoul | Local player |
| Destination search | seekRespawn | Local player |
| Position validation | soulSpawnPosition | Local player |
| Release | finishSoulRespawn | Local player |
| Install | onPlayerRespawn | Local player |
| Recovery | zeusSoulEmergency | Zeus request → local player |
| Consumable | soulShieldRequest / soulShieldConsume / soulShieldResult | Client → server → client |
1. Arming before death
armSoulRespawn resolves the effective template list. It first tries the side-specific key
(respawnTemplatesWest, East, Guer, Civ) and falls back to the global
respawnTemplates. If FF_Horror_Soul is not listed, the function does nothing. If it is listed,
the local player's respawn is pushed to 99999 seconds and a Killed handler is installed once
per unit. That handler re-arms the hold and calls onPlayerKilled, because a zero-delay mission can
otherwise spawn a replacement before the template hook runs.
2. The death sequence
State snapshot
A state hash map is created: body, class, UID, name, loadout, facewear, death position, spawn position, phase, readiness and any early replacement unit. CBRN visuals are suspended and the blur effect is destroyed so the corpse camera is clean.
Corpse camera
A local camera orbits the body at 3 m radius, 1.8 m height, 1.8 rad/s, without cinematic borders. The camera
is a per-frame handler, not a camCommit chain, so it keeps tracking a corpse that Zeus drags around.
Wake bar
wakeSoul creates a structured text and progress control on display 46 and installs KeyDown/KeyUp
handlers for wakeKey (Space by default). Progress is capped at 30% of wakeGoal until a
shield is applied. Decay is constant while shielded and increases with progress while unshielded. The function
returns true only when the bar reached the goal and the body is shielded.
Rise
Phase rise: a local Sign_Sphere10cm_F orb rises 1.2 m over three seconds, then a white
fade hands control to the orb. If a Zeus action sets forceRespawn, the orb is deleted and the sequence
short-circuits.
Seek
EG Spectator starts, the orb follows the free camera, optional 3D lines point at candidates, and every
searchInterval the finder runs. Candidates come from the mission callback or
nearestObjects, plus nearestTerrainObjects filtered by class, so map props without a
simulation entity still work. The player must first move more than 3 m from the start, then approach within
arrivalDistance of the nearest candidate.
Arrival
The orb travels to the destination over two seconds while a local camera watches. The destination position is kept in a local variable so deleting the prop mid-cutscene cannot move the respawn.
Position resolution and release
resolveSpawn may override the coordinate. soulSpawnPosition then runs
findEmptyPosition near the destination and falls back to a wider search near the death position,
rejecting water and slopes below 0.5 normal Z. finishSoulRespawn sets the state to ready and releases
the engine respawn with setPlayerRespawnTime 0, or applies the state to an early unit directly.
3. The shield economy
soulShieldActions installs one ACE interaction on every client. Using it sends
FF_horror_soulShieldRequest to the server. soulShieldRequest validates the actor, distance
and target, then soulShieldConsume removes FF_Horror_SoulShield from the corpse first and
from the helper second, leaving FF_Horror_SoulShield_Empty in the inventory that supplied it. The result
is broadcast so both players see the same outcome, and the corpse keeps a receipt so a retried request cannot consume
twice.
4. Failure handling
| Situation | Behaviour |
|---|---|
| Mission respawn template disabled | Immediately releases the respawn. |
| Corpse deleted mid-sequence | Deleted handler runs emergency recovery at the saved death position. |
| Engine spawns the unit early | The unit is hidden, simulation disabled, and applied when the sequence finishes. |
| No valid destination | Falls back to the death position; if that fails the engine placement is kept. |
| Stuck callback or cutscene | Zeus emergency recovery terminates the script, clears UI/camera handlers and releases the hold. |
| Another death during the sequence | The new state replaces the old one and the previous sequence is terminated. |
5. Extension points
FF_horror_configbefore the first death for tuning and callbacks.findDestinations/resolveSpawnto replace the geometry rules entirely.onDestinationfor scene-specific arrival effects,onRespawnfor post-spawn logic.- Zeus Soul tools for live recovery; it calls
zeusSoulCommandandzeusSoulApplyon the affected client.
Related functions
FF_horror_fnc_getConfig— Builds effective horror settings from CBA settings and mission overrides.FF_horror_fnc_onPlayerKilled— Starts the configurable wake and soul search sequence after death.FF_horror_fnc_wakeSoul— Space-bar struggle at the corpse. A shield is required to finish.FF_horror_fnc_seekRespawn— Lets a dead player fly as a soul to a configurable respawn object.FF_horror_fnc_finishSoulRespawn— Release the held respawn after either the altar scene or a Zeus recovery.FF_horror_fnc_onPlayerRespawn— Restores loadout and moves the respawned player to the selected destination.FF_horror_fnc_soulShieldRequest— Server-side arbitration for using one soul shield on a player corpse.FF_horror_fnc_zeusSoulEmergency— Hard recovery when a soul script is stalled inside a callback or cutscene.