SetValue - ObjectReference

From the Fallout4 CreationKit Wiki
Jump to navigation Jump to search

Member of: ObjectReference Script

Sets the base value specified Actor Value on the Object Reference to the passed-in value. Any modifiers are left intact.

Syntax[edit | edit source]

Function SetValue(ActorValue akAV, float afValue) native

Parameters[edit | edit source]

  • akAV: The Actor Value to set the value of. Actor Value
  • afValue: What value to set the actor value to.

Return Value[edit | edit source]

None.

Examples[edit | edit source]

ActorValue property HealthAV
; Set the player's health actor value to 50
Game.GetPlayer().SetValue(HealthAV, 50)


ActorValue property HealthAV
; Set Nancy's current health actor value
Nancy.SetValue(HealthAV, 20)

Notes[edit | edit source]

  • 2 decimal float precision from -0x001FFFFF to 0x001FFFFF
  • int precision from 0x00200000 to 0x00FFFFFF ( and -0x00200000 to -0x00FFFFFF )
  • values not reliable when greater than 0x00FFFFFF ( or less than -0x00FFFFFF)
    • Odd numbers outside range will either shift up or down to the next adjacent even number.
; This is outside the reliable range
npc.SetValue(MyActorValue, 0x0FFFFFFF)
npc.GetValue(MyActorValue) ; Returns 0x10000000

See Also[edit | edit source]