SetNpcArmor: Difference between revisions
Update Lua API reference |
Release 0.1.9 / BUILD264 / Protocol42: availability and download setup; preserve experimental limits |
||
| (3 intermediate revisions by the same user not shown) | |||
| Line 32: | Line 32: | ||
* Use <code>getPlayerArmorNames</code> to enumerate supported keys. | * Use <code>getPlayerArmorNames</code> to enumerate supported keys. | ||
[[Category:Lua Functions]] | |||
[[Category:Server Functions]] | [[Category:Server Functions]] | ||
[[Category:World Functions]] | [[Category:World Functions]] | ||
[[Category:NPC Functions]] | [[Category:NPC Functions]] | ||
[[Category:Equipment Functions]] | [[Category:Equipment Functions]] | ||
<!-- npc-appearance015:start --> | |||
== Appearance API since 0.1.5 == | |||
From 0.1.5 [[setNpcIdentity]], [[setNpcSkinColor]] and [[setNpcTattoo]] remain independent of armor. Changing or removing armor does not clear these values. Covered skin/tattoo regions naturally remain hidden by garments. | |||
<!-- npc-appearance015:end --> | |||
<!-- armor019:start --> | |||
== Armor parts (from 0.1.9) == | |||
Available from 0.1.9. [[Armor catalog]] lists the 26 bases; [[Armor upgrade catalog]] lists all 84 pieces. This existing function/guide is not newly introduced in 0.1.9. The new [[Armor upgrades|upgrade system]] adds per-character top/mid/bottom selections, full presets and separate player/NPC setters. A different base clears the old parts; choosing the same base keeps compatible selections. Identity, skin tint and tattoos remain separate. See the guide for requirements, safe replacement and synchronization validation. | |||
<!-- armor019:end --> | |||
Latest revision as of 13:29, 20 October 2026
setNpcArmor
Changes the authoritative armor of a resource-owned scripted NPC.
Syntax
bool setNpcArmor(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 getPlayerArmorNames; 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 armor:
setNpcArmor(npcId, "none")
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.
- Use
getPlayerArmorNamesto enumerate supported keys.
Appearance API since 0.1.5
From 0.1.5 setNpcIdentity, setNpcSkinColor and setNpcTattoo remain independent of armor. Changing or removing armor does not clear these values. Covered skin/tattoo regions naturally remain hidden by garments.
Armor parts (from 0.1.9)
Available from 0.1.9. Armor catalog lists the 26 bases; Armor upgrade catalog lists all 84 pieces. This existing function/guide is not newly introduced in 0.1.9. The new upgrade system adds per-character top/mid/bottom selections, full presets and separate player/NPC setters. A different base clears the old parts; choosing the same base keeps compatible selections. Identity, skin tint and tattoos remain separate. See the guide for requirements, safe replacement and synchronization validation.