Docs/API
NPCs
Fields and methods of NPC handles in rtv-mp scenario scripts, including health, position, faction and kill.
API version 1Lua 5.1Updated 2026-11-07
| Field | Type | Description |
|---|---|---|
id | number | NPC ID, unique within its area. |
area | area or nil | The area the NPC belongs to, or nil while it is unloaded. |
exists | boolean | The NPC (or its corpse) still exists. |
alive | boolean | |
kind | string | bandit, guard, military, nomad, bogeyman, punisher, or the AI scene path for anything else. |
health | number | |
position | position | |
behavior | string | The AI's current state, such as "Idle", "Wander", "Patrol", "Hunt", "Combat", "Cover" or "Loot". Informational; the names follow the game's AI and may change. |
Every field except id and area is nil once the NPC no longer exists, and methods return nil, "npc no longer exists".
npc:kill()#
Returns: true, or nil, err
Kills the NPC as a fatal hit would: it leaves a lootable corpse, and a Nomad's death counts like any Nomad death. Fails if it is already dead. npc_killed fires on the following tick.
Found a mistake or missing detail? Tell us in the Discord.
rtv-mp