Skip to main content

Level 3: reference tables

Level 3 · The levels · Level data (INF)

In brief​

The details of level 3: 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 two sublevel records. Both use the maze LEVEL3.MAZ, the dung graphics and the sound file CATACOMB.ADL or CATACOMB.SND (sound-effect table), and neither has a script timer:1

This page covers every reachable script of the reference file: 81 cell bindings, 83 script entry points including two shared subroutines, and 586 instructions. The decoding finds no unknown operand layout; 19 bytes in eight places follow a level load and are never executed. Message colors are palette colors (Print a message).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).
  • Script offsets count from the start of the INF script_data field (decoded payload offset 1259 in the reference file). Message numbers index the level's 32 strings; they are summarized, not quoted.
  • Speakers are chosen as on the level 4 page.
  • Level flags are bits of this level's flag word (SCRIPT_FLAG_TARGET_LEVEL); their names below are descriptive.
  • Wall references above 24 take the meaning of the current record's wall mappings; the two records map some of them differently, and each area uses only references that its own record maps.1

Stairs​

Six stair blocks share the pattern of the level 5 stairs: entering in the required direction prints "going up" (message 29) or "going down" (31), plays sound 79 and changes place; entering in any other direction prints message 30, plays sound 29 and moves the party back one block. Items placed or thrown into a stair block go to the destination.2

StairsRequired directionDestinationPushed back to
[25:02]3Level 2, sublevel 0, [23:03], facing 3[26:02]
[29:04]0Level 2, sublevel 0, [29:03], facing 0[29:05]
[08:01]3Level 3, sublevel 1, [05:01], facing 3[09:01]
[06:01]1Level 3, sublevel 0, [09:01], facing 1[05:01]
[29:07]2[29:10] on this level, facing 2[29:06]
[29:09]0[29:06] on this level, facing 0[29:10]

[08:01] and [06:01] are two blocks apart, with solid rock between them: the "stairs" between the two areas reload level 3 with the other sublevel record. The last two pairs of stairs move the party within the level without a level change.

No turning back​

A plaque on the west face of [28:02] warns that there is no turning back (message 4). [27:02], north of the door [27:03], resets a floor switch in [27:05] each time the party enters it: level flag 1 is cleared and [27:05] gets wall reference 65 on all sides. Entering [27:05] while flag 1 is clear trips the switch: flag 1 is set, the walls become reference 66, sound 12 plays at [27:04] and SCRIPT_CLOSE_DOOR closes [27:03]. The door's north face is a door with a switch (reference 7) and its south face a door without one (reference 12). Closing moves each face through its own group, to 3 on the north and 8 on the south, a door that cannot be forced (scripted doors), so from the south the party finds no switch to open it again.2

The script then tests flag 1 again before choosing one of three remarks — by a thief that a switch has been tripped (message 5), that the door is closing (6) or that the door to the north is closing (7). Because the script has just set the flag, this second test always fails and none of the three remarks is ever shown.

The turning blocks​

Four blocks turn the party: entering [21:05], [19:07], [17:05] or [19:03] while the south face of [22:04] holds reference 27 runs SCRIPT_CHANGE_DIRECTION, which turns the party one quarter to the right. That face is a lever (INF_WALL_SPECIAL_LEVER_INCREMENT, InfWallSpecialType): pulling it changes the reference to 28 before its script plays sound 7, and the blocks stop turning the party; pulling it back to 27 starts them again.2

Remarks and false walls​

Several blocks make a party member comment, once each, with sound 79:2

  • [13:05], an illusory wall (wall reference 46, WALL_REFERENCE_ILLUSION of SpecialWallReference): with a probability of one in three, a remark that it is an illusion and that there are probably more (message 8, level flag 2). The roll is 1d3 + 1 == 2.
  • Claw marks. Entering [06:04] facing 1, a remark on the marks (message 9, flag 3); entering [10:07] facing 0 with a CHARACTER_CLASS_FIGHTER (CharacterClassMask), a remark on a powerful beast (message 18, flag 5). Activating the marked faces of [06:05] and [10:06] (reference 63) describes deep scratches (message 10).
  • [03:09] and [03:15], in the ant nest: that nobody has been there for a long time (message 16, flag 4) and that the place is creepy (message 17, flag 15).
  • [18:26]: with a probability of one in five (1d5 + 1 < 3), while flag 6 is clear and the south face of [18:25] is nonzero, a CHARACTER_CLASS_THIEF notes a secret panel on the north wall (message 22, flag 6). That face is the lever that opens [18:25].
  • [17:30]: the test asks for facing 3 and a roll of 1d3 + 1 equal to 1, which is never true: the roll is at least 2, so the mage's remark that the wall here is false (message 23, flag 7) never appears. The wall west of [17:30], [16:30], is indeed an illusion (reference 46).3

Levers and doors​

  • Hidden walls. The levers on the south face of [18:25], the west face of [25:30], the south face of [30:22] and the east face of [10:22] (reference 42, a lever) play sound 13 and set all four walls of their block to 0, opening it.
  • Lever doors. The lever on the west face of [14:09] toggles the door [13:10] with SCRIPT_TOGGLE_DOOR; the one on the west face of [17:13] toggles [12:12]. The levers of [21:25] (east face) and [27:25] (west face) play sound 7, then open the doors [22:24] and [26:24] respectively when the lever's face holds reference 28, and close them when it holds 27.
  • [19:15]: entering it once (level flag 10) closes the door [20:15].2

Locks​

Seven keyholes take a key held by the player; their scripts run when the player activates the keyhole. Six of them open a door:4

  1. If the door is not closed — the face of the door block that the script reads is not reference 8 or 18 — message 15 says it is already unlocked, whatever the player holds.
  2. A key (ITEM_TYPE_KEY) of the right value plays sound 14, opens the door with SCRIPT_OPEN_DOOR and removes the key (SCRIPT_DELETE_ITEM).
  3. Another key: message 11 (it does not fit), sound 81.
  4. Lock picks (item type 28): with a CHARACTER_CLASS_THIEF in the party, sound 81 and message 12 (the pick fails); otherwise message 13 (a thief is needed). The pick always fails on this level.
  5. Anything else: message 14 (a key is needed).
KeyholeDoorKey valueKey (ITEM.DAT)
[10:00], south face[09:01]6Spider Key
[20:22], east face[20:23]6Spider Key
[25:24], north face[24:24]6Spider Key
[28:12], east face[29:11]6Spider Key
[29:16], east face[30:15]4Dark Moon Key
[29:19], east face[30:18]4Dark Moon Key

The door [09:01] stands between the arrival area and the stairs down to the ant nest.

The seventh keyhole, on the west face of [30:05], takes the Grey Key (value 1). It has no door: the right key turns the face into a niche (wall reference 45, INF_WALL_SPECIAL_NICHE) with SCRIPT_SET_BLOCK_SIDE, where four scrolls lie. The other answers are those of steps 3 to 5. The Grey Key is the one that the gargoyle at [30:20] leaves when it dies.4

The gargoyle treasure​

[12:11], a pressure plate (reference 35), opens the door [12:12] with sound 12 the first time the party enters it; it then becomes reference 36 for good, and later entries only report that the plate is stuck (message 19).2

Nearby, [13:14] holds a long sword, bracers and a shield. Taking any item from it (BLOCK_EVENT_ITEM_REMOVED) closes the door [12:12], plays sound 13 and sets the walls of the two rock blocks [14:13] and [14:15] to 0: the five gargoyles at [15:12]–[15:15] and [16:13] can then reach the party. The script runs only while level flag 8 is clear, but no script of the level sets that flag, so the trap runs again at each removal, closing the door each time; the lever of [17:13] reopens it.

The plate room​

Nine pressure plates fill the room [23:26]–[25:28], south of which is the door [24:29]. Each plate is down (reference 36) while the party or at least one item stands on it, and up (35) otherwise. Its script presses it, with sound 12, when the party enters a plate with no item on it, or when the first item is put on it while the party is elsewhere; it releases it when the party leaves a plate with no item, or when the last item is taken from it while the party is elsewhere. Items in flight are not counted. The bindings also enable the monster events, but the scripts ignore them: monsters never press the plates. Neither state of a plate blocks anything: the first record gives references 35 and 36 no interaction type and the flags INF_WALL_PASSAGE and INF_WALL_SMALL_PROJECTILE_PASSAGE (InfWallMappingFlags), so the party, monsters and flying objects all pass.5

After each change, the subroutine at offset 2 reads eight plates and opens the door [24:29] when they form this pattern, closing it otherwise:

Row[23:YY][24:YY][25:YY]
26downupdown
27updownup
28downeitherdown

The plate [24:28], in front of the door, is not tested. A plaque on the north face of [23:29], seen from [23:28], says that many things must be left behind (message 28).

The portal​

The east face of [16:23] is a portal (wall reference 54, INF_WALL_SPECIAL_SCRIPT). Activating it while holding an item of type 37 plays the portal animation (SCRIPT_RUN_SEQUENCE with SCRIPT_SEQUENCE_PORTAL), then the item's value selects the destination; the item is kept. Any other item, or none, does nothing.6

ValueDestination
1Level 6, sublevel 0, [05:14], facing 1
2Level 14, sublevel 0, [14:14], facing 0
3None: the script returns
4Level 16, sublevel 0, [16:16], facing 0
5None: the script returns

The script tests value 1 twice: the second test, which would reload level 3 at [17:23], is never reached, since the first one already takes every key of value 1. The Stone Gem of value 1 lies in a niche at [12:21] on this level. Values 3 and 5 belong to template items that the game never copies, so the portal is always followed by a level change in play (see portal without a level change). A party arriving by a portal from level 6 or 14 lands at [17:23], facing 1.

The ant nest​

The nest is the west part of the map, entered by the stairs [08:01] and left by [06:01]; there, record 1 is current and its monsters are ants.7

  • [03:06]: every time the party enters it, a monster of type 0 is placed at [00:04], position 4, facing 1, if that block holds no monster (SCRIPT_SPAWN_MONSTER); in the nest this is an ant.
  • [04:06]: entering it asks for a monster of type 1 at [04:06] itself. The party's block is stored before the entry event is sent, and the placement refuses the party's block, so this script never places anything.8
  • Holes. The holes on the south faces of [00:02] and [01:18] (reference 62) call the subroutine at offset 87, which shows four messages in turn, recorded by level flags 11 and 12: a draft from the hole (0), the hole is very dark (1), something stirs inside (2), the party cannot fit (3, with sound 79); then it starts again. The two holes share the cycle.
  • Tar. [00:04] and [01:20] (reference 64 on all sides) make a remark about a black, tar-like substance once each (message 27, level flags 13 and 14). [00:04] holds bones, a rock and a Spider Key; [01:20] armour, a long sword, a potion and the item named "west wind", one of the four winds of the level 5 seal.

Wandering monsters​

The step-triggered script of [00:00] runs at every 61st move while record 0 is current and at every 29th while record 1 is. It asks for eight monsters, all at position 4 with mode MONSTER_MODE_PURSUE (MonsterMode): type 0 at [00:03], [01:19], [04:17] and [10:14] facing 2, at [23:05] facing 1 and at [28:22] facing 3, and type 1 (bank 1) at [19:28] and [30:20] facing 3. With occupancy class 2, each placement succeeds only on a block that holds no monster and is not the party's.8

The same script runs with both records, so its monsters take the current record's types: four of the blocks are in the nest and four in the east. Placed while the party is in the east, the nest's four are cubes, which the party will meet as ants; placed while the party is in the nest, the east's type-0 monsters are ants that the party will meet as cubes. Record 1 loads no image into bank 1, but the two monsters it places there stand in the east, out of sight until record 0, which loads the gargoyle image, is current again (inferred).7

Decorations​

Activating these faces shows a message:2

  • drainage holes (reference 68) on [07:05], [19:04], [19:06], [18:05], [20:05], [27:01], [27:10], [18:11] and [27:11]: signs of erosion (message 24);
  • grates in the nest (reference 67) on [00:01], [05:10] and [05:12]: little used (message 25);
  • broken jars in the nest (reference 61) at [05:09], [06:10], [06:12], [00:13], [02:17], [03:18] and [05:18]: once a container (message 26).

Resting​

Resting on this level never rests: the game shows a dream sequence instead. This is done by the game's rest command, not by a script; see whether the party can rest.

Bindings​

Blocks whose flags are zero receive only the events that need no enabling bit: the step event ([00:00]) and BLOCK_EVENT_WALL_DECORATION. Rows that list several blocks give their scripts in the same order.1

PositionEnabled eventsScriptPurpose
[00:00]none (BLOCK_EVENT_STEP_COUNT)163Wandering monsters
[25:02], [29:04]BLOCK_EVENT_PARTY_ENTER, BLOCK_EVENT_ITEM_PLACED, BLOCK_EVENT_FLYING_OBJECT3152, 3533Stairs, up to level 2
[08:01], [06:01]BLOCK_EVENT_PARTY_ENTER, BLOCK_EVENT_ITEM_PLACED, BLOCK_EVENT_FLYING_OBJECT3279, 3406Stairs, down to the ant nest and back
[29:07], [29:09]BLOCK_EVENT_PARTY_ENTER, BLOCK_EVENT_ITEM_PLACED, BLOCK_EVENT_FLYING_OBJECT3660, 3788Stairs, inside the level
[28:02]none (BLOCK_EVENT_WALL_DECORATION)284No turning back, plaque
[27:02]BLOCK_EVENT_PARTY_ENTER290No turning back, reset
[27:05]BLOCK_EVENT_PARTY_ENTER299No turning back, floor switch
[22:04]none (BLOCK_EVENT_WALL_DECORATION)387The turning blocks, lever
[21:05], [19:07], [17:05], [19:03]BLOCK_EVENT_PARTY_ENTER392, 408, 424, 440The turning blocks
[13:05]BLOCK_EVENT_PARTY_ENTER456Remarks, illusion
[06:04], [10:07]BLOCK_EVENT_PARTY_ENTER488, 739Remarks, claw marks
[06:05], [10:06]none (BLOCK_EVENT_WALL_DECORATION)517, 778Remarks, claw marks
[03:09], [03:15]BLOCK_EVENT_PARTY_ENTER673, 696Remarks
[18:26], [17:30]BLOCK_EVENT_PARTY_ENTER2356, 2424Remarks, secret walls
[18:25], [25:30], [30:22], [10:22]none (BLOCK_EVENT_WALL_DECORATION)2414, 2472, 2482, 2970Levers, hidden walls
[14:09], [17:13]none (BLOCK_EVENT_WALL_DECORATION)788, 889Levers, doors
[21:25], [27:25]none (BLOCK_EVENT_WALL_DECORATION)1278, 1304Levers, doors
[10:00], [20:22], [25:24], [28:12]none (BLOCK_EVENT_WALL_DECORATION)527, 894, 1152, 2744Locks, Spider Key
[29:16], [29:19]none (BLOCK_EVENT_WALL_DECORATION)2492, 2618Locks, Dark Moon Key
[30:05]none (BLOCK_EVENT_WALL_DECORATION)2870Locks, locked niche
[19:15]BLOCK_EVENT_PARTY_ENTER1130Levers, a door that closes
[24:22]none1147Scripts that do not run
[12:11]BLOCK_EVENT_PARTY_ENTER793The gargoyle treasure, plate
[13:14]BLOCK_EVENT_ITEM_REMOVED826The gargoyle treasure
[23:26], [24:26], [25:26], [23:27], [24:27], [25:27], [23:28], [24:28], [25:28]BLOCK_EVENT_PARTY_ENTER, BLOCK_EVENT_PARTY_LEAVE, BLOCK_EVENT_ITEM_PLACED, BLOCK_EVENT_ITEM_REMOVED, BLOCK_EVENT_MONSTER_ENTER, BLOCK_EVENT_MONSTER_EXIT1330, 1444, 1558, 1672, 1786, 1900, 2014, 2128, 2242The plate room
[23:29]none (BLOCK_EVENT_WALL_DECORATION)3146The plate room, plaque
[16:23]none (BLOCK_EVENT_WALL_DECORATION)1020The portal
[03:06], [04:06]BLOCK_EVENT_PARTY_ENTER657, 723The ant nest, ants
[00:02], [01:18]none (BLOCK_EVENT_WALL_DECORATION)653, 719The ant nest, holes
[00:04], [01:20]BLOCK_EVENT_PARTY_ENTER3100, 3123The ant nest, tar
[11:13]none854Scripts that do not run
[07:05], [19:04], [19:06], [18:05], [20:05], [27:01], [27:10], [18:11], [27:11]none (BLOCK_EVENT_WALL_DECORATION)2980, 2986, 2992, 2998, 3004, 3010, 3016, 3022, 3028Decorations, drainage holes
[00:01], [05:10], [05:12]none (BLOCK_EVENT_WALL_DECORATION)3034, 3040, 3046Decorations, grates
[05:09], [05:13], [06:10], [06:12], [00:13], [02:17], [03:18], [05:18]none (BLOCK_EVENT_WALL_DECORATION)3052, 3058, 3064, 3070, 3076, 3082, 3088, 3094Decorations, jars

Two subroutines are reached only by SCRIPT_CALL: the plate-room test at offset 2 and the hole messages at offset 87.

Level flags​

BitSet byCleared byMeaning (descriptive)
1[27:05][27:02]The floor switch has been tripped.
2[13:05]—The illusion remark has been made.
3[06:04]—The claw-marks remark has been made.
4[03:09]—The "nobody for a long time" remark has been made.
5[10:07]—The fighter's remark on the marks has been made.
6[18:26]—The secret-panel remark has been made.
7(never)—Would record the false-wall remark of [17:30].
8(never)—Tested by [13:14]; no script sets it.
10[19:15]—The door [20:15] has been closed.
11, 12The hole messagesThe hole messagesPosition in the cycle of the hole messages.
13, 14[00:04], [01:20]—The tar remarks have been made.
15[03:15]—The "creepy" remark has been made.

No script of the level reads or writes a global flag.

Monster types​

The game stores no name for a monster type; the types are known by their record, number, image and properties. Every type of the level has occupancy class 2, so a block holds at most one of these monsters (sharing a block); none has a ranged attack, a decoration or an immunity other than the one shown. Turn resistance is −1 and evasion 0 for all.9

Property (INF field)Record 0, type 0 (cube)Record 0, type 1 (gargoyle)Record 1, type 0 (ant)Record 1, type 1 (ant)
Armour class (armor_class)8233
Hit chance (hit_chance)15151414
Level for saving throws (level)4623
Hit points (hit_points_dice)4d86d82d83d8
Melee attacks: count and damage1: 2d83: 2d8, 2d8, 1d61: 1d61: 1d7 + 1
MonsterCapabilityFlagsMONSTER_CAP_LARGE, MONSTER_CAP_ALT_FRAME_TABLE, MONSTER_CAP_PARALYZES, MONSTER_CAP_ITEM_LOSS, MONSTER_CAP_BIT_10_UNKNOWN, MONSTER_CAP_ATTACKS_ANY_SIDEMONSTER_CAP_ALT_FRAME_TABLEMONSTER_CAP_ALT_FRAME_TABLE, MONSTER_CAP_POISONSMONSTER_CAP_ALT_FRAME_TABLE, MONSTER_CAP_POISONS
MonsterImmunityFlagsnoneMONSTER_IMMUNE_NEEDS_MAGIC_WEAPONnonenone
Type flags (type_flags)Hold Monster can affect itHold Monster can affect itHold Monster can affect itHold Monster can affect it
Experience (experience)97597535175
Attack and step sounds (sound_1, sound_2)45, −147, 4649, 3849, 48

The type numbers are shared by the two records: a monster keeps its type and image numbers when the record changes, so it takes the look and the properties of the type with the same number in the new record, and keeps the hit points rolled when it was placed (see sublevels); the 20 gargoyles, of the second image bank, have no image while record 1 is current. The level loads record 0 first, whatever the arrival, so its 26 initial monsters are placed as record-0 types. Four of them stand in the ant nest — type 0 at [02:13], [07:10], [07:20] and [10:14] — and appear as ants of record 1 when the party gets there. The other 22 are in the east: type 0 at [13:09] and [24:12], and 20 gargoyles of type 1, among them five at [15:12]–[15:15] and [16:13]. The monster at [13:09] always leaves a copy of the Spider Key when it dies, and a skull one time in ten; the gargoyle at [30:20] always leaves a Grey Key.9

Scripts that do not run​

Three bindings have flags 0 on blocks that no event reaches:10

  • [11:13] (offset 854), a rock block whose faces are plain walls: an elf or half-elf would say that food used to be stored here (message 20), otherwise nobody could read the writing (21). No face of the block has an interaction type, so no activation reaches it.
  • [05:13] (offset 3058), a jar message on a block with no wall.
  • [24:22] (offset 1147), a door with a switch: the script toggles the door. The switch is handled by the door-switch interaction of the built-in door references, which operates the door itself and sends no event to the block's script.

Monsters do not change this. Each monster on a block adds one to its state word, and only a count of 8 would carry into the event flags, but a move is refused on a block holding four (inferred from these rules for the blocks a monster can enter), and no initial monster or script places a monster on these blocks.

Sources​

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

Footnotes​

  1. The reference LEVEL3.INF and LEVEL3.MAZ, read with INF.ksy and MAZ.ksy: the two sublevel records (names, door records, steps_until_script 60 and 28, monster graphics slots, monster types, wall mappings, empty timer lists), the initial monster records and the cell bindings. The event meanings follow BlockEventMask and LevelBlockStateFlags. ↩ ↩2 ↩3

  2. Reachability decoding of the reference LEVEL3.INF with script_decoder.py and the instruction layouts of the virtual machine reference; wall references from LEVEL3.MAZ and the records' wall mappings. ↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7 ↩8

  3. The dice roll returns values from 1 to the number of sides, plus the bonus; the instruction at offset 2424 encodes one die of 3 sides with a bonus of 1. ↩

  4. The decoded scripts at offsets 527–652, 894–1019, 1152–1277 and 2492–2969; the key and lock-pick items of the reference ITEM.DAT (type 38, values 1, 4 and 6; type 28) and the items lying in the niche of [30:05]. ↩ ↩2

  5. The decoded scripts at offsets 2–86 and 1330–2355, with SCRIPT_EXPR_BLOCK_ITEM_TYPE_COUNT and SCRIPT_EXPR_EVENT_MASK of the condition tokens. ↩

  6. The decoded script at offsets 1020–1129, the portal animation and the type-37 items of the reference ITEM.DAT. ↩

  7. A reachability analysis of LEVEL3.MAZ from every arrival position, with each record's wall mappings, counting every door and every wall that a script of the level writes as passable, for the party and, with the monster-passage property, for monsters. The record change follows sublevels: the INF loader releases the monster shapes of both banks before reading the record's images. ↩ ↩2

  8. The monster spawn routine and move the party, which stores the party's block before it sends BLOCK_EVENT_PARTY_ENTER; see moving the party. ↩ ↩2

  9. The monster graphics slots and monster type entries of both records of the reference LEVEL3.INF (INF.ksy), copied into the monster type properties by the type loader; the initial monsters are placed by the initial monster reader. Item templates 17, 32 and 38 of the reference ITEM.DAT; the death drops follow kill a monster. ↩ ↩2

  10. The record runner calls the interaction selected by the wall special types, which give the built-in door references 3–7 and 13–17 the door-switch type; that interaction calls the door toggle. The decoration and script interactions that send BLOCK_EVENT_WALL_DECORATION are the wall-click dispatchers. ↩