en-respawn handles dying and waking up again. When a player dies, the HUD hides and, after 1.5 seconds, a death screen opens over a slow camera pulling away from the body. It tells you how you died ("Another survivor put you down.", for example), how long you survived, and counts down the wait (20 seconds by default).
When the wait is over, the player picks a spawn point (if choosing is enabled) and holds E for 1.5 seconds to wake up at a safe location with 60% health and reset hunger, thirst, radiation, infection and temperature. Whatever they dropped stays where they fell. Logging out while dead and back in does not skip the wait, and an admin or medic revive closes the screen.
At a glance
| Depends on | en-core, en-ui |
| Optional | en-hud (hidden while dead), en-multicharacter (reopens the screen for players who logged in dead), en-admin (Build tab for spawn points) |
| Database tables | None. Placed spawn points are stored by en-core's content registry |
| Config files | config/shared.lua |
| Key binds | None (E is handled inside the death screen) |
en-core itself has no respawn logic; it only marks the player dead. See World and death.
How it works
- en-core marks the player dead (metadata
isdead). The server records the time of death. The client works out the cause and opens the death screen after 1.5 seconds, with the HUD hidden, controls disabled and a death camera. - The screen counts down the remaining wait. The server rejects a wake request before
Config.delayhas passed, and guards against double presses. - On wake, the server uses the chosen spawn (or a random one), applies
Config.wakeStats, clearsisdeadandinlaststand, and firesen-respawn:server:respawned. - The client fades out, streams the area, resurrects the player at the spawn, sets health to
Config.health, and fades in with a "You wake up" message.
If isdead is set back to false by something else, such as an admin revive, the death screen closes.
Spawn points
Spawn points come from Config.spawns plus any placed in game with the en-admin Build tab (content kind 'spawn'). A placed spawn with the same id as a config entry replaces it; deleting the placement restores the config version. Keep spawn points inside safe zones so players don't wake up next to a horde.
Configuration
config/shared.lua:
| Key | Default | What it does |
|---|---|---|
Config.delay | 20 s | Wait before waking (enforced server-side) |
Config.key | 'E' | Key to hold on the death screen |
Config.holdTime | 1.5 s | How long to hold it |
Config.choose | true | Player picks a spawn; false = random |
Config.health | 0.6 | Share of health on waking (minimum 0.05) |
Config.wakeStats | { hunger = 60, thirst = 60, radiation = 0, infection = 0, temperature = 98.6 } | Metadata set on wake; stats not listed are kept |
Config.spawns | burton, sandy, paleto | Spawn list, each { id, label, description, coords = vec4 } |
Default spawns:
| id | Label | Coords |
|---|---|---|
burton | Burton Checkpoint | vec4(-252.0, -303.0, 21.6, 160.0) |
sandy | Sandy Shores Camp | vec4(1853.8, 3689.4, 34.3, 210.0) |
paleto | Paleto Bay Outpost | vec4(-448.0, 6008.0, 31.7, 315.0) |
A harsher death with a longer wait, no choice and hungry survivors:
-- config/shared.lua
Config.delay = 60
Config.choose = false
Config.health = 0.4
Config.wakeStats = { hunger = 30, thirst = 30, radiation = 0, infection = 0, temperature = 98.6 }
Config.spawns = {
{ id = 'burton', label = 'Burton Checkpoint', description = 'Guarded and fenced.', coords = vec4(-252.0, -303.0, 21.6, 160.0) },
{ id = 'zancudo', label = 'Zancudo Bunker', description = 'Concrete and quiet.', coords = vec4(-2350.0, 3250.0, 32.8, 90.0) },
}Exports
Server exports on exports['en-respawn']:
| Export | Arguments | Returns |
|---|---|---|
GetRespawnWait | source | Seconds remaining, or nil if alive |
BuilderList, BuilderGet, BuilderValidate, BuilderSchema, BuilderTemplate | kind, ... | en-admin Build tab integration for kind 'spawn' (fields: label, description, coords with heading) |
Events
| Event | Side | Payload |
|---|---|---|
en-respawn:server:respawned | Server local | src, spawnId. Fired after the metadata reset, before the client teleports |
en-respawn listens to encore:server:playerDied on the server, and on the client to encore:client:playerDied (killer, cause), encore:client:playerRevived, encore:client:onSetMetaData, encore:client:playerLoaded, encore:client:playerUnloaded and en-multicharacter:client:spawned.
Its UI uses two callbacks: en-respawn:state returns { dead, remaining, spawns? }, and en-respawn:wake (spawnId) returns { ok, label, coords } or { ok = false, error }.
Examples
Give a small kit to anyone who wakes up at the Paleto outpost:
-- server
AddEventHandler('en-respawn:server:respawned', function(src, spawnId)
if spawnId == 'paleto' then
encore.inventory.addItem(src, 'water', 1)
encore.inventory.addItem(src, 'bandage', 1)
end
end)Show a dead player how long they still have to wait:
-- server
local wait = exports['en-respawn']:GetRespawnWait(source)
if wait then
encore.notify(source, { title = 'Respawn', description = ('%d seconds left'):format(wait), type = 'inform' })
endRelated
- World and death
- Survival system
- en-inventory (death bags)
- en-admin