DestroyNpc: Difference between revisions

From Wiki G1R-MP G1 Remake Multiplayer
Jump to navigation Jump to search
Update Lua API reference
 
Complete Lua function catalog
 
Line 28: Line 28:
* Relevant clients receive a reliable despawn and this emits <code>onNpcDestroy</code>.
* Relevant clients receive a reliable despawn and this emits <code>onNpcDestroy</code>.


[[Category:Lua Functions]]
[[Category:Server Functions]]
[[Category:Server Functions]]
[[Category:World Functions]]
[[Category:World Functions]]
[[Category:NPC Functions]]
[[Category:NPC Functions]]

Latest revision as of 09:52, 15 August 2026

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.