Difference between revisions of "GetActorValuePercentage - Actor"
Jump to navigation
Jump to search
imported>Jlundin (→Syntax) |
imported>Kahmul m (int -> float) |
||
Line 20: | Line 20: | ||
<source lang="papyrus"> | <source lang="papyrus"> | ||
; Obtain the player's current health percentage value | ; Obtain the player's current health percentage value | ||
float playersHealth = Game.GetPlayer().GetActorValuePercentage("health") | |||
if (playersHealth > 0.5) | if (playersHealth > 0.5) | ||
Debug.Trace("The player has over half their health left") | Debug.Trace("The player has over half their health left") | ||
Line 28: | Line 28: | ||
<source lang="papyrus"> | <source lang="papyrus"> | ||
; Obtain Bob's current health actor value | ; Obtain Bob's current health actor value | ||
float bobsHealth = Bob.GetAVPercentage("Health") | |||
if (bobsHealth < 0.1) | if (bobsHealth < 0.1) | ||
Debug.Trace("Bob has less then 10% health remaining") | Debug.Trace("Bob has less then 10% health remaining") |
Revision as of 15:51, 12 April 2012
Member of: Actor Script
Gets the specified actor value from the actor as a percentage of its maximum value (from 0 to 1).
Syntax
float Function GetActorValuePercentage(string asValueName) native
float Function GetAVPercentage(string asValueName)
Parameters
- asValueName: The name of the actor value to get the value of. Actor Value List
Return Value
The value of the requested actor value as a percentage of its maximum value. If 0, then the actor value is at its minimum. If 1, then the actor value is at its maximum.
Examples
; Obtain the player's current health percentage value
float playersHealth = Game.GetPlayer().GetActorValuePercentage("health")
if (playersHealth > 0.5)
Debug.Trace("The player has over half their health left")
endIf
; Obtain Bob's current health actor value
float bobsHealth = Bob.GetAVPercentage("Health")
if (bobsHealth < 0.1)
Debug.Trace("Bob has less then 10% health remaining")
endIf