The search keyword must be a single word (no spaces).
Function GetUnitStatePercent
- Line
- 3524
- Location
- blizzard.j
- Constant?
- no
- Type
- function
- Arguments
- unit whichUnit, unitstate whichState, unitstate whichMaxState
- Returns
- real
| 3524 | function GetUnitStatePercent takes unit whichUnit, unitstate whichState, unitstate whichMaxState returns real |
| 3525 | local real value = GetUnitState(whichUnit, whichState) |
| 3526 | local real maxValue = GetUnitState(whichUnit, whichMaxState) |
| 3527 | |
| 3528 | // Return 0 for null units.
|
| 3529 | if (whichUnit == null) or (maxValue == 0) then |
| 3530 | return 0.0 |
| 3531 | endif
|
| 3532 | |
| 3533 | return value / maxValue * 100.0 |
| 3534 | endfunction
|
Information about GetUnitStatePercent
City17
4 years
returns the current unit state, in percent. Unit states representing current value and max value must be provided in that order. In case of failure returns 0.
Example: a unit with 30/60 HP will return 50.0, meaning the unit is at 50% HP.
Example: a unit with 30/60 HP will return 50.0, meaning the unit is at 50% HP.
You must be logged in with a standard account to contribute.