Mod:Creation Kit/CastAs - ScriptObject

Member of: Mod:Creation Kit/ScriptObject Script

Attempts to cast this script as a different script, but without adding a dependency on the calling script.

Syntax
ScriptObject Function CastAs(string asScriptName) native

Parameters

 * asScriptName: The script to cast to

Return Value
The casted script, if possible, otherwise None.

Examples
ScriptObject latropScript = FormFromOtherMod.CastAs("Latrop") if latropScript ; make sure the cast succeeded latropScript.CallFunction("MakeACake", new Var[0]) endIf
 * Call "Function MakeACake" on script "Latrop"
 * We use CastAs to make sure we don't depend on the script we want to call the function on