SetNpcName

From Wiki G1R-MP G1 Remake Multiplayer
Revision as of 11:32, 15 August 2026 by QCherry (talk | contribs) (Document player latency and NPC naming APIs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

setNpcName

Changes the validated overhead display name of a resource-owned scripted NPC.

Syntax

bool setNpcName(int npcId, string name)

Parameters

Name Type Required Description
npcId int yes The server-assigned NPC identifier returned by spawnNpc or getNpcs.
name string yes A display name containing 3-16 safe characters.

Returns

Returns true when the name is accepted and replicated; otherwise returns false.

Examples

Rename a guard after a promotion:

if setNpcName(npcId, "Gate Captain") then
    outputDebugString("NPC renamed")
end

Notes

  • Available only in server-side resource scripts.
  • Only the resource that created the NPC may rename it.
  • The validated name is sent to current viewers and replayed during relevance entry and late join.
  • This emits onNpcNameChange when accepted.