GetPercentageHPLoss(object)
Determines how wounded a creature is as a percentage of their maximum HP.
int GetPercentageHPLoss( object oWounded );
Parameters
oWounded
The creature (or object) to get its relative wounded level.
Description
Returns an integer between 0 and 100 that represents the percentage of HP oWounded has left.
For example, if a creature had 30 HP left from a maximum 40 HP, this function would return 75.
Remarks
Note that what this function does is somewhat different from its name. If you have an object with 100 HP, and it is now down to 1, the loss is 99%, so that's what you'd expect the function to return. It returns 1, though.
Also note that, in Shadows of Undrentide, this function has been moved to the include file x0_i0_assoc.nss. Through a somewhat complicated route of include files using other include files, you can still call the function by using #include "nw_i0_generic" in SoU.
Requirements
#include "x0_i0_assoc"
Version
1.30
Example
// NPC displays text when GetPercentageHPLoss() is less than 25% #include "x0_i0_assoc" void main() { if(GetPercentageHPLoss(OBJECT_SELF)<25) { ActionSpeakString("HELP! I am wounded!"); } }
See Also
functions: | GetCurrentHitPoints | GetMaxHitPoints |
categories: | Get Data from Object Functions |
author: Sarev0k, editors: Lilac Soul, Mistress, additional contributor(s): Lilac Soul