Tes5Mod:Mod File Format/QUST
QUST records describe Quests. The overall QUST record has a complex structure, with most fields repeating multiple times. The order in which the fields appear provides important information about each invidual field. Fields of particular importance are:
- INDX fields. Each one marks the start of information about a given quest stage. The subsequent fields all provide information about that specific quest stage.
- QOBJ fields. Each one marks the start of information about a given quest objective.
- ALST and ALLS fields: Each one marks the start of information about a given quest alias. Aliases have an ID (e.g., 4), a name (e.g.,
Location), and a calculated value, e.g., "Winterhold". ALLS fields are used for location aliases, whereas ALST fields are used for reference aliases.
These fields are not part of any of the more complex structures described in the subsequent sections.
|-||VMAD||script info||VMAD||There is only VMAD field for the entire QUST record, which contains information about all of the scripts directly and indirectly attached to the quest (including stage-specific script fragments and scripts attached to the quests' aliases)|
|-||FULL||Quest Name||lstring||Full name as displayed in journal (at least for non-miscellaneous quests)|
||uint8||Value from 0 to 100|
||uint8||Possibly just filler (Observed values are 0, 25, 101, 108, 111, and 204. Only 0 and 204 seen more than once)|
|-||ENAM||Event||char||Corresponds with SMEN short name|
|*||QTGL||Unknown||formid||Text display globals.|
|+||FLTR||Object Window Filter||zstring||Values like 'Main Quest\', 'Civil War\', 'Civil War\Siege\', 'Faction\ThievesGuild\' and 'Faction\Companions\Radiant\'|
|*||CTDA||Quest Dialogue Conditions||struct||Conditions that apply to the quest as a whole.|
|+||NEXT||Marker||empty||Always zero bytes in length. Delineates between quest dialogue and quest event conditions when only one set of conditions exists.|
|*||CTDA||Quest Event Conditions||struct||SM event node conditions.|
|*||Quest Stages||Quest Stages||See below.|
|*||Quest Objectives||Quest Objectives||See below.|
|+||ANAM||NextAliasId?||int32||Next available alias ID. Acts as an incremental counter. This is used by CK when creating a new alias in ALST/ALLS field.|
Each of these sections provides information on a specific quest stage. Multiple sections can appear in a single record, and 1 or more log entries can appear within each INDX field. Stage numbers are not guaranteed to be unique within any given quest.
Any script attached to a given quest stage is automatically turned into a script "fragment"; the quest stage fragments are all combined into an automatically-generated quest fragments script file (named "QF_<editorID>_<formID>"). The script fragments are numbered chronologically, meaning that there is no relationship between the fragment numbers and the quest stage numbers. The only place to extract the fragment numbers is from the VMAD field for the overall QUST record, which contains a section storing those numbers.
|*||INDX||Journal Index||struct||Journal index of the quest stage and other data|
|Index||int16||Actual journal index of the quest stage|
|Unknown||int8||Possibly filler. Nothing shown in CK corresponds to values found here. Values range from -110 to 127 and do not appear to be flags.|
|*||Quest log entries||Quest Log Entry||Multiple structures will appear if there are multiple possible quest log entries for the same stage.|
Quest Log Entry
|+||QSDT||Flags||ubyte||Each QSDT field marks the start of a log entry.
QSDT contains quest stage flags:
|*||CTDA||Conditions||struct||Conditions that apply to this log entry.|
|-||CNAM||Journal entry||lstring||Index in the string file for the text of the journal entry.|
|-||SCHR||Old Script||SCHR||Old scripting field.|
Multiple quest objective structures can appear in a single record, and the objective index is not guaranteed to be unique.
|+||QOBJ||Index||int16||Quest objective index. The following fields all provide information about this quest objective.
By convention, the quest objective index normally corresponds to a quest stage index (i.e., a value in an INDX field), however, the relationship between quest stage index and quest objective index is merely a convention and is not enforced. The only thing that actually controls when an objective appears is the script attached to a quest stage. In some more complex quests, multiple objectives may be assigned as part of a single quest stage or the same quest objective can be assigned by multiple stages.
|+||FNAM||Flags||int32||Only flag option:
(Note that FNAM also appears in ALST/ALLS section, where it has other possible values.)
|+||NNAM||node name?||lstring||Text for an individual quest objective.|
|*||Quest Targets||Quest Target||Quest target information.|
Multiple quest target structures can appear within each quest objective.
||int32||Target for this quest objective, provided as an AliasID.|
||int32||Flag for compass markers ignoring locks. - 0 = will not ignore, 1 = will ignore.|
|*||CTDA||Conditions||struct||Conditions that apply to this QSTA.|
Aliases are introduced with an ANAM field (documented in the main quest record, above), after which, multiple ALST and/or ALLS fields may be present. Each ALST/ALLS entry provides information about a given Alias (i.e., a dynamically assigned value) that can appear in this quest. ALLS fields are used for location aliases, whereas ALST fields are used for reference aliases. Some of the fields within an ALST/ALLS section are used to determine the calculated value for the alias. Other fields are used to assign properties to the target of the alias. For example, if the alias is an NPC, the NPC may be assigned factions, spells, or inventory items associated with the alias.
In terms of structure, ALST and ALLS fields are largely interchangeable. The ALID field provides the alias name. Under the ALID field are a wide variety of possible fields, ending with an ALED field. Many fields can appear in either ALST or ALLS sections, whereas others are specific to one section. The multipliers in the 'C' column in the following table only apply relative to a given alias. If a field can only appear a specific alias or fill type, the multiplier only applies within the context of that type.
For reference aliases, a flag value of 0x800 (No Fill Type) results in no fill type being selected in the CK and a fill type of "Forced: NONE" being indicated in the Quest Aliases table. A "Forced: NONE" fill type can also occur for a reference alias when an alias has no fill type, but the flag at 0x800 is set to 0. (Note: There are two anomalous aliases in Dawnguard.esm, DLC1VQ01.SeranaCloaking and DLC1VQ08.DLC1VQ08HarkonAlias which have the flag set, but also include Unique Actor fields in the data; it's unclear how the game handles these two aliases.)
For location aliases, a flag value of 0x800 results in either a "Find Matching Location" selected on the location alias form with "Conditions" being indicated on the Quest Aliases form if there are CTDA fields, or no fill type selected on location alias form with "Forced: NONE" in the Quest Aliases table if there aren't. The same rules apply if the flag is cleared and the alias has no fill type, except that in the CK, the location alias form will have the "Specific Location" option selected.
"Forced: NONE" aliases are normally filled either by scripting or forced-into aliases (ALFI field). It's unclear if there's any difference between the different methods of generating them. It's possible that it's a holdover from earlier versions of the CK.
In addition to the various packages, factions, spells, inventory items, etc. listed below, any aliased object can also have scripts attached to it when it is assigned to the alias. However, those scripts are not listed in any of the fields in the ALST/ALLS section. Rather, the scripts are stored in the VMAD field for the overall QUST record, which contains a section listing all scripts attached to the quest aliases.
|+||ALST||AliasID||uint32||The AliasID is the numerical value used for this alias. This is the parameter for functions such as
ALST fields are used for Reference aliases (in the CK, "Ref" is listed in the Type column), whereas ALLS fields are used for Location aliases ("Loc" is listed in the CK's Type column). In the CK, different editor screens are used for the two alias types, thereby controlling which fields can be associated with each type of alias.
|+||ALID||AliasName||zstring||The name of this Alias, for example
|+||FNAM||Flags||uint32||Appears for all alias types. For reference aliases, in some cases (e.g., essential, protected), the flags are options assigned to the quest target for the duration of the quest. In other cases, the flags control how the alias is used during the quest. Known flag options:
|-||ALFI||Forced Into Alias||uint32||AliasID of another alias to copy this alias into.|
|The following fields determine the alias' "Fill Type" (to use the CK terminology), i.e., they assign the alias' value. Only one of the following fill-type fields (unindented) can appear in a given alias, along with any associated sub-fields (indented).|
|-||ALCO||Alias Created Object||formid||(Ref) Points to a base record for an item (NPC_, BOOK, MISC, LVLI, ARMO, KEYM, etc). An instance of that object is then created and assigned to this alias.
Specified using "Create Reference to Object" section of CK editor; displayed as "Created" in Fill Type column.
||Create At||uint32||High bit: 0 = Create At, 1 = Create In
Remainder: AliasID to create object at/in.
||Create Level||uint32||0 = Easy
1 = Medium
2 = Hard
3 = Very Hard
4 = None
|-||ALEQ||External Alias Reference||formid||(Loc/Ref) QUST records. Provides the quest where the alias should be copied from; ALEA provides the AliasID in that quest that should be used.
Specified using "External Alias Reference" section of CK editor; display as "Match" in Fill Type Column.
||External Alias||uint32||AliasID to be used in specified external quest.|
|-||ALFA||Reference Alias Location||uint32||(Loc) AliasID of a reference alias within this quest.|
||Keyword||formid||A single KYWD record.|
|-||ALFA||Location Alias Reference||uint32||(Ref) AliasID of a location alias within this quest.|
||Alias Reference Type||formid||Points to a LCRT record which is used to find the object that should be assigned to this alias. This LCRT is looked up in the LCTN.LCSR field of the quest's assigned location to find a ACHR or REFR record that is then associated with this alias.
Specified using "Location Alias Reference" section of CK editor; displayed as "<Location>'s <Ref Type>" in Fill Type column.
|-||ALFE||From Event||char||(Loc/Ref) Provides the type of event (e.g. "Script"). Corresponds with SMEN short name. ALFD field provides extra data about the event.
Specified using "Find Matching Location/Reference" section of CK editor and "From Event" checkbox; displayed as "Event" in Fill Type column.
||Event Data||char||Corresponds to "Event Data" dropdown box in CK. Exact meaning of text varies based on event type. See CTDA documentation for more info.|
|-||ALFL||Alias Forced Location||formid||(Loc) A fixed LCTN record that should be assigned to this alias. Also presumably becomes the default location record for this quest (used by any other alias records that need to look up location-specific items).
Specified using "Specific Location" section of CK editor; displayed as "Forced" in Fill Type column (even if "Force into Alias when Filled" is not selected).
|-||ALFR||Alias Forced Reference||formid||(Ref) Points to an ACHR or REFR record corresponding to the object that should be assigned to this alias.
Specified using "Specific Reference" section of CK editor; displayed as "Forced" in Fill Type column.
|-||ALNA||Near Alias||uint32||(Ref) AliasID this one needs to be near to.|
||Near Type||uint32||Always 0: Linked Ref Child|
|-||ALUA||Alias Unique Actor||formid||(Ref) NPC_ record for an NPC assigned to this alias; uses an existing instance (ACHR record) of the NPC instead of creating a new one. Presumably only works for NPCs with a unique ACHR.
Specified using "Unique Actor" section of CK editor; displayed as "UniqueActor" in Fill Type column.
This field is frequently used to identify the quest-giver, but it can also be used to assign an alias for any other NPC with a unique role in the quest.
|*||CTDA||Match Conditions||struct||(Loc/Ref) Conditions used to Find Matching Reference/Location.
Specified using "Find Matching Reference/Location" section of CK editor and filling in "Match Conditions"; displayed as "Condition" in Fill Type column.
|-||KSIZ||KWDA count||uint32||(Ref) Number of KWDA entries (size of KWDA is 4*KSIZ)|
||Alias Keywords||formid[KSIZ]||KYWD records. Keywords added to the alias for the duration of the quest.|
|-||COCT||CNTO count||uint32||(Ref) If present, number of CNTO records. Does not appear if there are no CNTO records and may not appear even when there are.|
||Items||struct||(Ref) Inventory-type item list. These items are added to the inventory of the aliased object for the duration of the quest.|
|-||SPOR||Spectator Override||formid||(Ref) Spectator Override Package List (FLST records).|
|-||OCOR||Observe Dead Body Override||formid||(Ref) Observe Dead Body Override Package List (FLST records). (Never used in main game files.)|
|-||GWOR||Guard Warn Override||formid||(Ref) Guard Warn Override Package List (FLST records). (Never used in main game files.)|
|-||ECOR||Combat Override||formid||(Ref) Combat Override Package List (FLST records).|
|-||ALDN||Display Name||formid||(Ref) Points to MESG record, whose value is then dynamically assigned as the displayed name of the Alias object. Used to rename NPCs (e.g., Skyrim:Rigel Strong-Arm), quest rewards (e.g., Blade of Falkreath), or quest targets (e.g., Fine-Cut Void Salts)|
|*||ALSP||Alias Spells||formid||(Ref) SPEL records. Spells added to the alias target for the duration of the quest.|
|*||ALFC||Alias Factions||formid||(Ref) FACT records. Factions added to the alias target for the duration of the quest.|
|*||ALPC||Alias Package Data||formid||(Ref) PACK records. Packages added to the alias target for the duration of the quest.|
|-||VTCK||Voice Type||formid||(Ref) "Additional Valid Voice Types for Export". When non-zero points to NPC_ or FLST records|
|+||ALED||EOF Marker||empty||Marks the end of any given alias entry.|