SetMonsterMaxHealth

From Wiki G1R-MP G1 Remake Multiplayer
Jump to navigation Jump to search

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 setMonsterHealth after this call when an elite or boss should start at full health.