Quest scripts

From GECK
Jump to: navigation, search

Quest scripts can be created by selecting Quest script type in the script editing window. Scripts must be designated as quest scripts in order to be attached to quests. Quest scripts are non-reference scripts and therefore somewhat restricted in the function syntax they can use.

Basic facts

  • Quest scripts run only when the quest is running (you can determine that in the game by using sqv QUEST_NAME). Quests can be started and stopped using the StartQuest and StopQuest script commands. Note that this is independent of a quest being complete or not. Completing a quest means that the quest is marked as complete in the player's Pip-Boy -- but it will still be running unless you use a StopQuest command to turn it off.
  • Quests automatically turn on when a quest stage is set, or when a quest objective is displayed (see SetStage and SetObjectiveDisplayed). So if you do SetObjectiveDisplayed QUESTNAME 10 1, this will automatically start the quest.
  • In general, you should stop quests when a quest is complete, in order to stop its script from processing. If there is some reason you need to keep the quest running (you have post-quest dialogue or script), consider creating a second quest (i.e. MS01 and MS01FIN).
  • Quest variables can be accessed and modified outside of the quest script by using the following syntax:
MyQuest.MyVar
  • Quest variables can still be accessed and modified when the quest is not running. When a quest is stopped, its script is not being processed, but it still exists and the state of the variables remains intact.

Changing how often a quest script is processed

  • Change the script processing delay on the Quest Data Tab.
  • You can also use the SetQuestDelay script command to change how often the quest script is processed dynamically.

The Script Processing Delay is how often you want the quest script to process, in seconds. If you set it to something very small (.01), it will effectively process every frame. If you set it to 0, the quest script will revert to the default processing time (every 5 seconds).

Use this with caution -- calling heavy functions like MD5File every frame could cause performance issues. Still, scripts aren't usually all that performance hungry -- you may use RuntimeScriptProfiler to measure their impact.