GetValuePercentage - ObjectReference

From the Fallout4 CreationKit Wiki
Jump to navigation Jump to search

Member of: ObjectReference Script

Gets the specified actor value from the actor as a percentage of its maximum value (from 0 to 1).

Syntax[edit | edit source]

float Function GetValuePercentage(ActorValue akAV) native

Parameters[edit | edit source]

Return Value[edit | edit source]

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[edit | edit source]

ActorValue property HealthAV
; Obtain the player's current health percentage value
float playersHealth = Game.GetPlayer().GetValuePercentage(HealthAV)
if (playersHealth > 0.5)
  Debug.Trace("The player has over half their health left")
endIf


ActorValue property HealthAV
; Obtain Bob's current health actor value
float bobsHealth = Bob.GetValuePercentage(HealthAV)
if (bobsHealth < 0.1)
  Debug.Trace("Bob has less then 10% health remaining")
endIf

See Also[edit | edit source]