Background for Fallout 4
Member of the ScriptObject script
voidfunctionSetPropertyValue(stringasPropertyName, varaValue)Native

Description

Wiki Description

Sets the value of a property on this script by name, synchronously.

Documentation Comment

Sets a property value on this script specified by name. Note that the compiler cannot check
that the property exists, nor that the value is the right type. It will also not be able to
auto-cast, so you must pre-cast the value to the right type (derived or parent types won't
work). Will error if the property is not valid, doesn't exist on the object, is read-only
or an auto-property specified as const.


Caveats

CK Wiki - Notes

  • 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 value type must match exactly. You cannot give it a float if the property expects an int, or an Actor if the property expects an ObjectReference. Normally the compiler would do these casts for you in a normal property set, but it doesn't know what the type is, so it is your responsibility to match them up.
  • The compiler cannot check the property name for you, so make sure to triple check everything!

Parameters

  1. stringasPropertyName

    CK Wiki Description

    The name of the property to set

  2. varaValue

    CK Wiki Description

    The value to set the property to


Examples

; Set the value of the "DamageMultiplier" property on 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")
; note the '.0' to ensure it is a float, 1 won't work for float properties
combatScript.SetPropertyValue("DamageMultiplier", 1.0)

Auto-Generated Example

string myString__asPropertyName
var myVar__aValue

myScriptObject__toCallFunctionOn.SetPropertyValue(myString__asPropertyName, myVar__aValue)

Related Pages


Additional References

View this function’s page on the Fallout 4 Creation Kit Wiki

Some data provided by the Fallout 4 Creation Kit Wiki. Licensed under the Creative Commons Attribution-Share Alike 4.0 license.