Tes3Mod:StartScript

The UESPWiki – Your source for The Elder Scrolls since 1995
Jump to: navigation, search


StartScript

                StartScript, ScriptName

       Where:   ScriptName = Name of the script to start

        Type:   Script

     Returns:   none

     Example:   StartScript, CharGen

     Scripts:   Main
                MoonAndStar

This function starts a script running as a global script. It is not attached to any object, so functions like moving, rotating, checking distances and such have no bearing in a global script (which means you must specify object IDs explicitly). Note this isn't exactly true as if you start a global script it will use the calling script object by default (i.e., if you started a global script from within the NPC Bob's script, the global script would use Bob as the default object). Global scripts are good for running complex quests, checking variables, or setting timers. Each global script is run every frame so take care not to run too many at one or the game's speed will be reduced.

You can target a global script using either ObjectID->StartScript, or calling StartScript from the dialogue results box. While both are true, they don't quite work as expected when used together. From the results box, ObjectID->StartScript seems to attach the script to the NPC calling the dialogue and not the referenced object. When you use a targeted global script any function call in the script will use the target object (you don't need to explicitly specify the object unless you need/want to).

See Also: ScriptRunning, StopScript