SetNpcArmorPreset: Difference between revisions
Jump to navigation
Jump to search
Document armor catalogs and eight armor-upgrade Lua APIs from upcoming 0.1.9; public release unchanged |
Release 0.1.9 / BUILD264 / Protocol42: availability and download setup; preserve experimental limits |
||
| Line 2: | Line 2: | ||
<div style="background:#fff5f5; border:1px solid #d13b3b; border-left:5px solid #d13b3b; color:#111111; padding:0.85rem 1rem; margin:0.75rem 0 1rem;"> | <div style="background:#fff5f5; border:1px solid #d13b3b; border-left:5px solid #d13b3b; color:#111111; padding:0.85rem 1rem; margin:0.75rem 0 1rem;"> | ||
<div style="color:#111111; font-weight:bold; letter-spacing:0.04em;">AVAILABLE FROM UPDATE 0.1.9</div> | <div style="color:#111111; font-weight:bold; letter-spacing:0.04em;">AVAILABLE FROM UPDATE 0.1.9</div> | ||
<div style="color:#111111; margin-top:0.25rem;">Available from 0.1.9 | <div style="color:#111111; margin-top:0.25rem;">Available from 0.1.9.</div> | ||
</div> | </div> | ||
| Line 34: | Line 34: | ||
== Notes == | == Notes == | ||
* Server-side only; available from 0.1.9 | * Server-side only; available from 0.1.9. | ||
* See [[Armor upgrades]], [[Armor catalog]] and [[Armor upgrade catalog]]. | * See [[Armor upgrades]], [[Armor catalog]] and [[Armor upgrade catalog]]. | ||
* Only the resource owning the NPC may change its parts. No player-inventory or player-requirement check is applied to NPCs. | * Only the resource owning the NPC may change its parts. No player-inventory or player-requirement check is applied to NPCs. | ||
Latest revision as of 13:29, 20 October 2026
setNpcArmorPreset
AVAILABLE FROM UPDATE 0.1.9
Available from 0.1.9.
Selects an authored armor preset for the currently equipped base.
Syntax
accepted = setNpcArmorPreset(npcId, preset)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
npcId |
number |
yes | Existing scripted human NPC ID: finite integer 1..4294967295, not a numeric string. |
preset |
string |
yes | light_1, light_2, medium_1, medium_2, heavy_1, heavy_2, or none to clear selected parts. |
Returns
Boolean: true when accepted; false for invalid/unavailable ID, unknown/inapplicable preset, or failed validation/ownership/requirements. none clears parts without removing the base.
Examples
-- npcId is an existing human NPC created by this resource.
assert(setNpcArmor(npcId, "mercenary"))
assert(setNpcArmorPreset(npcId, "heavy_2"))
local parts = getNpcArmorUpgrades(npcId)
if parts then outputDebugString(parts.top) end
Notes
- Server-side only; available from 0.1.9.
- See Armor upgrades, Armor catalog and Armor upgrade catalog.
- Only the resource owning the NPC may change its parts. No player-inventory or player-requirement check is applied to NPCs.
- Uses the already equipped base; never selects a different base. The part must match its family and slot.
- true confirms server acceptance, not completed native rendering. No automatic healing/refill or database save.
- Treat remote requests as untrusted; authorize the action in your server resource.
- Sparse families use only existing parts up to the requested tier, so different presets may select the same pieces. Query getArmorUpgradePresets first.
- Equivalent alias: SetNpcArmorPreset.