SetMonsterHealth: Difference between revisions

From Wiki G1R-MP G1 Remake Multiplayer
Jump to navigation Jump to search
Document server-owned monsters and interactions
 
Complete Lua function catalog
Line 31: Line 31:
* Setting health to zero transitions the monster into the server-owned death state.
* Setting health to zero transitions the monster into the server-owned death state.


[[Category:Lua Functions]]
[[Category:Server Functions]]
[[Category:Server Functions]]
[[Category:World Functions]]
[[Category:World Functions]]
[[Category:Monster Functions]]
[[Category:Monster Functions]]

Revision as of 09:55, 15 August 2026

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.