DestroyNpc
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.