Difference between revisions of "GetActorValue - Actor"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Moorleiche2k
 
(10 intermediate revisions by 8 users not shown)
Line 7: Line 7:
== Syntax ==
== Syntax ==
<source lang="papyrus">
<source lang="papyrus">
float Function GetActorValue(string asValueName) native ;seems no longer to work, at least for "magicka"
float Function GetActorValue(string asValueName) native
float Function GetAV(string asValueName) ;seems to be native by now and works with "magicka"
float Function GetAV(string asValueName)
  return GetActorValue(asValueName)
EndFunction
</source>
</source>


Line 20: Line 22:
<source lang="papyrus">
<source lang="papyrus">
; Obtain the player's current health actor value
; Obtain the player's current health actor value
int playersHealth = Game.GetPlayer().GetActorValue("health") as int
Float fPlayerHealth = Game.GetPlayer().GetActorValue("Health")
</source>
</source>
<br/>
<br/>
<source lang="papyrus">
<source lang="papyrus">
; Obtain Bob's current health actor value
; Obtain Bob's current Sneak actor value
int bobsHealth = Bob.GetAV("Health") as int
Float fBobSneak = Bob.GetAV("Sneak")
</source>
</source>
== Notes ==
*GetActorValue is slightly faster than GetAV as it is native.
*This function returns the current value as opposed to the base (maximum) value. To get the base value see [[GetBaseActorValue - Actor]].


== See Also ==
== See Also ==
*[[Actor Value List]]
*[[GetBaseActorValue - Actor]]
*[[Actor Script]]
*[[GetActorValuePercentage - Actor]]
*[[GetActorValueMax - Actor]]
*[[DamageActorValue - Actor]]
*[[DamageActorValue - Actor]]
*[[ModActorValue - Actor]]
*[[ForceActorValue - Actor]]
*[[ForceActorValue - Actor]]
*[[GetBaseActorValue - Actor]]
*[[ModActorValue - Actor]]
*[[RestoreActorValue - Actor]]
*[[RestoreActorValue - Actor]]
*[[SetActorValue - Actor]]
*[[SetActorValue - Actor]]
*[[Actor Value List]]
*[[Actor Script]]

Latest revision as of 05:59, 30 May 2024

Member of: Actor Script

Gets the specified actor value from the actor.

Syntax[edit | edit source]

float Function GetActorValue(string asValueName) native
float Function GetAV(string asValueName)
  return GetActorValue(asValueName)
EndFunction

Parameters[edit | edit source]

Return Value[edit | edit source]

The value of the requested actor value.

Examples[edit | edit source]

; Obtain the player's current health actor value
Float fPlayerHealth = Game.GetPlayer().GetActorValue("Health")


; Obtain Bob's current Sneak actor value
Float fBobSneak = Bob.GetAV("Sneak")

Notes[edit | edit source]

  • GetActorValue is slightly faster than GetAV as it is native.
  • This function returns the current value as opposed to the base (maximum) value. To get the base value see GetBaseActorValue - Actor.

See Also[edit | edit source]