The LifeMeter is an ActorFrame that provides a few functions to determine the current state of the player's health.
The way LifeMeter returns the value for the functions is based on the player's current Life Type, which can be one of the following three:
For the following function examples, we're using
ScreenGameplay, as that has aGetLifeMeterfunction to obtain this object.
ScreenHowToPlayis the only other screen that has this function call as well.
GetLifeReturns the current life of the player.
-- For this example, we're going to grab the player's current health.
local health = SCREENMAN:GetTopScreen():GetLifeMeter(PLAYER_1):GetLife()
| Life Type | Return Type |
|---|---|
| Bar | Returns a value from 0 to 1. |
| Battery | Returns a converted 0 to 1 float value of Batteries Left / Max Batteries. |
| Time | Return a converted 0 to 1 float value from Time Left / 90. The 90 is hard-coded as it was meant for ITG Survival. |
IsInDangerReturns true if the player is in a danger situation. For all three life types, this is determined by a DangerThreshold metric.
local indanger = SCREENMAN:GetTopScreen():GetLifeMeter(PLAYER_1):IsInDanger()
IsHotReturns true if the player is Hot. This means that the player currently has max health. This applies for Bar and Battery.
local ishot = SCREENMAN:GetTopScreen():GetLifeMeter(PLAYER_1):IsHot()
The Time life type will never return true, despite reaching its max time.
IsFailinglocal isFailing = SCREENMAN:GetTopScreen():GetLifeMeter(PLAYER_1):IsFailing()
| Life Type | Return Type |
|---|---|
| Bar | Linked to the Passmark modifier, it will return true if the player's current life is under the value of Passmark. |
| Battery | Returns true if the player has run out of batteries. |
| Time | Returns true if the player has run out of time. |