Health scripts

From Spring
Revision as of 14:15, 13 November 2012 by Emmanuel (talk | contribs) (AnimDef health check code exemple)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

know the health of the unit in AnimDef

  • read the "damage" full health in UnitDef data:

local maxhealth

maxhealth=Spring.GetUnitHealth(unitID)


  • get the % actual of full health:

local health

health=GetUnitValue(4)--HEALTH 4 // get (0-100%)--


  • avoid to control health before unit was fully built :

local builtremain

builtremain=Spring.UnitScript.GetUnitValue(17)--BUILD_PERCENT_LEFT 17// self built % remain 100to0%