SetNpcIdentity

From Wiki G1R-MP G1 Remake Multiplayer
Jump to navigation Jump to search

setNpcIdentity

AVAILABLE FROM UPDATE 0.1.5
This function is available in G1R:MP 0.1.5 and later. The contract below includes the compatibility guarantees introduced in that update.

Selects the matched head/identity profile of an NPC.

Syntax

setNpcIdentity(npcId, identity)

Parameters

Name Type Required Description
npcId int yes NPC ID returned by spawnNpc; not a player ID.
identity string yes Named identity from getNpcIdentityNames, or default. ASCII case-insensitive, at most 48 bytes; not an asset path.

Returns

true when accepted, false when invalid, unavailable or owned by another resource.

Examples

setNpcIdentity(npcId, "milten")

Notes

  • Server-side only. Mutations require the resource that owns this NPC; getters do not grant control.
  • Available from update 0.1.5. See NPC scripting#NPC appearance since 0.1.5.
  • The authoritative state is replayed for relevance entry/late join. Rendering is asynchronous; acceptance does not mean the mesh has finished rebuilding.
  • Does not change authoritative HP, weapons, armor, routes or combat configuration. No automatic persistent database storage.
  • Upper-initial alias SetNpcIdentity is also supported.
  • Use default to explicitly restore the Nameless Hero identity. Preserves armor, skin-color and tattoo overrides. Does not replace the whole NPC outfit. Existing setNpcSkin remains a separate legacy preset.