SetNpcSkin: Difference between revisions

From Wiki G1R-MP G1 Remake Multiplayer
Jump to navigation Jump to search
Update Lua API reference
 
Document new NPC/player-mode API and events available from 0.1.5
 
(One intermediate revision by the same user not shown)
Line 32: Line 32:
* Skin keys are listed in [[Player skin catalog]].
* Skin keys are listed in [[Player skin catalog]].


[[Category:Lua Functions]]
[[Category:Server Functions]]
[[Category:Server Functions]]
[[Category:World Functions]]
[[Category:World Functions]]
[[Category:NPC Functions]]
[[Category:NPC Functions]]
[[Category:Appearance Functions]]
[[Category:Appearance Functions]]
<!-- npc-appearance015:start -->
== Appearance API since 0.1.5 ==
Legacy surface preset, not an alias for [[setNpcIdentity]]. NPCs without an explicit identity retain the existing behaviour. From 0.1.5 use [[setNpcIdentity]] for a matched head/profile and [[setNpcSkinColor]] / [[setNpcTattoo]] for independent overrides. Once explicitly selected, identity takes precedence over legacy skin fallback.
<!-- npc-appearance015:end -->

Latest revision as of 17:37, 25 September 2026

setNpcSkin

Changes the authoritative skin of a resource-owned scripted NPC.

Syntax

bool setNpcSkin(int npcId, string itemKey)

Parameters

Name Type Required Description
npcId int yes The server-assigned NPC identifier returned by spawnNpc or getNpcs.
itemKey string yes A validated key returned by getPlayerSkinNames; armor and weapon accept none to clear the slot.

Returns

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

Examples

Change an NPC's skin:

setNpcSkin(npcId, "milten")

Notes

  • Available only in server-side resource scripts.
  • The state is sent reliably to current viewers and replayed on relevance entry and late join.
  • Raw Unreal object paths are never accepted from Lua.
  • Skin keys are listed in Player skin catalog.

Appearance API since 0.1.5

Legacy surface preset, not an alias for setNpcIdentity. NPCs without an explicit identity retain the existing behaviour. From 0.1.5 use setNpcIdentity for a matched head/profile and setNpcSkinColor / setNpcTattoo for independent overrides. Once explicitly selected, identity takes precedence over legacy skin fallback.