SetScript

From the Fallout3 GECK Wiki
Jump to navigation Jump to search
< [[::Category:Functions|Category:Functions]]

A function added by the Fallout Script Extender.

Description

Sets the specified script onto the calling reference or passed object, and returns any previous script.

Syntax

[help]
(script:form) ref.SetScript NewScript:script ScriptableObject:form

Example

ref OldScript

set OldScript to SunnyREF.SetScript MyNewSunnyScript

; or (required if used for non-reference)

SetScript MyNewSunnyScript, SunnyREF

Warning

If the target object already has a script attached to it, after changing the script the stored values of local variables for references to that object will not match the variables in the new script. If called on a reference, the variable list for the calling reference will be updated to match the new script, but other references to the same base object will not be updated.

SetScript is safe to use with quests, with previously unscripted objects, and on unique references (for which no other references exist to the same base object). Using the command on base objects for which non-unique references exist may result in undefined behavior.

See Also