UserFunction; SobGroup_GetHealth - HWRM/KarosGraveyard GitHub Wiki

SobGroup_GetHealth(<sSobGroupName>)

By Novaras (Fear)

Description

Gets the current health fraction, similar to how SobGroup_SetHealth works with HP fractions.

Example

SobGroup_GetHealth("example-group"); -- fraction such as '0.5', if at half health.

Definition

--- Gets the current HP of the group (as a fraction, ala SobGroup_SetHealth).
---@param group string
---@return number
function SobGroup_GetHealth(group_name)
	local max_health = SobGroup_MaxHealthTotal(group);
	local current_health = SobGroup_CurrentHealthTotal(group);
	return (current_health / max_health);
end

Arguments

Param Type Description
group_name string The SobGroup who's health fraction will be returned.

Returns

Type Description
number The health fraction (between 0 and 1 inclusive)

Related Pages

Comments

Need to update page for SobGroup_MaxHealthTotal, which is probably useful in tandem with this function.

Page Status

Updated Formatting? Initial
Updated for HWRM? Initial