SetMonsterHealth

From Wiki G1R-MP G1 Remake Multiplayer
Revision as of 04:26, 14 August 2026 by QCherry (talk | contribs) (Document server-owned monsters and interactions)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

setMonsterHealth

Sets a monster's authoritative health.

Syntax

bool setMonsterHealth(string monsterId, number health)

Parameters

Name Type Required Description
monsterId string yes The opaque decimal monster identifier returned by spawnMonster or getMonsters.
health number yes The non-negative health value to apply.

Returns

Returns true when the value is accepted; otherwise returns false.

Examples

Restore a monster to full health:

local health, maximum = getMonsterHealth(monsterId)
setMonsterHealth(monsterId, maximum)

Notes

  • Available only in server-side resource scripts.
  • Setting health to zero transitions the monster into the server-owned death state.