SetNpcMaxHealth: Difference between revisions
Release G1R:MP 0.1.5 BUILD144 / Protocol 37; update availability and migration |
Document planned 0.1.9 item stats, armor, runes and experimental map-editor seats/lights; not a release |
||
| Line 38: | Line 38: | ||
[[Category:Server Functions]] | [[Category:Server Functions]] | ||
[[Category:NPC Functions]] | [[Category:NPC Functions]] | ||
<!-- upcoming019:start --> | |||
== Item-type armor bonuses (planned for 0.1.9) == | |||
[[Item type stats]] adds explicit armor bonusHealth/bonusMana/bonusStrength/bonusDexterity contributions for equipped scripted NPCs, plus the armor protection profile. Unconfigured native bonuses do not silently change existing NPC balance. Base stats and bonuses are separate; raising maxima does not heal/refill and lowering maxima clamps current values without reviving dead NPCs. | |||
setNpcMaxHealth/setNpcMaxMana set BASE maxima; getNpcMaxHealth/getNpcMaxMana return EFFECTIVE maxima. setNpcCombatConfig/getNpcCombatConfig dexterity is BASE dexterity. getNpcData adds baseMaxHealth, baseMaxMana, baseDexterity, mana, maxMana, dexterity, armorHealthBonus, armorManaBonus, armorStrengthBonus and armorDexterityBonus. | |||
NPC melee includes explicit armor strength and ranged combat uses effective dexterity. Numeric refresh preserves accepted attack/projectile snapshots; it does not reload ammo or restart prepared casts. NPC toughness and NPC jewelry are not implemented by this addition. These are extensions to existing APIs, not new names or a replacement for their earlier contracts. Not included in public 0.1.8. | |||
<!-- upcoming019:end --> | |||
Revision as of 20:11, 18 October 2026
setNpcMaxHealth
Sets NPC maximum health.
Syntax
setNpcMaxHealth(npcId, maxHealth)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
npcId |
int |
yes | Server-assigned NPC ID returned by spawnNpc; not a player ID. |
maxHealth |
number |
yes | Finite 1..100000; lowering clamps current HP, raising does not heal. |
Returns
Returns true when accepted, false for a rejected request. Acceptance is not proof of a rendered animation, projectile release or hit.
Examples
setNpcMaxHealth(npcId, 100)
Notes
- Server-side only. Mutations require the NPC to belong to the calling resource; getters do not grant control.
- Since 0.1.5. Use the matching 0.1.5 client and server (Protocol 37).
- Use matching updated client and server. See NPC scripting for lifecycle, defaults, combat examples and collision limitations.
- Changing maxHP does not automatically heal. Script HP is separate from armor protection.
Item-type armor bonuses (planned for 0.1.9)
Item type stats adds explicit armor bonusHealth/bonusMana/bonusStrength/bonusDexterity contributions for equipped scripted NPCs, plus the armor protection profile. Unconfigured native bonuses do not silently change existing NPC balance. Base stats and bonuses are separate; raising maxima does not heal/refill and lowering maxima clamps current values without reviving dead NPCs.
setNpcMaxHealth/setNpcMaxMana set BASE maxima; getNpcMaxHealth/getNpcMaxMana return EFFECTIVE maxima. setNpcCombatConfig/getNpcCombatConfig dexterity is BASE dexterity. getNpcData adds baseMaxHealth, baseMaxMana, baseDexterity, mana, maxMana, dexterity, armorHealthBonus, armorManaBonus, armorStrengthBonus and armorDexterityBonus.
NPC melee includes explicit armor strength and ranged combat uses effective dexterity. Numeric refresh preserves accepted attack/projectile snapshots; it does not reload ammo or restart prepared casts. NPC toughness and NPC jewelry are not implemented by this addition. These are extensions to existing APIs, not new names or a replacement for their earlier contracts. Not included in public 0.1.8.