NPC Lifecycle & Ground Loot
How wildlife and hostile NPCs die, leave loot in the world, despawn carcasses, and respawn from anchors.
See also: Complete Combat System, Death & Respawn (players).
1. Death flow
When an NPC’s HP reaches 0:
Players pick up piles with the normal interact / pickup path. Butcher harvest uses the resource-node harvest channel (same as other timed nodes). The death marker is display only (not harvestable).
2. Respawn (per NPC definition)
Authored on the NPC (respawn block) and optionally overridden on a wildlife spawn anchor.
| Field | Meaning |
|---|---|
enabled |
When false, that def never auto-respawns (bosses, unique encounters, town civilians) |
delay_ticks |
Wait after death (30 Hz ticks) before a new instance may spawn |
max_instances_per_anchor |
Cap on alive instances tied to that anchor |
block_while_corpse |
When true, delay respawn until the carcass is gone (harvested or TTL) |
Location: default is the same wildlife spawn anchor (scatter in radius_m). Home position for leash / return is established at spawn.
Population counting uses alive instances only — a death frees a slot; respawn fills up to the cap.
3. Ground drops
Death loot from loot_table.drops becomes GroundDrop entities in the world (not auto-granted to the killer’s inventory).
| Rule | Behavior |
|---|---|
| Placement | Scatter disk ~0.5–1.5 m around death position |
| Ownership | Killer-only for a short window, then free-for-all |
| Default FFA delay | ~30 s (ffa_delay_ticks ≈ 900 @ 30 Hz) |
| Despawn | Non-permanent piles expire; permanent: true entries persist |
| Snapshot | Included in region world snapshot / AOI views |
| Unique instances | Each pile carries a full inventory slot (instance_id, props, enchants). Player drops preserve the exact item; loot/harvest mint a new unique instance when the pile spawns. Pickup restores that slot — never collapses to a bare template stack (specification). |
Pickup validates range and ownership timer. Anyone may take a pile after FFA opens.
Drop origin: each pile records why it exists (loot = harvest/monster, player_drop = intentional inventory drop, world_spawn = authored pickup). Hired companions only auto-scoop loot piles — never swords/kilns you deliberately dropped.
Deep-water midden: leftover bulk dropped beside a kind with drop_sink_secs (deep water is 60s) is tossed onto that cell with a recover window. The HUD shows Recover and a countdown; f scoops it before it sinks. Relics (non-stackable, enchanted, named, keys, deeds, containers) never sink — they stay on the bank. Inventory Destroy is rejected.
4. Carcass / butcher
Separate from ground piles:
- A carcass resource node appears when the loot table defines carcass harvest outputs (meat, pelt, hide, …).
- Harvest is a timed channel; products go to the harvester’s inventory.
- TTL removes unharvested carcasses so the world does not fill with permanent corpses.
- When
block_while_corpseis set, respawn waits for carcass removal (not the later death-marker TTL). - After the carcass is gone (harvest or TTL), a death-marker sprite appears for ~30s (settings default). If the table has no carcass harvest, the marker shows immediately.
4b. Death markers (gfx)
Death-marker art is not on the loot table. Always on.
| Source | Sprite | Timeout |
|---|---|---|
Settings death_markers |
Wildlife → resource.carcass; humanoid/player → resource.carcass_humanoid |
default_ttl_ticks 900 (~30s @ 30 Hz) |
NPC death_marker.tile_id / ttl_ticks |
Optional override (e.g. wolf uses resource.carcass_skull) |
Optional override |
| Admin | Settings → Death markers (sprite pickers + TTL); NPCs → Wildlife → Death marker (per-NPC sprite + TTL) | — |
Markers are AOI world objects (death_markers on the tick), persisted in the region snapshot, and never harvestable.
5. Content map
| Asset | Role |
|---|---|
the content files*.yaml → respawn |
Per-def respawn policy |
the content files*.yaml → death_marker |
Optional sprite / TTL override (defaults from settings) |
the content files → death_markers |
Default sprite + 30s TTL |
the content files*.yaml |
Drop tables + carcass harvest rows (not death-marker gfx) |
the content files*.yaml → wildlife_spawns |
Anchors, counts, optional respawn overrides |
| content editor NPCs / Loot / Map | Designer editing surfaces |
6. Player corpses
As shipped: player death teleports to the nearest shrine and leaves a death-marker sprite at the death tile for ~30s (resource.carcass_humanoid, settings TTL). Display only — not a lootable corpse.
A future lootable player corpse (inventory snapshot, FFA) is described in Death & Respawn. Wildlife lifecycle above is the NPC/hunting path.