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
FieldTypeDescription
idnumberNPC ID, unique within its area.
areaarea or nilThe area the NPC belongs to, or nil while it is unloaded.
existsbooleanThe NPC (or its corpse) still exists.
aliveboolean
kindstringbandit, guard, military, nomad, bogeyman, punisher, or the AI scene path for anything else.
healthnumber
positionposition
behaviorstringThe 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.