SetMonsterMaxHealth: Difference between revisions
Jump to navigation
Jump to search
Document Lua functions planned for G1R:MP update 0.1.2 |
Document Lua APIs available or improved from G1R:MP 0.1.2 |
||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
= setMonsterMaxHealth = | = setMonsterMaxHealth = | ||
<div style="background:# | <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:# | <div style="color:#111111; font-weight:bold; letter-spacing:0.04em;">AVAILABLE FROM UPDATE 0.1.2</div> | ||
<div style="color:# | <div style="color:#111111; margin-top:0.25rem;">This function is available in G1R:MP 0.1.2 and later. The contract below includes the compatibility guarantees introduced in that update.</div> | ||
</div> | </div> | ||
| Line 34: | Line 34: | ||
== Notes == | == Notes == | ||
* Available only in server-side resource scripts. | * Available only in server-side resource scripts. | ||
* Raising the maximum does not | * Raising the maximum does not heal the monster by itself. Lowering it atomically clamps current health to the new maximum. | ||
* Use <code>setMonsterHealth</code> after this call when an elite or boss should start at full health. | * Use <code>setMonsterHealth</code> after this call when an elite or boss should start at full health. | ||
Latest revision as of 18:39, 3 September 2026
setMonsterMaxHealth
AVAILABLE FROM UPDATE 0.1.2
This function is available in G1R:MP 0.1.2 and later. The contract below includes the compatibility guarantees introduced in that update.
Changes a monster's authoritative maximum health for elite and boss variants.
Syntax
bool setMonsterMaxHealth(string monsterId, number maxHealth)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
monsterId |
string |
yes | The opaque decimal monster identifier returned by spawnMonster or getMonsters.
|
maxHealth |
number |
yes | A finite maximum-health value greater than 0 and no greater than 1000000. |
Returns
Returns true when the new maximum is accepted and replicated; otherwise returns false.
Examples
Create a tougher encounter and then fill its health:
if setMonsterMaxHealth(monsterId, 2500) then
setMonsterHealth(monsterId, 2500)
end
Notes
- Available only in server-side resource scripts.
- Raising the maximum does not heal the monster by itself. Lowering it atomically clamps current health to the new maximum.
- Use
setMonsterHealthafter this call when an elite or boss should start at full health.