DestroyNpc

From Wiki G1R-MP G1 Remake Multiplayer
Revision as of 09:48, 15 August 2026 by QCherry (talk | contribs) (Update Lua API reference)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

destroyNpc

Removes a scripted NPC owned by the current resource.

Syntax

bool destroyNpc(int npcId)

Parameters

Name Type Required Description
npcId int yes The server-assigned NPC identifier returned by spawnNpc or getNpcs.

Returns

Returns true when the NPC existed, belonged to the caller and was removed; otherwise returns false.

Examples

Remove a temporary quest NPC:

destroyNpc(npcId)

Notes

  • Available only in server-side resource scripts.
  • Relevant clients receive a reliable despawn and this emits onNpcDestroy.