Difference between revisions of "Quest scripts"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>DonAtreides
imported>Haama
(Removed quirk - that's a general problem in TroubleShooting)
 
Line 16: Line 16:
* Because Quest scripts are run always based on time intervals they will not necessary frame sync, even with fQuestDelayTime set to a very low value. For some effects (e.g. those using SetPos) this can have undesired effects. In these cases Object and Magic scripts may be more appropriate to achieve an effect smoothly.
* Because Quest scripts are run always based on time intervals they will not necessary frame sync, even with fQuestDelayTime set to a very low value. For some effects (e.g. those using SetPos) this can have undesired effects. In these cases Object and Magic scripts may be more appropriate to achieve an effect smoothly.


Quirks:
* The data in a quest beginning with a FormID of "1" cannot be accessed by external scripts.


[[Category: Scripting]]
[[Category: Scripting]]


[[Category: Quests]]
[[Category: Quests]]

Latest revision as of 00:13, 11 February 2008

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 moves to the Completed Quest tab in the player's journal -- but it will still be running unless you use a StopQuest command to turn it off.
  • Quests automatically turn on when an entry is written to the player's journal. So if you do SetStage QUESTNAME 10, assuming entry 10 has journal text, 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. MS38 and MS38FIN).
  • 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.


How to change how often a quest script is processed:

  • Declare the "magic variable" float fQuestDelayTime in your quest script.
  • Set fQuestDelayTime to 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 feature with caution -- in general, fQuestDelayTime should only be set less than 5 under very controlled and limited circumstances.
  • fQuestDelayTime may be set from another script by addressing the quest, e.g. set MyQuest.fQuestDelayTime to 0.01.
  • Quest scripts are the only ones that actually process a MenuMode block while you are resting or using fast travel.
  • Because Quest scripts are run always based on time intervals they will not necessary frame sync, even with fQuestDelayTime set to a very low value. For some effects (e.g. those using SetPos) this can have undesired effects. In these cases Object and Magic scripts may be more appropriate to achieve an effect smoothly.