Skip to main content

Level 12: reference tables

Level 12 · The levels · Level data (INF)

In brief​

The details of level 12: the data of the level, how to read the script details, every scripted place and encounter as the scripts run it, the cell bindings, the level flags and the monster types, with its sublevel records when it has two. Its story page tells the same places and encounters in a few sentences each.

Level data​

The level has one sublevel record. It uses the maze LEVEL12.MAZ, which level 14 shares, the mezz graphics and the azure sound file, sets a step threshold of 100 and has one script timer. Its only monster graphics resource is guardian. It starts with 27 monsters, all drawn with that image; their monster types are described below.1

This page covers every reachable script of the reference file: 97 cell bindings, 103 script entry points including six shared subroutines, and 868 instructions. The decoding finds no unknown operand layout. Of the 6,075 script bytes, 28 are never executed: the nine-byte routine at offset 2 (below), two repeated returns and 17 bytes after level changes. Message colors are palette colors (Print a message). Sound numbers select entries of AZURE.ADL or AZURE.SND (see the sound-effect table).2

Reading this page​

  • Coordinates. A position [XX:YY] gives the column XX and the row YY, counting from 00; the block index used by the files and the instructions is YY × 32 + XX.
  • Directions and sides. Directions are 0 = north (decreasing row), 1 = east, 2 = south and 3 = west, and side s of a block is its face turned towards direction s (Direction). A wall is activated, or an item used on it, from the neighbouring block facing it: the lock on side 0 of [26:27] is used from [26:26] facing south.
  • Wrapping edges. The block ahead of the party wraps round the map: facing south from row 31 the party sees side 0 of the block in row 00 of the same column (Direction). Three banners of this level use it.
  • Script offsets count from the start of the INF script_data field (decoded payload offset 888 in the reference file). Message numbers index the level's 35 strings and text numbers TEXT.DAT; both are summarized, not quoted.
  • Speakers are chosen as on the level 4 page.
  • Plates. Wall references 35 and 36 on the four sides of a block are the two states of a pressure plate, which the game draws as decorations and only the scripts act on: they write 36 when something arrives on the plate and 35 when it leaves, so 35 is called raised and 36 pressed below.
  • Pits. Wall reference 38 on the four sides of a block is an open pit; the pit scripts also accept 39 (see level 14).
  • Teleporter blocks have WALL_REFERENCE_TELEPORTER (44) on all four sides.
  • Level flags are bits of this level's flag word (SCRIPT_FLAG_TARGET_LEVEL); their names below are descriptive.

Stairs​

Four stair blocks share one pattern. Entering in the required direction prints a message (0 down, 2 up), plays sound 79 and loads another level. Entering in any other direction prints message 1, plays sound 29 and moves the party back one block. Items placed or flying into a stair block go to the destination. As on level 5, the push-back is compiled as four tests of a constant, of which only one can succeed.2

StairsRequired directionMessageDestinationPushed back to
[28:24]2DownLevel 11, sublevel 0, [28:25], facing 2[28:23]
[27:28]2UpLevel 13, sublevel 0, [27:29], facing 2[27:27]
[24:12]0DownLevel 14, sublevel 0, [06:02], facing 0[24:13]
[30:23]0UpLevel 14, sublevel 0, [03:16], facing 0[30:24]

The two stairs to level 14 lead to separate parts of that level, which stairs and pits join; see level 14. The stairs up to level 13 lie behind the gate of [27:27].

Pits​

Every pit of the level drops the party to level 11, at the same position and with the same facing. A fall deals 2d6 to every character with SCRIPT_DAMAGE_RING_NEGATES and no saving throw, so a character wearing a ring of Feather Fall takes none; one such ring lies on this level, in the niche of [22:30]. Items that land in an open pit, or lie in a pit when it opens, go to the same position of level 11.2

Two pits are always open: [19:14] and [17:20], on either side of the plate room. Their scripts, and those of the moving pits, run on BLOCK_EVENT_PARTY_ENTER and BLOCK_EVENT_ITEM_PLACED, and act only while the block holds reference 38 or 39.

Moving pits​

The level's only timed block script sends BLOCK_EVENT_TIMER to [01:00] with an interval of 3, that is 54 ticks of the game clock, about three seconds. The script moves one open pit among [22:21], [24:21] and [25:21]; [23:21], between them, never opens. Each run plays sound 17 at [24:21], then closes the open pit and opens the next one, playing sound 17 at each of the two blocks:3

Open pit before the eventOpen pit after it
[25:21] (the map's state)[24:21]
[24:21][22:21]
[22:21][25:21]

Opening a pit first sends the block's items to level 11, then, if the party stands there, deals the fall damage and loads level 11. A pit that the party enters while it is open acts like the fixed pits.

The script decides from side 0 of [22:21] and [25:21] which step to take, and toggles each block between references 0 and 38. Its toggle also handles a block whose side 2 holds 37, which it would switch between 37 and 39, the pattern that level 14 uses for holes in a ceiling; the three blocks never hold 37, so that branch never runs.

Locks and keys​

The gate of [27:27] separates the stairs up to level 13 from the rest of the level: its north and south faces carry wall reference 67, a solid wall. The party arriving from level 13 at [27:27] can walk out north, because only the face of the block entered is checked (moving the party), but cannot come back while the gate is closed. Two locks flank it: side 0 of [26:27], used from [26:26], and side 0 of [28:27], used from [28:26]. Each lock has a script that runs when the player activates it, and reads the item held on the mouse pointer:4

  1. If the gate still holds 67:
    • The right key (type 38, ITEM_TYPE_KEY, value 12 for [26:27], the Shell Key; value 11 for [28:27], the Crystal Key): sound 14, then, if the lock's flag (0 or 1) is clear, the key is deleted from the hand and the flag set. If the other lock's flag is still clear, message 3 reports a partial success; otherwise the gate's four sides become 0 and sound 13 plays. A key used on a lock already open plays sound 14 and does nothing else.
    • Another key: message 4 (a wrong key) and sound 81.
    • Lock picks (type 28): with a CHARACTER_CLASS_THIEF in the party (CharacterClassMask), sound 81 and message 5, a failed attempt; without one, message 6, a thief is needed. No test is rolled: the lock cannot be picked.
    • Anything else: message 7 (a key is needed) while the lock is closed, message 8 (already unlocked) once it is open.
  2. Once the gate is open, the lock of [26:27] shows message 8 and the lock of [28:27] message 9, a jammed lock.

Before testing its flag, each script calls the gate opener at offset 11, which opens the gate when flags 0 and 1 are both set. At that point they never are, because the gate is open as soon as both are set, so that call has no effect. In the reference data a Shell Key lies at [19:30]; a Crystal Key lies in the niche of [22:30], with the ring of Feather Fall, and the entrance guardian of [05:28] leaves another when it dies.

A third lock, side 2 of [06:25] (used from [06:26]), guards the door of [05:25]. It follows the same pattern with the Crystal Key, but opens the door with SCRIPT_OPEN_DOOR and uses no flag: it accepts the key while side 2 of [05:25] holds 8 or 18, the closed state of a door, and otherwise shows message 8. Lock picks fail there in the same way.2

The lever doors​

In the east centre, the lever on side 1 of [22:25] (used from [23:25]) works one of two doors. Each pull plays sound 7, redraws the scene, waits 3, plays sound 7 again and sets the lever's face back to reference 27, so the lever springs back. It then asks the door of [22:26] to change state with SCRIPT_TOGGLE_DOOR, or the door of [22:24] once level flag 2 is set. Entering [17:30], in the small area that the teleporter of [20:27] leads to, sets that flag.2

The three plates of [23:24], [23:25] and [23:26], in front of the doors, play sound 12 when the party enters or leaves them, and do nothing else: no script changes their reference. Two plaques nearby show message 10 (side 2 of [23:22], on guarding) and message 11 (side 0 of [23:28], a hint at a shorter way).

Teleporters​

Five teleporter blocks move the party, or the items placed or flying into them, within the level, with sound 15:2

TeleporterDestinationParty's new facing
[25:17][05:31]0
[20:27][18:27]2
[20:30][24:25]3
[06:31][24:25]3
[24:30][24:25]Unchanged

East of [24:25], the destination of three of them, [25:25] carries WALL_REFERENCE_ILLUSION on its four sides; see remarks and banners.

The entrance guardians​

The two peaceful guardians at [05:28] and [06:28] stand north of [05:29] and [06:29]. Entering either block while level flag 5 is clear turns the party to face 0, redraws the scene and opens a dialogue: text 71, in which they declare the entrance closed to all but Dran, with two answers, attack (message 12) and leave (message 13):5

  • Leave: the screen closes, and after a wait of 5 the party is moved one block back south, to [05:30] or [06:30]. The dialogue starts again at the next entry.
  • Attack: level flag 5 is set and text 72 shows a guardian calling his brethren to help as he rushes forward. When the screen closes, sides 1 and 3 of [08:29] are set to reference 12, the open state of a door, so that door, east of the guardians, stands open at once; the door of [03:29], to the west, is asked to open; and monster slots 26 and 27 are provoked with MONSTER_RUNTIME_PROVOKED, which switches both to MONSTER_MODE_PURSUE. The guardians of [09:29] and [02:29] wait behind those doors.

[05:28] and [06:28] also bind BLOCK_EVENT_MONSTER_EXIT: when either guardian leaves its block, by moving or by dying (a dead monster is moved to [00:00]), the same four effects follow and level flag 5 is set, without a dialogue and whatever the flag's state. Attacking one of them without talking first therefore has the same result: the attack rouses both peaceful guardians, and the first to move or die opens the doors.

The magic mouth​

Entering [04:24] the first time (level flag 7) turns the party to face 2, towards side 0 of [04:25], where a mouth is carved. The dialogue screen opens, sound 63 plays and text 73 cries that there are intruders and calls the guards. Twelve pictures from MMOUTH1.CPS, taken from its four quarters, follow with a wait of 5 between them; a prompt (message 14) closes the screen, and the door of [03:25] is asked to open. The guardians of [02:26], [03:26] and [03:27] stand beyond it. Activating the mouth itself shows message 34, which describes it as cold stone.2

The sigil and the fireball ring​

[05:21] carries reference 60 on its four sides, a face that the party can walk through. Facing north from [05:22], a CHARACTER_CLASS_MAGE of the party identifies the carving once as a magic sign meant to protect and to give warning (message 30, sound 79, level flag 12).2

Every entry into [05:21]:

  1. asks the door of [06:21], east of it, to open;
  2. launches two fireballs with SCRIPT_LAUNCH_OBJECT, one from [10:22] travelling south and one from [09:24] travelling west, as magic object type 2; they deal 1d6 × 9 on this level;
  3. redraws the scene, shows the lightning of SCRIPT_SPECIAL_EVENT_LIGHTNING and deals 5d6 to every character, with no saving throw and no ring protection.

The fireballs start in the ring of eight blocks around the plate of [09:23]. Its four corners, [08:22], [10:22], [08:24] and [10:24], carry reference 25, which the party and flying objects pass, and their scripts turn every flying object that enters them a quarter to the right (SCRIPT_CHANGE_DIRECTION with SCRIPT_DIRECTION_MOVERS). The two fireballs therefore go round the ring clockwise, one turn about every two seconds; a scripted fireball has no range limit, so they circle until something stops them, such as the corners turning into walls or the party stepping into the ring.

One turn takes 12 flight steps, 36 ticks. Two runs of the game's own routines show how the circling ends. With the corners set to reference 1 before step 15, the fireballs end at steps 16 and 17 and the party, elsewhere, is unharmed. With the party moved to [09:22] before step 15, they end at steps 18 and 23, as each one reaches it, and four characters of 20 hit points end at −10.6

The plate of [09:23] starts pressed under two items: a scroll and Brahma's boots. It is released by the party leaving it with no item left on it, or by the last item being taken from it while the party is elsewhere. Release plays sound 12, sets the plate to 35, plays sound 13 at [08:22] the first time, turns the four corners into solid walls (reference 1) for good, and launches four fireballs at the plate, one from each of the smoking holes that face it: from [09:20] south, [12:23] west, [09:26] north and [06:23] east, with sound 98. The plate is pressed again (sound 12, reference 36) by the party entering it with no item there, or by an item landing on it while it is empty and the party is elsewhere. Activating any of the four holes shows message 16, about a smell of smoke.

East of [05:21], [07:21] is a plate: the first party entry presses it, plays sound 12 and closes the door of [06:21] again. Its script reacts only while the plate is raised, and nothing raises it again, so later entries do nothing. Entering [08:21] or [07:22] asks the door of [07:20] to open.

The secret button and the smoking hole​

North of the ring, on entering [08:18], a CHARACTER_RACE_DWARF (CharacterRace) of the party suspects a hidden button in the room (message 17); without one, a CHARACTER_CLASS_THIEF expects a hidden exit (message 18). Either remark plays sound 79 and sets level flag 19, so only one is ever made. The button is side 1 of [06:19], a lever face: activating it plays sound 7, switches the four sides of [06:18] between 0 and 1, opening or closing the wall, and plays sound 13 there.2

Further north, the levers on side 3 of [08:15] and side 1 of [06:13] each play sound 7 and ask the door of [07:14] to change state. A plaque on side 2 of [05:15] shows message 19, advising to accept a small hurt to spare a greater one.

The plate of [07:13] reacts to the party, to items and to monsters. When nothing remains on it — the party leaves with no item there, the last item is taken while the party is elsewhere, or a monster leaves an otherwise empty block — it rises (reference 35); when something arrives on the empty plate — the party, a first item, or a monster — it is pressed (36). Both changes play sound 12 and launch a fireball travelling north from the smoking hole of [07:17] (side 0, message 16 on activation), with sound 98: from its second starting position on release, its first on pressing. Each crossing of the plate therefore sends two fireballs up the corridor towards it.

The guardian hall​

Thirteen guardians of type 0 stand in two groups, seven west and six east of the corridor that runs north from [07:13]. On row 11, the corridor's neighbours [06:11] and [08:11] carry reference 26, WALL_REFERENCE_CLEARED_ON_ENTRY, whose mapping lets the party through but not monsters; the party entering such a block clears its four sides. Between them, the plate of [07:11] starts pressed under the inactive guardian of type 1.2

The plate of [07:11] reacts to the same events and conditions as that of [07:13]. Pressing it plays sound 12 and sets reference 36. Releasing it sets reference 35, sets the four sides of [06:11] and [08:11] to 0, which lets monsters cross them, and plays sound 12. The type-1 guardian leaving the plate, which it does when provoked or killed, therefore opens these two blocks to the monsters, and so does the party stepping off the plate without leaving an item on it.

The lever on side 2 of [04:09] (used from [04:10]) plays sounds 1 and 13, then switches each of [05:09] and [09:09] between 1, a wall, and 0, open, moves any monster of [05:09] to [05:14] and of [09:09] to [09:10], and places nine guardians in the room [06:05]–[08:07], all facing south. It does so at every activation; the placement checks refuse an occupied block.

The cracked walls and the rod​

[07:09], north of the hall, is closed by two cracked walls: the east and west faces of [06:09] and of [08:09] carry reference 67. Using an item of kind ITEM_KIND_MELEE (ItemKind) — a melee weapon or the empty hand — on side 3 of [06:09] (from [05:09]) or side 1 of [08:09] (from [09:09]) advances a counter kept in level flags 8–10, then:2

  • if flag 10 is now set, the block's four sides become 0 and the scene is redrawn: the wall is broken;
  • otherwise message 20 says that the wall is starting to give.

The counter is shared by both walls and counts the blows on either. The fourth blow breaks the wall it hits. The next blow, on the other wall, sets the counter to five, which keeps flag 10 set: the second wall breaks at once. Both walls can be reached only when the lever of [04:09] has opened [05:09] and [09:09].

[07:09] holds a scroll and an item of type 50 and value 5 that has no name in ITEM.DAT (template 84, whose type is of kind ITEM_KIND_WAND). It fits the hole on side 0 of [11:16] (used from [11:15]):7

  • With the hole empty (reference 53), holding that item: sound 14, the face becomes 54, the item is deleted from the hand and level flag 4 is set. With the empty hand: message 21, a remark on the hole. Any other item: message 22, a refusal, and sound 81.
  • With the hole filled (54), clicking with the empty hand creates a new copy of template 84, on the mouse pointer, plays sound 14, sets the face back to 53 and asks the door of [12:15] to open. Any held item gives message 22 and sound 81.

Khelben's vision​

Entering [13:28] first clears bit 20 of the global flags. The first time (level flag 6), the script sets that bit again and opens the dialogue screen: message 23 tells of a moment of dizziness and a vision of Khelben, sound 54 plays, and after a wait of 40 the KHELBEN.CPS picture appears through the pixel dissolve (SCRIPT_DIALOGUE_BITMAP_TRANSITION), followed by a wait of 60. Two texts follow, each shown without a prompt and followed by a 16-picture animation from the quarters of KHELBEN.CPS (subroutine 222, a wait of 6 between pictures):8

  • text 74: Dran has found the party and is preparing a spell that will turn it to ash and make resurrection impossible; Khelben will send a talisman;
  • text 111: the party must let Dran's creatures beyond the door kill it, to break Dran's hold, and the talisman will bring it back.

The items of [14:28], a wall block east of [13:28], then move to the party's block. In the reference data, that is one item: unidentified, its name is an amulet of resurrection; identified, a bauble. It is of type 44, of kind ITEM_KIND_MISC, which has no use of its own, and it carries ITEM_RUNTIME_CURSED and ITEM_RUNTIME_MAGICAL.

Around [13:28]:

  • the lever on side 3 of [14:28] plays sound 7 and asks the door of [13:29], to the south, to open;
  • beyond it, the plate of [13:30] closes that door behind the party the first time it is pressed (sound 12); nothing raises it again;
  • the lever on side 1 of [12:30] plays sound 7 and, unless side 0 of [15:29] already holds 12, the open state of a door, places three guardians at [15:27], [15:28] and [16:28], facing south, and asks the door of [15:29] to open: these are the creatures beyond the door.

Bit 20 of the global flags is therefore set only from the first vision until the next entry into [13:28] or the skull scene. No script reads it, but the game itself does: if the whole party is defeated while it is set, a short scene with the KHELDRAN picture plays before the game offers to load a saved game. The scene changes nothing: the party is not brought back.9

The skull​

Side 2 of [16:26], used from [16:27], carries a skull (reference 62). Activating it shows message 27, which describes the skull of a fierce creature. The guardian that starts on [16:27] leaves a Tooth when it dies (template 79, type 38 of value 13).10

  • The Tooth in hand: sound 14, message 25 (the Tooth is accepted), the face becomes 63 and the Tooth is deleted. The first time, while [15:26] does not yet hold reference 25, the four sides of [15:26], a wall west of the skull, become 25, which the party can pass; sound 13 plays there, the scene is redrawn and bit 20 of the global flags is cleared. Then the dialogue screen shows KHELDRAN.CPS through the pixel dissolve with sound 62; message 26 calls the party fools; after sound 55 three more quarters of the picture follow, and text 75 is Dran's taunt: he will be a god and the party will be crushed.
  • Anything else, with the skull empty, the empty hand included: message 27.
  • The empty hand, with the Tooth in place (63): sound 14, message 28 (the Tooth breaks loose), the face returns to 62 and a new copy of template 79 is created with SCRIPT_CREATE_ITEM, on the mouse pointer if it is empty, otherwise in the party's block. The Tooth can thus be taken back and used again, but the scene plays only once.
  • Any other item, with the Tooth in place: message 27.

The empty-hand tests of this skull and of the hole compare the held item's type with 0. An empty hand reads item entry 0, whose type is 0 (held item); in the reference ITEM.DAT the Axe, the axe "the bait" and the Vial also have type 0, so holding one of them counts as an empty hand here, and the new copy then lands in the party's block.

The plate room​

The room of [15:15] to [21:19] is a puzzle solved by throwing items. Its middle, [17:15] to [19:19], is open to the party; on each side, a closed corridor ([15:15]–[15:19] and [21:15]–[21:19]) holds three plates, at rows 15, 17 and 19, behind the walls of [16:15]–[16:19] and [20:15]–[20:19]. North and south of the room, beyond the open pits of [19:14] and [17:20], two teleporter blocks, [19:13] and [17:21], take items only.11

In the middle of the room:

  • Row plates. [18:16], [18:17] and [18:18], on the party's entry while raised: sound 12, all three are raised (subroutine 169), then the one entered is pressed. One of them, at most, is pressed at a time.
  • Teleporter plates. [17:17] and [19:17], on entry while raised: sound 12, both are raised, the two teleporters become plain floor (reference 0) and their items go to [19:20] (subroutine 185); then the plate entered is pressed and its teleporter is set back to reference 44: [17:17] activates [17:21], [19:17] activates [19:13]. Only one teleporter is active at a time. The script chooses the teleporter by comparing its own column with the constant 17.

When an item lands in, or flies into, an active teleporter, its script turns the flying objects of the block a quarter (to the right at [19:13], to the left at [17:21]) and moves the block's items, with any flying object, to the plate of the pressed row on its side of the room — [21:15], [21:17] or [21:19] for [19:13], [15:15], [15:17] or [15:19] for [17:21] — or to [19:20] when no row plate is pressed. An item thrown north from the room flies over the pit of [19:14]; on entering [19:13] it is turned east and moved, still in flight, to the plate of the pressed row, where it lands half a block further on and presses the plate. With no row plate pressed it goes to [19:20] in the same way, flies half a block east, is stopped by the rock of [20:20] and lies at [19:20] (inferred from the flight rules).

Each side plate is pressed by the first item placed on it (sound 12, reference 36), and nothing raises it again. After each, the plate check at offset 34 tests the six side plates. When all six are pressed, and side 0 of [17:14] is not 0, it plays sound 13 at [16:17] and [20:17], sets these two blocks to 0, which opens both corridors to the middle of the room, and asks the door of [17:14], at the north of the room, to open. The west corridor holds a scroll, at [15:16].

Remarks and banners​

Party members comment on a few places, once each, with sound 79:2

PositionConditionMessageLevel flagRemark
[26:25]A CHARACTER_RACE_ELF2911Something is wrong with the west wall's masonry.
[13:27]A CHARACTER_CLASS_MAGE, 3 chances in 10 (1d10 below 4), flag 20 clear3114The west wall is not real.
[05:22]Facing 0, a CHARACTER_CLASS_MAGE3012The sigil.
[19:22]A CHARACTER_CLASS_CLERIC3217Trust in the party's strength; the cleric will pray.
[08:18]A CHARACTER_RACE_DWARF, or else a CHARACTER_CLASS_THIEF17, 1819The secret button.

The west walls in question are [25:25] and [12:27], whose four sides carry WALL_REFERENCE_ILLUSION. Entering [12:27] sets level flag 20, which ends the chance of the mage's remark at [13:27]. When the 1d10 roll fails, the remark can still come on a later entry.

Seventeen banners show message 33, describing a royal banner, when activated: [05:20], [06:18], [06:22], [06:24], [07:27], [08:20], [08:26], [10:20], [10:26], [12:22], [12:24], [14:29], [18:14], [18:20], [13:00], [14:00] and [15:00]. The last three carry their banner on side 0, the northern edge of the map: the party sees and activates them from [13:31], [14:31] and [15:31], facing south, through the wrapping edge. The banner of [06:18] is lost when the secret button sets the block's four sides.

Bindings​

PositionEnabled eventsScriptPurpose
[00:00]none (BLOCK_EVENT_STEP_COUNT)620Where they appear, every 101st move
[01:00]none (BLOCK_EVENT_TIMER)670Moving pits, on the timer
[22:21]BLOCK_EVENT_PARTY_ENTER, BLOCK_EVENT_ITEM_PLACED1351Moving pits
[24:21]BLOCK_EVENT_PARTY_ENTER, BLOCK_EVENT_ITEM_PLACED1416Moving pits
[25:21]BLOCK_EVENT_PARTY_ENTER, BLOCK_EVENT_ITEM_PLACED1481Moving pits
[17:20]BLOCK_EVENT_PARTY_ENTER, BLOCK_EVENT_ITEM_PLACED5139Pits
[19:14]BLOCK_EVENT_PARTY_ENTER, BLOCK_EVENT_ITEM_PLACED5204Pits
[28:24]BLOCK_EVENT_PARTY_ENTER, BLOCK_EVENT_ITEM_PLACED, BLOCK_EVENT_FLYING_OBJECT1546Stairs, down to level 11
[27:28]BLOCK_EVENT_PARTY_ENTER, BLOCK_EVENT_ITEM_PLACED, BLOCK_EVENT_FLYING_OBJECT1673Stairs, up to level 13
[24:12]BLOCK_EVENT_PARTY_ENTER, BLOCK_EVENT_ITEM_PLACED, BLOCK_EVENT_FLYING_OBJECT1800Stairs, down to level 14
[30:23]BLOCK_EVENT_PARTY_ENTER, BLOCK_EVENT_ITEM_PLACED, BLOCK_EVENT_FLYING_OBJECT1927Stairs, up to level 14
[26:27]none (BLOCK_EVENT_WALL_DECORATION)2054Locks and keys, gate lock, Shell Key
[28:27]none (BLOCK_EVENT_WALL_DECORATION)2229Locks and keys, gate lock, Crystal Key
[06:25]none (BLOCK_EVENT_WALL_DECORATION)2611Locks and keys, door lock, Crystal Key
[22:25]none (BLOCK_EVENT_WALL_DECORATION)2419The lever doors, lever
[17:30]BLOCK_EVENT_PARTY_ENTER2459The lever doors, door choice
[23:24]BLOCK_EVENT_PARTY_ENTER, BLOCK_EVENT_PARTY_LEAVE2404The lever doors, plate
[23:25]BLOCK_EVENT_PARTY_ENTER, BLOCK_EVENT_PARTY_LEAVE2409The lever doors, plate
[23:26]BLOCK_EVENT_PARTY_ENTER, BLOCK_EVENT_PARTY_LEAVE2414The lever doors, plate
[23:22]none (BLOCK_EVENT_WALL_DECORATION)2463The lever doors, plaque
[23:28]none (BLOCK_EVENT_WALL_DECORATION)2469The lever doors, plaque
[25:17]BLOCK_EVENT_PARTY_ENTER, BLOCK_EVENT_ITEM_PLACED, BLOCK_EVENT_FLYING_OBJECT2475Teleporters
[20:27]BLOCK_EVENT_PARTY_ENTER, BLOCK_EVENT_ITEM_PLACED, BLOCK_EVENT_FLYING_OBJECT2509Teleporters
[20:30]BLOCK_EVENT_PARTY_ENTER, BLOCK_EVENT_ITEM_PLACED, BLOCK_EVENT_FLYING_OBJECT2543Teleporters
[06:31]BLOCK_EVENT_PARTY_ENTER, BLOCK_EVENT_ITEM_PLACED, BLOCK_EVENT_FLYING_OBJECT2577Teleporters
[24:30]BLOCK_EVENT_PARTY_ENTER, BLOCK_EVENT_ITEM_PLACED, BLOCK_EVENT_FLYING_OBJECT5779Teleporters
[05:29]BLOCK_EVENT_PARTY_ENTER2737The entrance guardians
[06:29]BLOCK_EVENT_PARTY_ENTER2826The entrance guardians
[05:28]BLOCK_EVENT_MONSTER_EXIT2915The entrance guardians, alarm
[06:28]BLOCK_EVENT_MONSTER_EXIT2942The entrance guardians, alarm
[04:24]BLOCK_EVENT_PARTY_ENTER2969The magic mouth
[04:25]none (BLOCK_EVENT_WALL_DECORATION)6071The magic mouth, the mouth
[05:21]BLOCK_EVENT_PARTY_ENTER3308The sigil, trap
[05:22]BLOCK_EVENT_PARTY_ENTER5840Remarks and banners, remark
[07:21]BLOCK_EVENT_PARTY_ENTER, BLOCK_EVENT_PARTY_LEAVE3340The sigil, door plate
[08:21]BLOCK_EVENT_PARTY_ENTER3373The sigil, door
[07:22]BLOCK_EVENT_PARTY_ENTER3377The sigil, door
[08:22]BLOCK_EVENT_FLYING_OBJECT3381The fireball ring, corner
[10:22]BLOCK_EVENT_FLYING_OBJECT3385The fireball ring, corner
[08:24]BLOCK_EVENT_FLYING_OBJECT3389The fireball ring, corner
[10:24]BLOCK_EVENT_FLYING_OBJECT3393The fireball ring, corner
[09:23]BLOCK_EVENT_PARTY_ENTER, BLOCK_EVENT_PARTY_LEAVE, BLOCK_EVENT_ITEM_PLACED, BLOCK_EVENT_ITEM_REMOVED3397The fireball ring, plate
[09:20]none (BLOCK_EVENT_WALL_DECORATION)3575The fireball ring, smoking hole
[12:23]none (BLOCK_EVENT_WALL_DECORATION)3581The fireball ring, smoking hole
[09:26]none (BLOCK_EVENT_WALL_DECORATION)3587The fireball ring, smoking hole
[06:23]none (BLOCK_EVENT_WALL_DECORATION)3593The fireball ring, smoking hole
[08:18]BLOCK_EVENT_PARTY_ENTER3599The secret button, remark
[06:19]none (BLOCK_EVENT_WALL_DECORATION)3658The secret button, button
[05:15]none (BLOCK_EVENT_WALL_DECORATION)3673The secret button, plaque
[08:15]none (BLOCK_EVENT_WALL_DECORATION)3679The secret button, door lever
[06:13]none (BLOCK_EVENT_WALL_DECORATION)3688The secret button, door lever
[07:17]none (BLOCK_EVENT_WALL_DECORATION)3697The smoking hole
[07:13]BLOCK_EVENT_PARTY_ENTER, BLOCK_EVENT_PARTY_LEAVE, BLOCK_EVENT_ITEM_PLACED, BLOCK_EVENT_ITEM_REMOVED, BLOCK_EVENT_MONSTER_ENTER, BLOCK_EVENT_MONSTER_EXIT3703The smoking hole, plate
[07:11]BLOCK_EVENT_PARTY_ENTER, BLOCK_EVENT_PARTY_LEAVE, BLOCK_EVENT_ITEM_PLACED, BLOCK_EVENT_ITEM_REMOVED, BLOCK_EVENT_MONSTER_ENTER, BLOCK_EVENT_MONSTER_EXIT3920The guardian hall, plate
[04:09]none (BLOCK_EVENT_WALL_DECORATION)4123The guardian hall, lever
[06:09]BLOCK_EVENT_ITEM_USED4291The cracked walls
[08:09]BLOCK_EVENT_ITEM_USED4338The cracked walls
[11:16]none (BLOCK_EVENT_WALL_DECORATION)4385The rod, hole
[13:28]BLOCK_EVENT_PARTY_ENTER4505Khelben's vision
[14:28]none (BLOCK_EVENT_WALL_DECORATION)4611Khelben's vision, lever
[12:30]none (BLOCK_EVENT_WALL_DECORATION)4619Khelben's vision, lever
[13:30]BLOCK_EVENT_PARTY_ENTER4684Khelben's vision, plate
[16:26]none (BLOCK_EVENT_WALL_DECORATION)4708The skull
[18:16]BLOCK_EVENT_PARTY_ENTER5611The plate room, row plate
[18:17]BLOCK_EVENT_PARTY_ENTER5635The plate room, row plate
[18:18]BLOCK_EVENT_PARTY_ENTER5659The plate room, row plate
[17:17]BLOCK_EVENT_PARTY_ENTER5683The plate room, teleporter plate
[19:17]BLOCK_EVENT_PARTY_ENTER5731The plate room, teleporter plate
[19:13]BLOCK_EVENT_ITEM_PLACED, BLOCK_EVENT_FLYING_OBJECT4961The plate room, item teleporter
[17:21]BLOCK_EVENT_ITEM_PLACED, BLOCK_EVENT_FLYING_OBJECT5050The plate room, item teleporter
[15:15]BLOCK_EVENT_ITEM_PLACED5269The plate room, side plate
[15:17]BLOCK_EVENT_ITEM_PLACED5326The plate room, side plate
[15:19]BLOCK_EVENT_ITEM_PLACED5383The plate room, side plate
[21:15]BLOCK_EVENT_ITEM_PLACED5440The plate room, side plate
[21:17]BLOCK_EVENT_ITEM_PLACED5497The plate room, side plate
[21:19]BLOCK_EVENT_ITEM_PLACED5554The plate room, side plate
[26:25]BLOCK_EVENT_PARTY_ENTER5810Remarks and banners, remark
[13:27]BLOCK_EVENT_PARTY_ENTER5886Remarks and banners, remark
[12:27]BLOCK_EVENT_PARTY_ENTER5935Remarks and banners, illusion
[19:22]BLOCK_EVENT_PARTY_ENTER5939Remarks and banners, remark
[05:20]none (BLOCK_EVENT_WALL_DECORATION)5969Remarks and banners, banner
[06:22]none (BLOCK_EVENT_WALL_DECORATION)5975Remarks and banners, banner
[06:24]none (BLOCK_EVENT_WALL_DECORATION)5981Remarks and banners, banner
[08:20]none (BLOCK_EVENT_WALL_DECORATION)5987Remarks and banners, banner
[08:26]none (BLOCK_EVENT_WALL_DECORATION)5993Remarks and banners, banner
[10:20]none (BLOCK_EVENT_WALL_DECORATION)5999Remarks and banners, banner
[10:26]none (BLOCK_EVENT_WALL_DECORATION)6005Remarks and banners, banner
[12:22]none (BLOCK_EVENT_WALL_DECORATION)6011Remarks and banners, banner
[12:24]none (BLOCK_EVENT_WALL_DECORATION)6017Remarks and banners, banner
[13:00]none (BLOCK_EVENT_WALL_DECORATION)6023Remarks and banners, banner
[14:00]none (BLOCK_EVENT_WALL_DECORATION)6029Remarks and banners, banner
[15:00]none (BLOCK_EVENT_WALL_DECORATION)6035Remarks and banners, banner
[14:29]none (BLOCK_EVENT_WALL_DECORATION)6041Remarks and banners, banner
[06:18]none (BLOCK_EVENT_WALL_DECORATION)6047Remarks and banners, banner
[18:14]none (BLOCK_EVENT_WALL_DECORATION)6053Remarks and banners, banner
[18:20]none (BLOCK_EVENT_WALL_DECORATION)6059Remarks and banners, banner
[07:27]none (BLOCK_EVENT_WALL_DECORATION)6065Remarks and banners, banner

Six subroutines are reached only by SCRIPT_CALL: the gate opener at offset 11 (locks and keys), the plate check at offset 34 (the plate room), the counter at offset 117 (the guardian hall), the plate resets at offsets 169 and 185 (the plate room) and Khelben's animation at offset 222 (Khelben's vision).

Level flags​

BitSet byCleared byMeaning (descriptive)
0The Shell Key in the lock of [26:27]—The first gate lock is open.
1The Crystal Key in the lock of [28:27]—The second gate lock is open.
2Entering [17:30]—The lever of [22:25] works the north door.
3The step scriptThe step scriptThe next guardian of the step script goes to [03:13].
4The rod in the hole of [11:16]—Read by no script.
5Attacking the entrance guardians; either one leaving its block—The entrance guardians have been roused.
6Entering [13:28]—Khelben's vision has been shown.
7Entering [04:24]—The magic mouth has raised the alarm.
8–10Melee blows on the cracked wallsThe same blowsA three-bit counter of blows; bit 8 is the lowest.
11Entering [26:25]—The elf's remark on the illusory wall has been made.
12Entering [05:22]—The mage's remark on the sigil has been made.
14Entering [13:27]—The mage's remark on the illusory wall has been made.
17Entering [19:22]—The cleric's remark has been made.
19Entering [08:18]—The remark on the secret button has been made.
20Entering [12:27]—The party has walked into the illusory wall of [12:27].

The level also writes bit 20 of the global flags, described under Khelben's vision.

Monster types​

The level defines two monster types, 0 and 1, and one monster image, guardian (GUARDIAN.CPS, with no decoration file). Every monster of the level, placed at the start or by a script, uses that image, and no type selects a decoration, so the two types look the same. The dialogues call these monsters guardians; the game stores no name for a monster type.12

Property (INF field)Type 0Type 1
Armour class (armor_class)−18
Hit chance (hit_chance)1017
Level for saving throws (level)1010
Hit points (hit_points_dice)10d81d4
Melee attacks: count and damage3: 1d10, 1d12, 1d121: 1d4
MonsterCapabilityFlagsMONSTER_CAP_LARGE, MONSTER_CAP_ALT_FRAME_TABLEMONSTER_CAP_LARGE, MONSTER_CAP_ALT_FRAME_TABLE
MonsterImmunityFlagsMONSTER_IMMUNE_BIT_0_UNKNOWN, MONSTER_IMMUNE_FEAR, MONSTER_IMMUNE_ELECTRICITY, MONSTER_IMMUNE_COLD, MONSTER_IMMUNE_NEEDS_PLUS_TWOnone
Type flags (type_flags)none: no hold spell affects itnone
Experience (experience)11 00011 000
Occupancy class (occupancy_class)22
Attack and step sounds (sound_1, sound_2)41, 4041, 40
Ranged attacksnonenone
Turn resistance, evasion (turn_resistance, damage_modifier)−1, 25−1, 25

Type 1, with 1d4 hit points and a single weak attack, gives the same experience as type 0. Occupancy class 2 keeps every guardian alone in its block.

Where they appear​

The 27 monsters present at the start are:1

  • 24 of type 0 in MONSTER_MODE_PURSUE (MonsterMode), all at position 4: [02:26], [03:26], [03:27], [02:29], [09:29], [07:18], [09:18], [08:19], [08:21], [07:22], [16:27], and thirteen in the guardian hall: [05:10], [09:10], [03:11], [04:11], [05:11], [09:11], [10:11], [03:12], [04:12], [05:12], [09:12], [10:12] and [11:12];
  • one of type 1 at [07:11], in MONSTER_MODE_DELAYED with a counter of 0, so that it stays inactive until provoked;
  • the two entrance guardians, of type 0, at [05:28] and [06:28] in slots 26 and 27, in MONSTER_MODE_PEACEFUL.

Two of them carry an item that every death leaves in their block: the guardian of [16:27] a copy of template 79, the Tooth, and the entrance guardian of [05:28] a copy of template 77, a Crystal Key.1

Three scripts place more guardians of type 0 in MONSTER_MODE_WANDER_LEFT at position 4, with SCRIPT_SPAWN_MONSTER, whose checks refuse a block that holds a monster or the party:2

  • Every 101st move ([00:00], offset 620): the step-triggered script runs when the party's move counter exceeds 100. It places one guardian facing north, alternately at [10:10] and [03:13], starting with [10:10]; level flag 3 records which comes next.
  • The lever of [04:09]: nine guardians, one in each block of [06:05] to [08:07]; see the guardian hall.
  • The lever of [12:30]: three guardians, at [15:27], [15:28] and [16:28]; see Khelben's vision.

The unused routine at offset 2​

The first nine script bytes, at offset 2, form a complete routine: SCRIPT_DAMAGE_CHARACTERS on every character, 2d6 with SCRIPT_DAMAGE_RING_NEGATES and no saving throw, then SCRIPT_RETURN. Its bytes are those of the fall damage that the level's 11 pit instructions contain inline. No binding, call or jump of the level reaches it, and no other way of starting a script can (see how a run starts): it never runs. Level 14 has the same routine at the same offset.13

Sources​

Locations refer to the game executable reference; the reference files are identified in the file inventory.

Footnotes​

  1. The reference LEVEL12.INF and LEVEL12.MAZ, read with INF.ksy and MAZ.ksy: sublevel names, steps_until_script 100, script timer target [01:00] with interval 3, monster graphics slot guardian, monster types 0 and 1, the 27 initial monster records (slots, modes, fixed_item 79 and 77) and the cell bindings. Item names and positions come from the reference ITEM.DAT. ↩ ↩2 ↩3

  2. Reachability decoding of the reference LEVEL12.INF with script_decoder.py and the layouts of the virtual machine reference; wall references from LEVEL12.MAZ and the level's wall mappings. The placement checks are those of the monster spawn routine. ↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7 ↩8 ↩9 ↩10 ↩11 ↩12 ↩13

  3. The decoded script at offsets 670–1350 and the decoded subroutine patterns of SCRIPT_TOGGLE; the script timer loader and the script timers routine. The cycle was checked by running the script's wall writes and tests on the map's initial walls. ↩

  4. The decoded scripts at offsets 11–33, 2054–2228 and 2229–2403; wall references 47, 48 and 67 of LEVEL12.MAZ; the reference ITEM.DAT records 77, 78, 396, 397 and 398 (Crystal Key, Shell Key, ring of value 3) and the item type of lock picks (record 6, type 28). ↩

  5. The decoded scripts at offsets 2737–2968; text 71 and 72 of the reference TEXT.DAT, summarized. Monster flags are set by the set flags handler. ↩

  6. The two launches of the [05:21] script and the corner scripts at offsets 3381–3396, run in a processor emulator through the launch handler, the flying-object mover and the block event dispatcher, one step per timed update of 3 ticks. ↩

  7. The decoded scripts at offsets 117–168, 4291–4384 and 4385–4504; ITEM.DAT records 84 and 395 (type 50, value 5, empty name entries) and the reference ITEMTYPE.DAT entry 50 (ITEMTYPE_DAT.ksy). ↩

  8. The decoded scripts at offsets 222–619 and 4505–4707; texts 74 and 111 of the reference TEXT.DAT, summarized; ITEM.DAT record 407 and ITEMTYPE.DAT entry 44. The global flags are the global script flags: the executable's only direct tests of them read bits 4 and 31, and scripts read them through the expression evaluator. ↩

  9. The party status check, the global flags and the defeat scene. ↩

  10. The decoded script at offsets 4708–4960; text 75 of the reference TEXT.DAT, summarized; ITEM.DAT record 79 and the initial monster record of slot 25. ↩

  11. The decoded scripts at offsets 34–116, 169–221 and 4961–5778; the walls of LEVEL12.MAZ around [18:17]. The flight of an item is described under throwing and launching items, and the move of flying objects with a block's items under moving items. A throw with each row plate pressed was run through the game's own routines in a processor emulator: the item lands on the plate at the fifth step and presses it. ↩

  12. The monster graphics slot and monster type entries of the reference LEVEL12.INF (INF.ksy), copied into the monster type properties by the type loader. ↩

  13. The bytes f3 ff 02 06 00 04 05 03 f0 at offsets 2–10 of the reference script area and the block event dispatcher, the single entry into the script loop. ↩