Skip to main content

Level 16: reference tables

Level 16 · The levels · Level data (INF)

In brief​

The details of level 16: 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​

This page covers every reachable script of the reference file: 42 cell bindings, 43 script entry points including one shared subroutine, and 237 instructions. The decoding finds no unknown operand layout; 6 bytes in two places follow a level load and are never executed. Two bindings can never run (see windows). Message colors are palette colors (Print a message). Sound numbers select entries of the level's sound file, CRIMSON2.ADL or CRIMSON2.SND (see the sound-effect table).1

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 party facing direction d sees side d + 2 (modulo 4) of the block ahead.
  • Script offsets count from the start of the INF script_data field (decoded payload offset 1089 in the reference file). Message numbers index the level's 11 strings and text numbers TEXT.DAT; both 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.
  • Monster types are numbers whose meaning depends on the sublevel record that is current: type 0 is a mind flayer with the first record and Dran with the second. Each section names the record that applies.
  • Placing a monster goes through the checks of SCRIPT_SPAWN_MONSTER. A placement at the centre of a block (position 4) succeeds only on a block that holds no monster and is not the party's block.

Arrival​

The hole of level 15 loads the first record at [16:08], with the party's facing unchanged. The portals of levels 3, 6 and 14, used with a stone of value 4 (the Stone Cross), would load it at [16:16], facing 0 (portal animation); the cross never reaches them (see the Stone Cross).1

[16:08] is the centre of a closed room. Its only ways out are four blocks three blocks away in each direction, [16:05], [13:08], [19:08] and [16:11], which have WALL_REFERENCE_ILLUSION on all four sides: they look like walls, but the party walks through them, while monsters cannot. Entering any of them calls the subroutine at offset 2, which acts once (level flag 2): it sets the four sides of all four blocks to 0 and places a salamander (type 1) at the centre of the next block outward, facing the arrival: [16:04] facing 2, [12:08] facing 1, [16:12] facing 0 and [20:08] facing 3.

Mind flayers and salamanders​

While the first record is current, two periodic scripts and two traps add monsters to the western part:1

  • Every 71st move ([00:00], the step-triggered script): a salamander at the centre of [13:06] and one at [18:11], facing 2.
  • Every 1 800 ticks ([02:00], a timed block script): a mind flayer (type 0) at the centre of [05:09], [07:11] and [09:11], facing 1.
  • [16:03]. Each time the party enters it while the switch door [16:02] north of it is closed (its side 2 holds reference 3), three salamanders are placed at the centre of [16:01], [15:01] and [17:01], facing 2, and the door opens (SCRIPT_OPEN_DOOR).
  • [08:08]. Each time the party enters it, the switch door [10:08] east of it closes (SCRIPT_CLOSE_DOOR) and sound 12 plays there. The first time (level flag 7), seven mind flayers are placed: at [09:05], [07:05], [05:07], [05:09], [07:11] and twice at [09:11], all at the centre, facing 1. The second placement at [09:11] never succeeds: after the first one the block is occupied, and when the first one is refused the second is refused for the same reason. The ambush therefore adds at most six mind flayers.

Neither timer nor step script exists with the second record, so these placements stop while the party is in the eastern part.

The crystal​

[05:08] holds a crystal: its four faces have reference 56, a decoration with INF_WALL_SPECIAL_DECORATION_SCRIPT (InfWallSpecialType) that the party cannot cross. Activating any face runs the script of [05:08] — the BLOCK_EVENT_PARTY_ENTER bit of its binding can never be used. The script opens the dialogue screen, plays sound 72 and shows message 3, visions of the future, then the four quarters of CRYSTAL, each drawn through the pixel dissolve (SCRIPT_DIALOGUE_BITMAP_TRANSITION) with sound 19 and waits of 30 to 75 ticks, interleaved with message 4, visions of the past, and message 5, that one cannot be sure. A last prompt (message 6) closes the screen. The visions can be watched as often as the party likes.1

The sealed niches​

Two niches face west across the corridor of column 21: side 3 of [22:07], which holds the Amulet of Life, and side 3 of [22:09], which holds the Amulet of Death. Between them, the door [22:08] has no switch (reference 8) and no script opens it but these.1

At the start, magical fields fill both niches: their faces hold references 54 and 57, two decorations that send BLOCK_EVENT_WALL_DECORATION, instead of the niche reference 45. The timer of [01:00] runs about once a second while the first record is current and swaps 54 and 57 on each face whose field is still there, so the fields flicker. Activating a field shows message 9, a magical field filling the niche; the item events enabled on these two blocks reach their scripts only once a niche is open, and then show nothing.

Standing at [21:07] or [21:09] and facing 1, in front of a niche, the party removes its field by casting Dispel Magic: the BLOCK_EVENT_SPELL_CAST event reaches the party's block, and the script tests SCRIPT_EXPR_LAST_CAST_SPELL for the definitions 12 and 44, the mage and cleric spells. The niche's face becomes reference 45, a working niche, and level flag 5 or 6 is set. When the other niche is already open, SCRIPT_OPEN_DOOR opens [22:08].

Any other event at these two blocks — entering them, or casting another spell there — shows, one time in four (1d4 below 2) and only while the party faces 1, message 8, a party member's remark that magic holds the door shut, with sound 79. The remark does not check whether the field is still there.

The dying mage and the Stone Cross​

The first time the party enters [23:08], beyond the door, it is turned to face 2 and the dialogue screen shows the BADMOOD picture with sound 58 and text 119: one of Dran's mages, dying, warns that his master is in a foul mood. The other three quarters of the picture follow, 8 ticks apart. Before the screen closes, a Stone Cross (template 42, type 37 with value 4) is created on quarter 2 of [23:09], south of the party (level flag 1).1

The Stone Cross is the stone of value 4 that the portals of levels 3, 6 and 14 send to [16:16]. It is the only one in the game: no other script creates one, none lies in the levels at the start, no monster leaves one, and a party transferred from Eye of the Beholder I keeps no item of that type. Since no script of this level leads to another level, and only scripts change level during play, the cross never reaches those portals: their branch for value 4 never runs.

Stairs​

The two stairways of the level sit side by side. They follow the pattern of the level 5 stairs, with messages 0 (up) and 2 (down), and change sublevel record with SCRIPT_LOAD_LEVEL_OR_MONSTERS. Items placed or flying into a stairway go to the arrival block.1

StairsRequired directionDestinationPushed back to
[25:08]1Level 16, sublevel 1, [27:08], facing 1[24:08]
[26:08]3Level 16, sublevel 0, [24:08], facing 3[27:08]

A change of sublevel keeps the level's walls and its 30 monster slots (sublevels). Monsters cannot use the stairs: the stair references 23 and 24 lack WALL_RUNTIME_MONSTER_PASSAGE (WallRuntimeFlags), so each monster stays in its part of the map, but its type number is read with the record that is current.

Dran Draggore​

From [27:08], the arrival of the stairs, the door [28:08] leads east. Each time the party enters [29:08], beyond it, the door closes behind it. Seen from [29:08], its face is reference 8, a door without a switch; only its western face, reference 3, has one.1

The corridor beyond turns north to the door block [28:05]. The first time the party enters it, the script of [28:05] runs once (level flag 0):

  1. It clears SCRIPT_FLAG_TARGET_REST_ALLOWED, so the rest routine refuses to let the party rest. No script of the level allows it again.
  2. It places Dran (type 0) at the centre of [28:02], three blocks north, facing 0, away from the party, in MONSTER_MODE_WAIT (MonsterMode). He faces the decorated south face of [28:01] (reference 53).
  3. After a redraw, the dialogue screen shows the four quarters of ALTAR in turn, each with its sound (52 to 55), and texts 112 to 115: Dran, caught in the middle of an incantation, says he expected the party; he had the drow build the first Darkmoon long ago and was injured in the cataclysm that ended it; he used Xanathar during the building of the new one; his skeletal army is ready to ride against Khelben and take Waterdeep, and he attacks. Sound 2 and a wait of 21 ticks follow each of the first three texts.
  4. SCRIPT_MOVE_PARTY_OR_OBJECT moves the monsters of [28:02] — the Dran just placed — to [00:00], and a new Dran is placed at the centre of [28:02], facing 2, towards the party, in MONSTER_MODE_PURSUE. The screen closes.

The first Dran stays alive at [00:00], a block enclosed by solid walls, where the party never meets him (inferred; see living monsters at [00:00]). He stays in MONSTER_MODE_WAIT too: a monster notices the party only within distance 3, and the nearest block the party can reach on this map, [04:04], is at distance 6.

The final fight and the end of the game​

The death of a monster takes a special branch on level 16 while the second record is current, when its type has MONSTER_CAP_WALL_SPECIAL_TYPE_1 — Dran's type and that of his second form (when a monster dies):2

  1. When Dran (type 0) dies, the party receives his type's experience as for any death, but the monster is not removed: it becomes type 1 with 150 hit points, its image moves to the next one (dragon), its ranged attacks restart from the first weapon and never run out, and the game shows the DRANX pictures. It keeps its block and its slot. Its maximum hit points stay Dran's, which matters only to Harm.
  2. The second form fights with three melee attacks that reach every eligible character of the attack order (MONSTER_CAP_ATTACKS_ALL) and its unlimited spell. It does not open a closed switch door: it replaces both faces of the door's block with reference 72, which the second record maps as an open passage with its own decoration (walls and doors).
  3. When the second form (type 1) dies, the game writes FINAL.SAV, plays the ending and returns to DOS: see the end of the game and the ending.

No script of the level takes part in the fight: the branch belongs to the game's monster code, and the level's scripts only place Dran.

Windows​

Twenty-three bindings show message 10, that it is very gloomy outside. In 21 of them the block has one window face (reference 55, a decoration with INF_WALL_SPECIAL_DECORATION_SCRIPT): 14 in the western part and 7 in the eastern part. All show the message unconditionally except [28:01].1

  • [28:01] carries both a window on its west face, seen from [27:01] facing 1, and the decorated face behind Dran on its south face, seen from [28:02] facing 0. Its script shows the message only when the party faces 1, so activating the face behind Dran shows nothing.
  • [22:00] and [22:01] have the same script, but none of their faces has a reference with an interaction type, so no event can reach them and their scripts never run.

Sublevel records​

LEVEL16.INF has two sublevel records. Both use the maze LEVEL15.MAZ, the crimson graphics, the sound name crimson2 and the same door record; the scripts and cell bindings are shared. The map falls into two parts that only the stairs at [25:08] and [26:08] join: the western part, of 150 blocks, and the eastern part, of 48, where Dran waits, each counting its own stairway. The stairs select the record, so the first record is current in the western part and the second in the eastern part.3

FieldRecord 0Record 1
Selected byThe hole of level 15 ([16:08]), the portals ([16:16]), the stairs at [26:08]The stairs at [25:08]
Step threshold (steps_until_script)70: the [00:00] script runs at every 71st move0: no step script
Script timers[01:00] every 18 ticks (interval 1), [02:00] every 1 800 ticks (interval 100), about 99 secondsNone
Monster image of bank 0mindflay (MINDFLAY.CPS)dran (DRAN.CPS)
Monster image of bank 1salamndr (SALAMNDR.CPS)dragon (DRAGON.CPS, with DRAGON.DCR, two groups)
Monster types0 and 1: mind flayer and salamander0 and 1: Dran and his second form
Wall mappings40, 41, 45, 46, 54, 55, 56, 57, 58, 7440, 41, 45, 53, 55, 58, 72, 74

The second record does not map the illusions (46), the crystal (56) or the niche fields (54, 57), but none of these faces is in the eastern part, so the party never sees them while that record is current (unmapped faces). Reference 53 is the decorated face behind Dran's position; reference 72 is the passage that Dran's second form leaves in place of a door.3

The level has no monster at the start; every monster comes from a script. Monsters of update unit 0 are updated every 25 ticks and those of unit 1 every 15 (monster update cadence).3

Bindings​

PositionEnabled eventsScriptPurpose
[01:00]none (BLOCK_EVENT_TIMER)96The sealed niches, field animation
[02:00]none (BLOCK_EVENT_TIMER)180Mind flayers and salamanders
[25:08]BLOCK_EVENT_PARTY_ENTER, BLOCK_EVENT_ITEM_PLACED, BLOCK_EVENT_FLYING_OBJECT226Stairs, up to the second record
[26:08]BLOCK_EVENT_PARTY_ENTER, BLOCK_EVENT_ITEM_PLACED, BLOCK_EVENT_FLYING_OBJECT353Stairs, down to the first record
[05:08]BLOCK_EVENT_PARTY_ENTER480The crystal, activated as a wall
[00:00]none (BLOCK_EVENT_STEP_COUNT)624Mind flayers and salamanders
[28:05]BLOCK_EVENT_PARTY_ENTER655Dran Draggore
[23:08]BLOCK_EVENT_PARTY_ENTER866The dying mage
[08:08]BLOCK_EVENT_PARTY_ENTER1007Mind flayers and salamanders, ambush
[21:07]BLOCK_EVENT_PARTY_ENTER, BLOCK_EVENT_SPELL_CAST1133The sealed niches
[22:07]BLOCK_EVENT_ITEM_REMOVED1215The sealed niches
[21:09]BLOCK_EVENT_PARTY_ENTER, BLOCK_EVENT_SPELL_CAST1242The sealed niches
[22:09]BLOCK_EVENT_ITEM_PLACED, BLOCK_EVENT_ITEM_REMOVED1324The sealed niches
[16:05]BLOCK_EVENT_PARTY_ENTER1351Arrival, illusions
[16:11]BLOCK_EVENT_PARTY_ENTER1355Arrival, illusions
[13:08]BLOCK_EVENT_PARTY_ENTER1359Arrival, illusions
[19:08]BLOCK_EVENT_PARTY_ENTER1363Arrival, illusions
[16:03]BLOCK_EVENT_PARTY_ENTER1367Mind flayers and salamanders, door
[29:08]BLOCK_EVENT_PARTY_ENTER1428Dran Draggore, door
[03:05]none (BLOCK_EVENT_WALL_DECORATION)1432Windows
[03:07]none (BLOCK_EVENT_WALL_DECORATION)1438Windows
[03:09]none (BLOCK_EVENT_WALL_DECORATION)1444Windows
[03:11]none (BLOCK_EVENT_WALL_DECORATION)1450Windows
[05:03]none (BLOCK_EVENT_WALL_DECORATION)1456Windows
[05:13]none (BLOCK_EVENT_WALL_DECORATION)1462Windows
[07:03]none (BLOCK_EVENT_WALL_DECORATION)1468Windows
[07:13]none (BLOCK_EVENT_WALL_DECORATION)1474Windows
[09:03]none (BLOCK_EVENT_WALL_DECORATION)1480Windows
[09:13]none (BLOCK_EVENT_WALL_DECORATION)1486Windows
[11:03]none (BLOCK_EVENT_WALL_DECORATION)1492Windows
[11:13]none (BLOCK_EVENT_WALL_DECORATION)1498Windows
[15:17]none (BLOCK_EVENT_WALL_DECORATION)1504Windows
[17:17]none (BLOCK_EVENT_WALL_DECORATION)1510Windows
[22:00]none (BLOCK_EVENT_WALL_DECORATION)1516Windows, never runs
[22:01]none (BLOCK_EVENT_WALL_DECORATION)1522Windows, never runs
[25:14]none (BLOCK_EVENT_WALL_DECORATION)1528Windows
[28:00]none (BLOCK_EVENT_WALL_DECORATION)1534Windows
[28:13]none (BLOCK_EVENT_WALL_DECORATION)1540Windows
[30:06]none (BLOCK_EVENT_WALL_DECORATION)1546Windows
[30:08]none (BLOCK_EVENT_WALL_DECORATION)1552Windows
[30:10]none (BLOCK_EVENT_WALL_DECORATION)1558Windows
[28:01]none (BLOCK_EVENT_WALL_DECORATION)1564Windows, and the face behind Dran

The subroutine at offset 2, the fall of the illusions, is reached only by the four illusion blocks through SCRIPT_CALL.

Level flags​

BitSet byCleared byMeaning (descriptive)
0[28:05]—Dran has spoken.
1[23:08]—The dying mage's scene has run.
2The illusion subroutine—The illusions around the arrival have fallen.
4The [01:00] timer scriptThe same scriptPhase of the niche-field animation, switched at each run.
5[21:07]—The field of the niche [22:07] has been dispelled.
6[21:09]—The field of the niche [22:09] has been dispelled.
7[08:08]—The mind flayers' ambush has run.

The script of [28:05] also clears SCRIPT_FLAG_TARGET_REST_ALLOWED; see Dran Draggore.

Monster types​

Each record defines two monster types, 0 and 1. A monster of type 0 is drawn with the image of bank 0 and one of type 1 with that of bank 1 in every placement of the level's scripts. The game stores no name for a monster type; the names below come from the images. All four types have turn resistance −1. The scripts place the mind flayers in update unit 0 and every other monster in unit 1.4

Property (INF field)Record 0, type 0 (mindflay)Record 0, type 1 (salamndr)Record 1, type 0 (dran)Record 1, type 1 (dragon)
Armour class (armor_class)52−8−8
Hit chance (hit_chance)512124
Level for saving throws (level)981515
Hit points (hit_points_dice)1d8 + 601d8 + 479393
Melee attacks: count and damage3: 2d20, 0, 03: 2d6 + 1, 1d8 + 1, 41: 1d8 + 13: 1d10, 1d10, 3d30
MonsterImmunityFlagsnoneMONSTER_IMMUNE_NEEDS_MAGIC_WEAPON, MONSTER_IMMUNE_FIREMONSTER_IMMUNE_BIT_0_UNKNOWN, _DEATH, _MAGIC, _ELECTRICITY, _COLD, _FIRE, _NEEDS_PLUS_TWO, _WEAPON_REDUCEDSame as Dran
MonsterCapabilityFlagsMONSTER_CAP_ALT_FRAME_TABLE, _OPENS_DOORSMONSTER_CAP_ALT_FRAME_TABLE, _POST_MOVE_ACTION, _OPENS_DOORSMONSTER_CAP_WALL_SPECIAL_TYPE_1, _SIDESTEP_SOMETIMES, _OPENS_DOORSMONSTER_CAP_ALT_FRAME_TABLE, _WALL_SPECIAL_TYPE_1, _SIDESTEP_SOMETIMES, _OPENS_DOORS, _ATTACKS_ALL
Type flags (type_flags)Hold Monster can affect itHold Monster can affect itnonenone
Experience (experience)8 0002 00011 00012 000
Occupancy class (occupancy_class)1202
Attack and step sounds (sound_1, sound_2)43, 4241, 4045, 4447, 46
Ranged attacksMind blast, without limitnone20: Flame Strike, Lightning Bolt, Hold Person in turnFlying-object type 8, without limit
Evasion (damage_modifier)90000
Decoration groups (decoration_indices)nonenonenone1 and 2

Two dice rows of the mind flayer have no dice and no bonus, so its second and third attacks deal no damage. Damage that carries MONSTER_DAMAGE_MAGIC is cancelled against a mind flayer when 1d100 is below 90 (damage to a monster). Flying-object type 8 of the dragon form is the monster spell of unlimited range that deals 12d10 + 6 to its target, or 4d10 + 6 while the party has SPELL_EFFECT_MYSTIC_DEFENSE. Dran's spells are cast at caster level 9. The hit points of the second form do not come from its dice: it appears only when Dran dies, with 150 hit points (see the final fight).4

Sources​

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

Footnotes​

  1. Reachability decoding of the reference LEVEL16.INF with script_decoder.py and the layouts of the virtual machine reference; wall references from LEVEL15.MAZ and the level's wall mappings. The arrivals come from the decoded scripts of LEVEL15.INF (offset 2362) and of LEVEL3.INF, LEVEL6.INF and LEVEL14.INF (offsets 1110, 2459 and 6446). Texts 112 to 115 and 119 of the reference TEXT.DAT are summarized. Template 42 and the amulets are records 42, 432 and 433 of the reference ITEM.DAT. The rest refusal is the target of the clear flags handler. ↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7 ↩8 ↩9

  2. Kill a monster, with the DRANX sequence, write FINAL.SAV and play the ending. ↩

  3. The reference LEVEL16.INF and LEVEL15.MAZ, read with INF.ksy and MAZ.ksy: both sublevel records (names, door record, steps_until_script 70 and 0, script timers ([01:00], 1) and ([02:00], 100) of the first record, monster graphics slots, wall mappings), the monster timers (unit 0: 25, unit 1: 15), the 30 unused initial monster records and the cell bindings. The two parts of the map come from the walls of LEVEL15.MAZ, counting doors as passable and the stairs as their only link. Records are selected by select a sublevel; WallRuntimeFlags gives the stair references' properties. ↩ ↩2 ↩3

  4. The monster graphics slots and monster type entries of both records of the reference LEVEL16.INF (INF.ksy), copied into the monster type properties by the type loader; the group count of the reference DRAGON.DCR (DCR.ksy); the flying-object types of the magic flight properties. ↩ ↩2