Tes2Mod:Quest pseudo-codes

Structure and content of the 9th QBN file section, v1.1
Version
Version 1.1,  released on 3/30/98 on the WinQEdit site: 
Version 1.0 is the first version, released on 03/01/98.
Note
This document is mostly based on Dave Humphrey's Daggerfall Quest File (QRC/QBN) Hacking Results, v0.20 ¯ , on the results published by Glen Wright in an e-mail, and on my own experiments. Much information can be obtained from the Elder Scroll Pages site, at  It is highly recommended to be familiar with Dave Humphrey's document's content before reading this one. The structure on the QBN file can be easily read and changed with WinQEdit 95, a graphical quest file editor that I wrote.

Send any comment to [mailto:hautesse@cert.fr hautesse@cert.fr] or [mailto:glen@skatter.usask.ca glen@skatter.usask.ca].
The structure of a Pseudo-code Record
The pseudo-code records section was previously referred as the Messages Section. It is pointed at by the qbn_section_offset[8]. It contains a kind of pseudo-code, that rules initial locations of Items and Mobs, what is to be done when certain events occur, and so on.

Each record in this section has a length of 87 bytes. It is composed of some information about the type of the record, of five sub-records sharing the same structure, and at the end of a Message ID field and of an unknown long integer. The detailed structure is:
; Bytes [00-01], short int OpCode : Type of pseudo-code record. All records of a certain Type share the same number and types of sub-records.
; Bytes [02-03], short int Flags : Reserved, set to 0. 0x100 indicates that this operation has been completed.
; Bytes [04-05], short int Records : Number of valid sub-records. The record always contains five sub-records, but some may not be valid. The invalid records the contain the same data as the sub-record of the same rank in the previous pseudo-code record (that is to say: garbage). There always at least one valid sub-record, and at most five.
; Bytes [06-20], sub-record : First sub-record (always a State).
; Bytes [21-35], sub-record : Second sub-record.
; Bytes [36-50], sub-record : Third sub-record.
; Bytes [51-65], sub-record : Fourth sub-record.
; Bytes [66-80], sub-record : Fifth sub-record.
; Bytes [81-82], short int Message ID : Can be a real Message ID found in the QRC file, or 0xFFFF to mean no message is to be used.
; Bytes [83-86], long int LastUpdate : Reserved, set to 0.

Each sub-record can refer either to a section (Item Section, Mob Section, State Section, etc.) or contain a constant value.

When it refer to a particular section, it can be decoded as :
; Byte [00] Not : If 0x01, inverts the value of state to set or condition to check.
; Bytes [01-04], long int LocalPtr : Section and record number. For example 0x00000921 should be read record 21 of section 09 (State). If no record number must be specified, the last byte can be FF, like in 0x000009FF.
: In save files, the offset from the start of the QBN object to the corresponding quest record.
; Bytes [05-06], short int SectionId : Section number, like 0x0009. Always the same section as the one in the long int.
; Bytes [07-10], long int Value : Record number or a constant value. 0xFFFFFFFF means no value, and 0xFFFFFFFE is a filler value for the opcodes with multiple operands of the same function.
; Bytes [11-14], long int ObjectPtr : Reserved, set to 0.

When a sub-record can also contain a constant. In that case, it has this structure :
; Byte [00] : Always 0x00 (unconfirmed).
; Byte [01 - 05], long int : 0x12345678.
; Bytes [05 - 06], short int : always 0x0000 (unconfirmed)
; Bytes [07 - 10], long int : The constant value. Can be a message ID, or any number, and also 0xFFFFFFFF or 0xFFFFFFFE, etc.
; Bytes [11 - 14], long int : Garbage, set to zeroes in the editor.

The different types of Pseudo-code records
This work is based on my own guess, and a lot on Glen Wright's ones. Sometimes we disagree, or I don't have an opinion on some types, so as for now, Glen's guesses are noted in Italic, preceded by GW. It does not mean I think he is wrong !

The (confirmed) tags mean I have checked the fact against a complete listing of the Code section from all quest files, provided by Michael Schneider, and then transformed in an Excel spreadsheet by myself. The spreadsheet is available on request (filename : sect8lit.xls). A complete spreadsheet for all sections can be found in a file name sectcont.xls.
Pseudo-code Type 0 (Item & Location) [3 sub-records]
; Sub-record 1, State : Can be 0xFF or a valid record number (confirmed).
; Sub-record 2, Item :
; Sub-record 3, Location :
; Message ID : Always 0xFFFF (confirmed)
; Role : If State TRUE, place Item in Location.
Pseudo-code Type 1 (Item & NPC) [3 sub-records]
; Sub-record 1, State : Never 0xFF (confirmed)
; Sub-record 2, Item : Never 0xFF (unconfirmed)
; Sub-record 3, NPC : Never 0xFF (unconfirmed)
; Message Id : 0xFFFF or a valid ID (confirmed)
; Role : Set State when Item is given to NPC. Then a Type 51 can be used to display a message (like in O0B30Y14), or a Type 4 used to give the reward to the player.
Pseudo-code Type 2 (Check Kill Count) [3 sub-records]
; Sub-record 1, State : Maybe the State is set when the mob is created, and then unset when the mob is killed (see Type 51).
; Sub-record 2, Mob : Index of Mob creature.
; Sub-record 3, Value : Required kills
; Message ID : 0xFFFF or a valid ID (confirmed) Is displayed when done.
; Role : Sets the State when the given amount of the Mob has been killed.

Pseudo-code Type 3 (PC finds Item) [2 sub-records]
; Sub-record 1, State : Never 0xFF (confirmed). Can be inverted with a 0x01 in byte [6].
; Sub-record 2, Item :
; Message ID : 0xFFFF or a valid ID (confirmed)
; Role : Set State when Item is found by player, and display a message.
Pseudo-code Type 4 (Items) [5 sub-records]
; Sub-record 1, State : Never 0xFF (confirmed).
; Sub-record 2, Item : Value is the index of an Item record. or 0xFF
; Sub-records 3 to 5, Item : Value can also be FF is no item is available.
; Message ID : 0xFFFF (confirmed)
; Role : Give Item to player when State is Unset ? (see Type 54) GW : "if State TRUE then display inventory and Item", or alternate "if Falg TRUE then erase Item" Or Create Item or reward ? Compute item value if it is random ?
: In P0B30L11, sub-records 2 to 5 are 0xFF. Maybe this type just means that the quest is completed when this State is set, and rewards can be given.
Pseudo-code Type 5 (unknown) [3 sub-records]
; Sub-record 1, State : Never 0xFF (confirmed). Can be inverted with a 0x01 in byte [6].
; Sub-record 2, Item : Value is the index of an Item record. (confirmed)
; Sub-records 3 to 5, Location : Value is the index of an Location record. (confirmed)
; Message ID : 0xFFFF or a valid ID (confirmed)
; Role : GW : "Unknown"
Pseudo-code Type 6 (States) [1 sub-record]
; Sub-record 1, State : Value is valid or 0xFF (confirmed).
; Message ID : 0xFFFF or a valid ID (confirmed)
; Role : If State TRUE then Terminate Quest. What if the State is not specified (see S0000106.QBN and S0000107.QBN) ?
Pseudo-code Type 7 (States) [2 or 5 sub-records]
; Sub-record 1, State : Value can be valid or 0xFF. (confirmed) Can be inverted with a 0x01 in byte [6] (confirmed).
; Sub-record 2, State : Can be the same as State 1, or different but always valid. (confirmed)
; Sub-record 3 to 5 : State (Not always present) Can be the same as State 1, or different, or 0xFE. (confirmed)
; Message ID : 0xFFFF or a valid ID (confirmed)
; Role : GW : "if State1 TRUE then clear States 2 to 5". What if State1 is not specified ?
Pseudo-code Type 8 (Quest) [3 sub-records]
; Sub-record 1, State : Value is always valid. (confirmed) Can be inverted with a 0x01 in byte [6] (confirmed).
; Sub-record 2, Constant : Number of main quest to trigger (from 0x0000000 to 0x000003E7)
; Sub-record 3, Constant : Same as sub-record 2 (confirmed).; Message ID : 0xFFFF or a valid ID (confirmed)
; Role : GW : "is State TRUE then trigger main quest (S0000502 if constant is 502).".
Pseudo-code Type 9 (Repeating Spawn) [5 sub-records]
; Sub-record 1, State : Value can be valid or 0xFF. (confirmed) Can be inverted with a 0x01 in byte [6] (confirmed).
; Sub-record 2, Mob : Never 0xFF (confirmed).
; Sub-record 3, Value : Delay, in minutes.
; Sub-record 4, Value : Chance in %.
; Sub-record 5, Value : Number of encounters, or -1 for infinite spawns.
; Message ID : 0xFFFF or a valid ID (confirmed)
; Role : Spawn the given mob several times over time.

Pseudo-code Type 0x0A / 10 (Add Topics) [4 sub-records]
; Sub-record 1, State : Never 0xFF (confirmed).
; Sub-record 2, Location : Can be valid 0xFF. (confirmed).
; Sub-record 3, NPC : Can be valid 0xFF. (confirmed).
; Sub-record 4, Item : Can be valid 0xFF. (confirmed).
; Message ID : 0xFFFF (confirmed)
; Role : If State is set, enable corresponding "Where is"/"Tell me about" topic for the given quest objects.
; Note : At least one of the three sub-records has a valid value, but never more than two at the same time (confirmed).
Pseudo-code Type 0x0B / 11 (Remove Topics) [4 sub-records]
; Sub-record 1, State : Value can be valid or 0xFF. (confirmed) Can be inverted with a 0x01 in byte [6] (confirmed).
; Sub-record 2, Location : Can be valid 0xFF. (confirmed).
; Sub-record 3, NPC : Can be valid 0xFF. (confirmed).
; Sub-record 4, Item : Can be valid 0xFF. (confirmed).
; Message ID : 0xFFFF (confirmed)
; Role : If State is set, disable corresponding "Where is"/"Tell me about" topic for the given quest objects.
; Note : At least one (and up to 3) of the three sub-records has a valid value (confirmed).
Pseudo-code Type 0x0C / 12 (Start timer) [2 sub-records]
; Sub-record 1, State : Value can be valid or 0xFF. (confirmed) Can be inverted with a 0x01 in byte [6] (confirmed).
; Sub-record 2, Length :/Timer
; Message ID : 0xFFFF or a valid ID (confirmed)
; Role : GW : "if State TRUE start Timer". For example, compute quest length, and then allow the quest maker to display a message announcing it. The pseudo-code section seems to always start with a Type 12 record (whose State is 0xFF).
Pseudo-code Type 0x0D / 13 (Stop timer) [2 sub-records]
; Sub-record 1, State : Value is must be valid. (confirmed).
; Sub-record 2, Length :/Timer
; Message ID : 0xFFFF (confirmed)
; Role : GW : "if State TRUE shutdown Timer".
Pseudo-code Type 0x11 / 17 (Locations) [4 sub-records]
; Sub-record 1, State : Value is ALWAYS 0xFF. (confirmed)
; Sub-record 2, Location : Sub-record 3 & 4 : Value
; Message ID : 0xFFFF (confirmed)
; Role : Unknown.
Pseudo-code Type 0x13 / 19 (Add Location to Map) [2 sub-records]
; Sub-record 1, State : Value can be valid or 0xFF. (confirmed)
; Sub-record 2, Location :
; Message ID : 0xFFFF or a valid ID (confirmed)
; Role : GW : "if State TRUE add Location to player's map."
Pseudo-code Type 0x15 / 21 (Mob hurt by PC) [2 sub-records]
; Sub-record 1, State : Value can be valid or 0xFF. (confirmed) Can be inverted with a 0x01 in byte [6] (confirmed).
; Sub-record 2, Mob :
; Message ID : 0xFFFF or a valid ID (confirmed)
; Role : GW : "Set State is Mob hurt by Player"
Pseudo-code Type 0x16 / 22 (Place Mob at Location) [3 sub-records]
; Sub-record 1, State : Value can be valid or 0xFF. (confirmed)
; Sub-record 2, Mob : Never 0xFF (confirmed).
; Sub-record 3, Location : Never 0xFF (confirmed).
; Message ID : 0xFFFF or a valid ID (confirmed)
; Role : GW : "if State TRUE place Monster at Location"
Pseudo-code Type 0x17 / 23 (Create Log Entry) [3 sub-records]
; Sub-Record 1, State : Value can be valid or 0xFF. (confirmed)
; Sub-record 2, Value : Log entry Message ID
; Sub-record 3, Value : Ranging from 0x00000000 to 0x0000000A.
; Message ID : 0xFFFF (confirmed)
; Role : If State TRUE add Message referenced in sub-record 2 as log entry, at rank referenced by sub-record 3. I don't known how to remove it, may be this is automatically done.
Pseudo-code Type 0x18 / 24 (Remove Log) [2 sub-records]
; Sub-Record 1, State : Value is always valid. (confirmed) Can be inverted with a 0x01 in byte [6] (confirmed).
; Sub-record 2, Value : Slot, 0 to 9.
; Message ID : 0xFFFF (confirmed)
; Role : Removes the corresponding log record.

Pseudo-code Type 0x1A / 26 (Give Item to NPC) [3 sub-records]
; Sub-record 1, State : Value can be valid or 0xFF. (confirmed)
; Sub-record 2, Item : This is always a valid Item index number.  (confirmed)
; Sub-record 3, NPC 
: If a valid NPC index number, then the item is given to that NPC.  (confirmed)
: If 0xFFFFFFFF, then this number represents the player character, and the item is placed in the player character's inventory.  (confirmed)
; Message ID : 0xFFFF or a valid ID (confirmed)
; Role : GW : "if State TRUE then give Item to NPC".

Pseudo-code Type 0x1B / 27 (Add Global Map) [4 sub-records]
; Sub-record 1, State : Value can be valid or 0xFF. (confirmed)
; Sub-record 2, Location : Always a SPECIFIC location (like Castle Daggerfall) and never a random one. Unused.
; Sub-record 3, Value : Region ID.
; Sub-record 4, Value : Location ID.
; Message ID : 0xFFFF (confirmed)
; Role : Shows the given location in the given region.

Pseudo-code Type 0x1C / 28 (PC meets NPC) [2 sub-records]
; Sub-record 1, State : Value can be valid or 0xFF (only in A0C01Y13.QBN). (confirmed)
; Sub-record 2, NPC : Always a valid NPC index number.  (confirmed)
; Message ID : 0xFFFF
; Role : Set State when PC meets NPC.

Pseudo-code Type 0x1D / 29 (Yes/No Question) [4 sub-records]
; Sub-record 1, State : Value can be valid or 0xFF. (confirmed)
; Sub-record 2, State : Never 0xFF (confirmed). State to set if player answers YES.
; Sub-record 3, State : Never 0xFF (confirmed). State to set if player answers NO.
; Sub-record 4, Value : Valid Message ID (confirmed).
; Message ID : 0xFFFF (confirmed)
; Role : GW : "if State TRUE, display Message (sub-record 4), with YES/NO buttons. If player answers YES, set State 2, else set State 3".
Pseudo-code Type 0x1E / 30 (NPC, Location) [3 sub-records]
; Sub-record 1, State : Value can be valid or 0xFF. (confirmed)
; Sub-record 2, NPC : Value can be valid or 0xFF. (confirmed)
; Sub-record 3, Location : Value is always valid (confirmed)
; Message ID : 0xFFFF or a valid ID (confirmed)
; Role : GW : "if State TRUE, then place NPC at Location". What if NPC is unspecified ?
Pseudo-code Type 0x1F / 31 (Daily Clock) [3 sub-records]
; Sub-record 1, State : Value is always valid. (confirmed)
; Sub-record 2, Value :
; Sub-record 3, Value :
; Message ID : 0xFFFF (confirmed)
; Role : GW : "set State when daily clock is between Value2 and Value3".
Pseudo-code Type 0x22 / 34 (Random State) [5 sub-records]
; Sub-record 1, State : Value can be valid or 0xFF. (confirmed)
; Sub-record 2 to 5, State : Values can be valid, 0xFE, and can be repeated. The first two are always valid. (confirmed).
; Message ID : 0xFFFF (confirmed)
; Role : if State TRUE set one State at Random.
Pseudo-code Type 0x23 / 35 (Cycle state) [5 sub-records]
; Sub-record 1, State : Value can be valid or 0xFF. (confirmed) Can be inverted with a 0x01 in byte [6] (confirmed).
; Sub-record 2 to 5, State : States to choose from, padded with 0xFF.
; Message ID : 0xFFFF (confirmed)
; Role : Clears the currently set state and sets the next one, wrapping around if necessary. If there is only one state, it is set.

Pseudo-code Type 0x24 / 36 (Give Item to PC) [2 sub-records]
; Sub-record 1, State : Value can be valid or 0xFF. (confirmed)
; Sub-record 2, Item : Value is always valid. (confirmed)
; Message ID : 0xFFFF or a valid ID (confirmed)
; Role : GW : "if State TRUE, then give Item to player." Related to type 0x1A ?
Pseudo-code Type 0x25 / 37 (Item) [4 sub-records]
; Sub-record 1, State : Value can be valid or 0xFF. (confirmed)
; Sub-record 2, State : Value is always valid. (confirmed)
; Sub-record 3, NPC : Value is always valid. (confirmed)
; Sub-record 4, Value : Range from 0x00000000 to 0x00000032.
; Message ID : 0xFFFF (confirmed)
; Role : GW : "if State TRUE, then set State2 if NPC reputation >= Value." What does `NPC reputation' mean ? Is it `reputation with NPC' ?
Pseudo-code Type 0x26 / 38 (Rumors) [2 sub-records]
; Sub-record 1, State : Value can be valid or 0xFF. (confirmed)
; Sub-record 2, Value : Value is a message ID (confirmed)
; Message ID : 0xFFFF (confirmed)
; Role : GW : "if State TRUE, then add Message to rumors."
Pseudo-code Type 0x27 / 39 (Item and Mob) [3 sub-record]
; Sub-record 1, State : Value can be valid or 0xFF. (confirmed)
; Sub-record 2, Item : Value is always valid. (confirmed)
; Sub-record 3, Mob : Value is always valid. (confirmed)
; Message ID : 0xFFFF or a valid ID (confirmed)
; Role : Display message when Item is given to mob ? or GW : "if State TRUE then give Item to Mob"
Pseudo-code Type 0x2B / 43 (PC at Location) [3 sub-record]
; Sub-record 1, State : Value can be valid or 0xFF. (confirmed) Can be inverted with a 0x01 in byte [6] (confirmed).
; Sub-record 2, State : Value is always valid. (confirmed)
; Sub-record 3, Location : Value is always valid. (confirmed)
; Message ID : 0xFFFF or a valid ID (confirmed)
; Role : GW : "if State TRUE then set State2 if at Location"
Pseudo-code Type 0x2C / 44 (Delete NPC) [2 sub-record]
; Sub-record 1, State : Value can be valid or 0xFF. (confirmed)
; Sub-record 2, NPC : Value is always valid. (confirmed)
; Message ID : 0xFFFF (confirmed)
; Role : Deletes the corresponding NPC.

Pseudo-code Type 0x2E / 46 (Hide NPC) [2 sub-records]
; Sub-record 1, State : Value can be valid or 0xFF. (confirmed)
; Sub-record 2, NPC : Value is always valid. (confirmed)
; Message ID : 0xFFFF (confirmed)
; Role : Hides an NPC.
Pseudo-code Type 0x30 / 48 (Show NPC) [2 sub-records]
; Sub-record 1, State : Value is always valid (confirmed) Can be inverted with a 0x01 in byte [6] (confirmed).
; Sub-record 2, NPC : Value is always valid. (confirmed)
; Message ID : 0xFFFF (confirmed)
; Role : Reveals a hidden NPC.
Pseudo-code Type 0x31 / 49 (Cure disease) [2 sub-records]
; Sub-record 1, State : Value is always valid (confirmed)
; Sub-record 2, Value : Value is always 0x0000000F. (confirmed)
; Message ID : 0xFFFF (confirmed)
; Role : Cures all the diseases affecting the PC.
Pseudo-code Type 0x32 / 50 (Play movie) [2 sub-records]
; Sub-record 1, State : Value is always valid (confirmed)
; Sub-record 2, Value : Movie index to play
; Message ID : 0xFFFF (confirmed)
; Role : Play video from ANIMxxxx.VID.

Pseudo-code Type 0x33 / 51 (Display Message) [1 sub-record]
; Sub-record 1, State : Value can be valid or 0xFF. (confirmed)
; Message ID : Never 0xFFFF
; Role : If State TRUE display Message. What if State is 0xFF ? Always display Message ? When ?
Pseudo-code Type 0x34 / 52 (AND States) [5 sub-records]
; Sub-record 1, State : Value is always valid. (confirmed) Can be inverted with a 0x01 in byte [6] (confirmed).
; Sub-record 2, State : Value is always valid. (confirmed)
; Sub-record 3 to 5, State : Value can be 0xFE or a real one. (confirmed)
; Message ID : 0xFFFF or a valid ID (confirmed)
; Role : State 1 = State 2 AND State 3 AND State 4 AND State 5, considering those States with a 0xFE value as true. A first byte of a sub-record set to 0x01 means a NOT.
Pseudo-code Type 0x35 / 53 (OR States) [5 sub-records]
; Sub-record 1, State : Value is always valid. (confirmed)
; Sub-record 2, State : Value is always valid. (confirmed)
; Sub-record 3, State : Value is always valid. (confirmed)
; Sub-record 4 & 5, State : Value can be 0xFE or a real one. (confirmed)
; Message ID : 0xFFFF (confirmed)
; Role : State 1 = State 2 OR State 3 OR State 4 OR State 5, considering those States with a 0xFE value as FALSE. A first byte of a sub-record set to 0x01 means a NOT.
Pseudo-code Type 0x36 / 54 (Make Item ordinary) [2 sub-records]
; Sub-record 1, State : Value can be valid or 0xFF. (confirmed)
; Sub-record 2, Item : Value is always valid. (confirmed)
; Message ID : 0xFFFF or a valid ID (confirmed)
; Role : GW : "If State TRUE then make Item ordinary (i.e. non-quest)."
Pseudo-code Type 0x37 / 55 (Escort NPC) [2 sub-records]
; Sub-record 1, State : Value can be valid or 0xFF. (confirmed)
; Sub-record 2, NPC : Value is always valid. (confirmed)
; Message ID : 0xFFFF or a valid ID (confirmed)
; Role : Give NPC to player when State is Set (As an escort). GW : "if state TRUE then add face for NPC to screen"
Pseudo-code Type 0x38 / 56 (End Escort NPC) [2 sub-records]
; Sub-record 1, State : Value is always valid. (confirmed)
; Sub-record 2, NPC : Value is always valid. (confirmed)
; Message ID : 0xFFFF (confirmed)
; Role : GW : "if state TRUE then remove face of NPC from screen"
Pseudo-code Type 0x39 / 57 (Use Item) [3 sub-records]
; Sub-record 1, State : Value can be valid or 0xFF. (confirmed) Can be inverted with a 0x01 in byte [6] (confirmed).
; Sub-record 2, State : Value is always valid. (confirmed)
; Sub-record 3, Item : Value is always valid. (confirmed)
; Message ID : 0xFFFF or a valid ID (confirmed)
; Role : if State True, set State2 if Item is used by player. Found in P0B30L11 (Item is the quest letter).
Pseudo-code Type 0x3A / 58 (Cure Vampirism) [1 sub-record]
; Sub-record 1, State : Value is always valid. (confirmed)
; Message ID : 0xFFFF (confirmed)
; Role : GW : "if state TRUE then cure Vampirism."
Pseudo-code Type 0x3B / 59 (Cure Lycanthropy) [1 sub-record]
; Sub-record 1, State : Value is always valid. (confirmed)
; Message ID : 0xFFFF (confirmed)
; Role : GW : "if state TRUE then cure Lycanthropy."

Pseudo-code Type 0x3C / 60 (Play Sound) [2 sub-records]
; Sub-record 1, State : Value is always valid.
; Sub-record 2, Value : Index of a sound.
; Message ID : 0xFFFF (confirmed)
; Role : Play the sound once.

Pseudo-code Type 0x3D / 61 (Reputation) [3 sub-records]
; Sub-record 1, State : Value can be valid or 0xFF. (confirmed) Can be inverted with a 0x01 in byte [6] (confirmed).
; Sub-record 2, NPC : Value is always valid. (confirmed)
; Sub-record 3, Value : Reputation change. Can be positive of negative, so it must be a relative change.
; Message ID : 0xFFFF or a valid ID (confirmed)
; Role : GW : "if State TRUE then change Reputation with NPC"
: As the value can also be negative, it must be a relative change.
Pseudo-code Type 0x3E / 62 (Weather Override) [3 sub-records]
; Sub-record 1, State : Value can be valid or 0xFF. Can be inverted with a 0x01 in byte [6].
; Sub-record 2, Value : Region ID (0x8000 for the current region).
; Sub-record 3, Value : New weather. The value is increased by 1. Value of 0 removes the override.
; Role : Overrides the weather in the chosen region.
Pseudo-code Type 0x3F / 63 (Unknown) [2 sub-records]
; Sub-record 1, State : Value is always valid. (confirmed)
; Sub-record 2, Mob : Value is always valid. (confirmed)
; Message ID : 0xFFFF (confirmed)
; Role : Unknown
Pseudo-code Type 0x40 / 64 (Unknown) [2 sub-records]
; Sub-record 1, State : Value is always valid. (confirmed)
; Sub-record 2, Mob : Value is always valid. (confirmed)
; Message ID : 0xFFFF (confirmed)
; Role : Unknown
Pseudo-code Type 0x41 / 65 (Legal Reputation) [2 sub-records]
; Sub-record 1, State : Value can be valid or 0xFF. (confirmed) Can be inverted with a 0x01 in byte [6] (confirmed).
; Sub-record 2, Value : Reputation change. Can be positive of negative, so it must be a relative change.
; Message ID : 0xFFFF (confirmed)
; Role : GW : "if State TRUE then change player's Legal Reputation."
: As the value can also be negative, it must be a relative change.
Pseudo-code Type 0x44 / 68 (Mob) [3 sub-records]
; Sub-record 1, State : Value can be valid or 0xFF. (confirmed)
; Sub-record 2, Mob : Value is always valid. (confirmed)
; Sub-record 3, State : Value can be valid (only in P0B10L07.QBN) or 0xFF. (confirmed)
; Message ID : 0xFFFF (confirmed)
; Role : GW : "if State TRUE, then done with Mob"
: Why is State3 almost always 0xFF ?
Pseudo-code Type 0x45 / 69 (Mob) [3 sub-records]
; Sub-record 1, State : Value is always valid. (confirmed)
; Sub-record 2, Mob : Value is always valid. (confirmed)
; Sub-record 3, Value : Power Level, ranging from 0x00000006 to 0x00000040. (confirmed)
; Message ID : 0xFFFF (confirmed)
; Role : GW : "if State TRUE, set a Power level (?) for Mob to Constant"
Pseudo-code Type 0x46 / 70 (PC has Items) [5 sub-records]
; Sub-record 1, State : Value can be valid or 0xFF. (confirmed)
; Sub-record 2, State : Value is always valid. (confirmed)
; Sub-record 3, Item : Value is always valid. (confirmed)
; Sub-record 4, Item : Value can be valid (only in L0A01L00.QBN) or 0xFF. (confirmed)
; Sub-record 5, Item : Value is always 0xFF. (confirmed)
; Message ID : 0xFFFF (confirmed)
; Role : GW : "if State TRUE, then set State2 if player has Item2"
: In L0A01L00.QBN, there are two items. Is it a AND or a OR ?
Pseudo-code Type 0x47 / 71 (Take PC Gold) [4 sub-records]
; Sub-record 1, State : Value is always valid. (confirmed)
; Sub-record 2, State : Value is always valid. (confirmed)
; Sub-record 3, Value : Gold amount.
; Sub-record 4, NPC : Value is always valid. (confirmed)
; Message ID : 0xFFFF (confirmed)
; Role : Takes amount gold from PC, sets State1, and clears State2. If PC has not enough gold, clears State1 and sets State2.

Pseudo-code Type 0x48 / 72 (Unknown) [2 sub-records]
; Sub-record 1, State : Value is always valid. (confirmed)
; Sub-record 2, Value : Values are 0x00000003 and 0x0000000F. (confirmed)
; Message ID : 0xFFFF or a valid ID (confirmed)
; Role : Unknown
Pseudo-code Type 0x49 / 73 (PC casts Spell) [3 sub-records]
; Sub-record 1, State : Value can be valid or 0xFF. (confirmed)
; Sub-record 2, State : Value is always valid. (confirmed)
; Sub-record 3, Value : Values are 0x00000012, 0x00000033, 0x00000039. (confirmed) This value corresponds to a SPELLS.STD index number.
; Message ID : 0xFFFF (confirmed)
; Role : GW : "if State TRUE, then set State1 when player cast Spell #Value."

Pseudo-code Type 0x4C / 76 (Give Item to PC) [2 sub-records]
; Sub-record 1, State : Value can be valid or 0xFF. (confirmed)
; Sub-record 2, Item : Value is always valid. (confirmed)
; Message ID : 0xFFFF or a valid ID (confirmed)
; Role : GW : "if State TRUE, then give Item to Player."
: A message is displayed when the Item is given to the player. It is useful for Quest starting with a Letter. (see P0B30L11).
: See Also : Types 0x1A (Item to NPC) and 0x27 (Item to Mob)
Pseudo-code Type 0x4D / 77 (Check Player Level) [2 sub-records]
; Sub-record 1, State : Value is always valid. (confirmed)
; Sub-record 2, Value : Level required.
; Message ID : 0xFFFF (confirmed)
; Role : Sets the state if the player level is at least the value.

Pseudo-code Type 0x4E / 78 (Unknown) [2 sub-records]
; Sub-record 1, State : Value is always valid. (confirmed)
; Sub-record 2, Value : Faction ID.
; Message ID : 0xFFFF (confirmed)
; Role : Sets State1 if some condition is true.

Pseudo-code Type 0x4F / 79 (Check Faction Reputation) [2 sub-records]
; Sub-record 1, State : Value is always valid. (confirmed)
; Sub-record 2, Value : Faction code.
; Sub-record 3, Value : Required reputation.
; Message ID : 0xFFFF (confirmed)
; Role : Sets the state if the player reputation with the faction is greater or equal to the value.

Pseudo-code Type 0x51 / 81 (Locations, NPC) [3 sub-records]
; Sub-record 1, State : Value can be valid or 0xFF. (confirmed)
; Sub-record 2, Location : Value can be valid or 0xFF. (confirmed)
; Sub-record 3, NPC : Value can be valid or 0xFF. (confirmed)
; Message ID : 0xFFFF
; Role : Maybe to give some NPCs a place to live, to create them...
: GW : "Unknown".
Pseudo-code Type 0x52 / 82 (Stop NPC talk) [3 sub-records]
; Sub-record 1, State : Value is always valid. (confirmed) Can be inverted with a 0x01 in byte [6] (confirmed).
; Sub-record 2, NPC : Value is always valid. (confirmed)
; Message ID : 0xFFFF (confirmed)
; Role : GW : "if State TRUE, stop NPC from talking in the conversation screen.".
: What does that mean ?
Pseudo-code Type 0x53 / 83 (Location) [4 sub-records]
; Sub-record 1, State : Value is always valid. (confirmed)
; Sub-record 2, Location : Value is always valid. (confirmed)
; Sub-record 2, Value : Region ID.
; Sub-record 2, Value : Location ID.
; Message ID : 0xFFFF (confirmed)
; Role : Unknown

Pseudo-code Type 0x54 / 84 (Play Sound) [4 sub-records]
; Sub-record 1, State : Value is always valid. (confirmed)
; Sub-record 2, Value : Sound index from DAGSOUND.SND.
; Sub-record 3, Value : Period in minutes.
; Sub-record 4, Value : Percent chance.
; Message ID : 0xFFFF (confirmed)
; Role : GW : "if State TRUE, then play a sound"

Pseudo-code Type 0x55 / 85 (Choose Questor) [4 sub-records]
; Sub-record 1, State : Value can be valid or 0xFF. (confirmed)
; Sub-record 2, NPC : Value is always valid. (confirmed)
; Message ID : 0xFFFF (confirmed)
; Role : GW : "if State TRUE, then make NPC the `questor' for the current quest."
: What is the `questor' exactly ?
Pseudo-code Type 0x56 / 86 (End Questor) [4 sub-records]
; Sub-record 1, State : Value is always valid. (confirmed)
; Sub-record 2, NPC : Value is always valid. (confirmed)
; Message ID : 0xFFFF (confirmed)
; Role : GW : "if State TRUE, then stop NPC from being the `questor' for the current quest."
: What is the `questor' exactly ?
Pseudo-code Type 0x57 / 87 (Unknown) [5 sub-records]
; Sub-record 1, State : Value is always valid. (confirmed). Can be inverted with a 0x01 in byte [6] (confirmed).
; Sub-record 2, Mob : Value is always valid. (confirmed)
; Sub-record 3, Value : Delay, in minutes.
; Sub-record 4, Value : Chance in %.
; Sub-record 5, Value : Total count.
; Message ID : 0xFFFF (confirmed)
; Role : Spawns multiple mobs?

Variant Files
The following files deviate from the above documentation: 
#80C00Y00.QBN
#A0C00Y04.QBN
#A0C00Y06.QBN
#M0B00Y00.QBN
#N0C00Y01.QBN
#O0B10Y00.QBN
#P0B1XL08.QBN
#R0C40Y23.QBN
Each includes invalid instruction records, reporting an invalid  .