UnitGetPropertyInt
fixed UnitGetPropertyFixed (unit u, int property, bool current);
Property of a unit.
Parameters
- unit u
Unit to get the property
- int property
Property of the unit. Can be one of
- 0 (c_unitPropLife): Life
- 1 (c_unitPropLifePercent): Life in percent.
- 2 (c_unitPropLifeMax): Maximum life
- 3: Unknown. Seen values: 0.27
- 4 (c_unitPropEnergy): Energy
- 5 (c_unitPropEnergyPercent): Energy in percent
- 6 (c_unitPropEnergyMax): Maximum energy
- 7: Unknown
- 8 (c_unitPropShields): Shield
- 9 (c_unitPropShieldsPercent): Shield in percent
- 10 (c_unitPropShieldsMax): Maximum shield
- 11: Unknown. Seen values: 1
- 12: Unknown. Seen values: 1, 2
- 13: Unknown
- 14: Unknown
- 15 (c_unitPropVitality): Vitality
- 16 (c_unitPropVitalityPercent): Vitality in percent.
- 17 (c_unitPropVitalityMax): Maximum vitality
- 18: Unknown. Seen values: 2.5
- 19: Unknown
- 20: Unknown. Seen values: 2.8125
- 21: Unknown. Seen values: 999.84, 720
- 22: Unknown
- 23: Unknown. Seen values: 0.375
- 24: Object ID. Each time an object (unit, building, doodad ...) is created on the map it gets a unique ID.
Notes
- Percentage values make the game crash when current = false. Probably because of a division by 0.
Return value
fixed - Value of the property of the unit
Examples
- Example: IsUnitDying
bool isUnitDying(unit u) { // Return true if the unit has less that 5% of life return UnitGetPropertyFixed(u, c_unitPropVitalityPercent, c_unitPropCurrent) < 5; }
- 1 comment
- 1 comment
- Reply
- #1
Chriamon Jun 23, 2010 at 15:52 UTC - 0 likesWould it be correct to assume that Vitality is Shield + Life?