UserFunction; SobGroup_GetHealth - HWRM/KarosGraveyard 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] The SobGroup who's health to check.
-- @return [number] The current health as a fraction of the total.
function SobGroup_GetHealth(group)
	local max_health = SobGroup_MaxHealthTotal(group);
	local current_health = SobGroup_CurrentHealthTotal(group);
	return (current_health / max_health);
end

Arguments

Param Type Description
sSobGroupName 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