Page 1 of 1

Getting maximum health.

Posted: 07 Mar 2014, 23:09
by code_man
I need the maximum health of a unit including veterancy bonus.

I tried the Spring.GetUnitHealth function but that didnt work and i dont know even if thats the right function for that since i couldnt make much sense out of the discription.

Re: Getting maximum health.

Posted: 07 Mar 2014, 23:34
by CarRepairer
Spring.GetUnitHealth
( number unitID ) -> nil | number health, number maxHealth, number paralyzeDamage,
number captureProgress, number buildProgress
http://springrts.com/wiki/Lua_SyncedRead

The function returns multiple return values. You might be looking just at the first one. Try

Code: Select all

health, maxHealth = Spring.GetUnitHealth(...)

Re: Getting maximum health.

Posted: 07 Mar 2014, 23:42
by Jools
But does that return nominal maximum health or the current (veteran bonus corrected) one? I think it returns the current maxhealth. If so, how does one get the nominal one?

Re: Getting maximum health.

Posted: 07 Mar 2014, 23:56
by FLOZi
Jools wrote:But does that return nominal maximum health or the current (veteran bonus corrected) one? I think it returns the current maxhealth. If so, how does one get the nominal one?
UnitDefs[unitDefID].health