• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] GetUnitLife without %

Status
Not open for further replies.

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
JASS:
native GetWidgetLife takes widget whichWidget returns real
constant native GetUnitState takes unit whichUnit,unitstate whichUnitState returns real

constant unitstate UNIT_STATE_LIFE=ConvertUnitState(0)
constant unitstate UNIT_STATE_MAX_LIFE=ConvertUnitState(1)

The function you mention does not even exist as far as I can tell...
 
Level 17
Joined
Feb 11, 2011
Messages
1,860
If you want to get the unit's current life, use GetWidgetLife(whichUnit).
However, if you want to get the unit's current mana, maximum mana or maximum life, you must use GetUnitState(whichUnit, whichUnitState).
The available unit states are:
JASS:
UNIT_STATE_LIFE
UNIT_STATE_MAX_LIFE
UNIT_STATE_MANA
UNIT_STATE_MAX_MANA
 
Level 3
Joined
Jan 1, 2012
Messages
50
ok ty all. (and yes, i confused with SetUnitLifePercentBJ ;))

but GetWiigdetLife takes a widget, and magtheridon say "you can use GetWidgetLife(unit)" and after "GetWidgetLife also works for destructables and items."

i don't understand :/
 
Status
Not open for further replies.
Top