Changing level
The world · Sublevels ·
Level records and level changes ·
SCRIPT_LOAD_LEVEL_OR_MONSTERS
In brief
The game loads a level when a new game starts, when a saved game is loaded, and when a script asks for it. No wall, block flag or timer changes level by itself: stairs, pits and portals are all scripts. Before leaving a level, the game settles it and stores its walls, monsters and temporary walls in its level record; when the party comes back, that record replaces the map and the initial monsters.
Positions are written [XX:YY], column then row, both counted from 00; the
block index is YY × 32 + XX.
When the game loads a level
The game loads a level in four situations:1
| Situation | Level loaded | Party position |
|---|---|---|
| A new party has been created, or an EOB I party transferred | Level 4, sublevel 0 | [11:05], facing south |
| A saved game is loaded from the start-up screen | The saved level and sublevel | The saved block and facing |
| A saved game is loaded during play | The saved level and sublevel | The saved block and facing |
A script runs SCRIPT_LOAD_LEVEL_OR_MONSTERS | The level and sublevel it names | Its block, and its facing or the current one |
The first two are decided when the game starts, by a selector that the start-up screen sets: zero after a party is created or transferred, nonzero after a saved game has been read. A load from the start-up screen restores the saved game but leaves the level to the start of the game; a load during play loads the level at once. No wall, block flag or timer changes level by itself: stairs, pits and portals are all scripts.
Level changes in the original levels
The scripts of the original levels contain 143 level-change instructions. They fall into a few kinds, each with its own trigger; the figure of the world shows which levels they connect.2
| Kind | Instructions | What triggers it | Where the party arrives |
|---|---|---|---|
| Stairs, ladders, forest exits | 50 | The party steps into the block facing the stairs (48). Facing another way, it gets a message and is moved back. Items dropped or thrown into the block are sent to the arrival block. The two exits of the forest ask the player to confirm instead. | A fixed block and facing. |
| Pits | 73 | The party steps into an open pit (32), or a pit opens under it (41): moving pits driven by a timer on levels 11, 12 and 14, a lever on level 1, a trap during a conversation on level 13. Every fall but that trap deals 2d6 damage first. | The current facing, in most cases at the same position below. |
| Portals | 12 | On levels 3, 6 and 14, the player activates the portal wall while holding a portal key; the key's value chooses the destination. | A fixed block and facing. |
| Teleporters to the other sublevel | 2 | On level 11, the party steps into the block. | A fixed block and facing. |
| Switch in place | 3 | On level 8, the party enters [12:14] the first time: a door closes, monsters move, and the level's second sublevel is loaded. | The same block, facing south. |
| Scenes | 3 | A conversation on level 9, a scripted move on level 6, a wall puzzle on level 15. | A fixed block; the facing is kept on level 15. |
Four stairs, two on level 1 and two on level 6, also run the game's
password check the first time
one of them is taken on that level. The fall damage carries
SCRIPT_DAMAGE_RING_NEGATES: a character
wearing a ring of value 3 takes none.
Returning to a level
The game keeps a record of each level the party has left in LEVELS.TMP:
the level's walls, its monsters and its temporary walls. On a level change
it first lets flying objects land and doors finish, then writes the current
level's record and loads the new level. If the new level has a record, the
map loader restores its walls, monsters and temporary walls from it instead
of using the map and the level's initial monsters. The items lying in each
block are rebuilt from the shared item table, and the level's scripts, cell
bindings and timed events are read again from its INF file.
Level records and level changes gives the full
order and what each kind of state becomes.3
Sources
Locations refer to the game executable reference; comparative sources are listed in the technical references.