GetPropertyValue - ScriptObject

From the Fallout4 CreationKit Wiki
Jump to navigation Jump to search

Member of: ScriptObject Script

Gets the current value of a property on this script by name.

Syntax[edit | edit source]

Var Function GetPropertyValue(string asPropertyName) native

Parameters[edit | edit source]

  • asPropertyName: The name of the property

Return Value[edit | edit source]

Whatever value the property has.

Examples[edit | edit source]

; Get the value of the "TargetActor" property from the "CombatOverhaul" script
; We use CastAs to make sure we don't depend on the script we want to call the function on
ScriptObject combatScript = FormFromOtherMod.CastAs("CombatOverhaul")
Var result = combatScript.GetPropertyValue("TargetActor")
Actor target = result as Actor
if target
  target.Kill() ; Kill them all!
endIf

Notes[edit | edit source]

  • If the property name don't exist, the function will error. You may want to check for the existence of the mod you want to talk to before using this.
  • The compiler cannot check the property name for you, so make sure to triple check everything!

See Also[edit | edit source]