Monster routines
Routines · Data · Address index
How monsters move, notice the party, attack, cast spells, take damage, appear and die, and how undead are turned. The routines page explains how the entries are written.
0x19974 — Move toward a destination
- Range:
0x19974–0x19b48; faulty "no direction" test at0x199cf - Role: Arguments: a monster and its destination. Increments the
step-order counter and, every eleven calls of any
monster, switches between the two step orders
(
0x1997c–0x1998e); then takes the direction to the destination. WithMONSTER_RUNTIME_AVOID_CLOSER_BLOCK(0x199da), it decrementsstate_counter(+0x0b) at each call and, while the counter stays positive, reverses the direction (xor 4); at zero or below it clears the counter and the flag (0x199e1–0x199fe). An orthogonally adjacent destination, found through the direction offsets, only turns the monster toward it (0x19a23–0x19a42); a diagonally adjacent one tries the side step of the monster's facing (0x19a45–0x19ab9), which a type withMONSTER_CAP_SIDESTEP_SOMETIMEStakes only when 1d4 < 4 (0x19a78–0x19a98). Otherwise it turns the start direction one step toward the destination (0x19abc–0x19ae1) and tries the straight directions in step order (0x19ae5–0x19b41), each through the move check. The "no direction" test at0x199cfcompares the direction with0xffff, while the direction routine returns0x00fffor two equal blocks: a monster standing on its destination does not stop but reads the direction offsets atDS:0x302a+ 255 and, when fleeing, the side steps atDS:0x3032+0x1f4to0x1f7(DS:0x3226–0x3229), past the end of both tables. - Comparative source: REF-SCUMM-020,
walkMonster. - Used by: Monsters › How a monster acts, Noticing the party › Losing the party, Moving toward the destination › One step, Modes and provocation › What a monster's state changes, Monster capabilities › Where it is used, Monster slot › Layout, Monster state flags › Avoiding the party, Level data (INF), Anomalies and bugs
0x19bac — Wake peaceful monsters
- Range:
0x19bac–0x19c19 - Anomaly:
ANOMALY-147: the far pointer[bp-0x8]to the last monster woken is written only when a slot in mode 8 is woken (0x19bd5–0x19bde) and is read after the loop with no test (les bxat0x19beband0x19c00), so it is uninitialized when no slot is in that mode. Both callers test the monster's own mode first (0x1a0e9,0x1ac10), so the case is not reached. - Role: For every monster slot in
MONSTER_MODE_PEACEFUL, setsMONSTER_MODE_PURSUE(0x19bc9) and the party's block as destination (0x19bd1); then sets a global flag bit according to the type of the last monster woken. Called by the provocation check and by kill a monster. - Comparative source: REF-SCUMM-008,
REF-SCUMM-020,
turnFriendlyMonstersHostile. - Used by: Modes and provocation › Changing mode, Modes and provocation › Reacting to damage, Noticing the party › Where the destination comes from, Monster state flags › Provoked monsters, Modes and provocation, Anomalies and bugs
0x19c1a — Notice the party
- Range:
0x19c1a–0x19cac; the loop over the 30 monster slots is at0x19cad. - Role: Checks one monster's distance and direction
to the party and, when the conditions hold, sets its mode to
MONSTER_MODE_PURSUEand its destination to the party's block. The slot loop runs when the party moves. - Comparative source: REF-SCUMM-008,
updateMonsterDest. - Used by: Monster behavior modes › How each mode behaves, Modes and provocation › Changing mode, Noticing the party › The check, Noticing the party › Where the destination comes from
0x19cdc, 0x19da7 — Positions within an occupied block
- Ranges:
0x19cdc–0x19da6(occupied-position mask),0x19da7–0x19e59(position for an entering monster); faulty class-1 lookup at0x19df0 - Status: reading the occupancy class as monster size is inferred from comparison.
- Role: The mask routine refuses a block holding four monsters (−2) or
an occupant of another occupancy class (−1; byte
+0x1eof the type properties). It moves a centre occupant withoutMONSTER_RUNTIME_TURNED_TO_STONEto a corner, even an occupied one: position 0 for class 1, otherwise the corner table entry of its direction (0x19d3a–0x19d7d); it returns the mask of occupied positions. The search for an entering monster refuses class 2, which never enters an occupied block (0x19dc5). Class 1, which shares a block in pairs on the diagonal positions 0 and 3, takes its position from the class-1 table by mask (mask 9 refused), and the monster placed takes the direction stored atDS:0x92a6(0x19e01). Class 0, up to four per block, takes the first free position in the search order of its facing (0x19e0d–0x19e4f). The class-1 lookup at0x19df0indexes the table with the whole mask, 0 to 31, so masks of 12 or more read the close-attack tables that follow it. - Comparative source: REF-SCUMM-008,
REF-SCUMM-020,
getNextMonsterPosandfindFreeMonsterPos. - Used by: Obstacles and other monsters › Sharing a block, Monster slot › Layout, Level data (INF), Anomalies and bugs
0x19e5a — Place a monster on a block
- Range:
0x19e5a–0x19ef4 - Role: Updates a monster's block and direction, updates block occupancy,
and dispatches block events (see
BlockEventMask). A block of0xffffkeeps the current block and a direction of −1 keeps the current direction. The new block's whole state word is incremented (0x19ebf), so the three-bit occupancy count carries into the event bits from the eighth monster. The script move handler passes each moved monster's position byte (+0x04) as the direction (0x25fa9–0x25fb6). - Used by: Block events › Who sends each event, Block state flags, The engine › How the systems connect, How the systems affect one another › Scripts started by scripts, Level block › In brief, Obstacles and other monsters › Sharing a block, When a monster dies › In what order, Monster slot › From the INF record to the slot, Monster slot › In brief, Move the party, monsters or items › Moving monsters, Place a monster › Initializing the monster, Events that start scripts › Monsters entering and leaving blocks, Scripted movement, monsters and items › Moving the party, monsters and items, Values passed on to other routines › The routines, Level data (INF), Anomalies and bugs
0x19ef5 — Check a candidate move
- Range:
0x19ef5–0x1a0d4; turn on the spot0x19f19–0x19f25; avoidance and party block0x19f28–0x19f62; face lookup0x19f65–0x19f9f; door branch0x19fa4–0x1a026, with the wall-72 replacement at0x19fdc–0x19ffeand the open request at0x1a001; occupancy0x1a02e–0x1a05e; placement and step sound0x1a062–0x1a0cc. - Role: Arguments: a monster, a destination block and a direction.
Accepts or rejects a monster's move into a neighboring block. A block of
−1 or the monster's own block only turns it. Otherwise it refuses, in
order: with
MONSTER_RUNTIME_AVOID_CLOSER_BLOCK, a block closer to the party; the party block; and a destination whose face turned toward the monster lacksWALL_RUNTIME_MONSTER_PASSAGE(bit0x04of the wall properties), unless the type hasMONSTER_CAP_OPENS_DOORSand the face's decoration selector is0xff. In that door branch, a face withWALL_RUNTIME_DOOR_CLOSED_ENDPOINT(bit0x20) gets an open request (0x1a001), which forwards to the door step; for a monster of type index 1 whose type hasMONSTER_CAP_WALL_SPECIAL_TYPE_1, the destination's two faces on that axis are set to wall reference 72 instead (0x19fdc–0x19ffe). The monster then turns and the routine returns success without moving or sound. Occupied blocks go through the position search, then placement; the step sound of the type (+0x20) plays through0x2a314unless the resting flag is set. The routine has no adjacency test: a direction of −1 becomes the monster's facing (0x19f75–0x19f83), the face read is that direction xor 2 on the candidate block (0x19f86–0x19f91), and acceptance places the monster there (0x1a06d). - Comparative source: REF-SCUMM-008,
REF-SCUMM-020,
walkMonsterNextStep. - Used by: Monster behavior modes › How each mode behaves, Obstacles and other monsters › The move check, Modes and provocation › What a monster's state changes, Monster capabilities › Where it is used, Monster state flags › Avoiding the party, Wall properties › Where each bit is tested, Sound effects, Moving toward the destination, Level data (INF), Level 6: reference tables › The guarded stairs
0x1a0d5 — React to provocation
- Range:
0x1a0d5–0x1a102 - Role: For a monster with
MONSTER_RUNTIME_PROVOKED, setsMONSTER_MODE_PURSUEand records the party's block, except inMONSTER_MODE_PARALYZED; inMONSTER_MODE_PEACEFUL, calls wake peaceful monsters instead. Called by the update loop only for a mode above 0 (0x1a8e9); it does not clearMONSTER_RUNTIME_PROVOKED, which no routine clears. - Comparative source: REF-SCUMM-008,
REF-SCUMM-020,
updateMonsterAttackMode. - Used by: Modes and provocation › Changing mode, Modes and provocation › Reacting to damage, Modes and provocation › What a monster's state changes, Noticing the party › Where the destination comes from, Monster state flags › Provoked monsters
0x1a107 — Move within its block
- Range:
0x1a107–0x1a167 - Role: Called by the close-range action when the position check finds the monster in the wrong half of its block. Alone in its block, the monster moves to position 4, the centre; otherwise it takes the position the position search gives for its own block, if any, so a class-2 monster sharing a block never moves. The block is redrawn only when a position was stored.
- Comparative source: REF-SCUMM-020,
updateMonsterTryCloseAttack. - Used by: Melee attacks › The attack sequence, Obstacles and other monsters › Sharing a block, Melee attacks › What stops an attack
0x1a168 — Close-range action
- Range:
0x1a168–0x1a2cb - Role: Called by the pursuit decision. Returns 0 unless the
block in front of the monster (
+0x02,+0x05) is the party block (0x1a18c). When the position check fails, moves the monster within its block and returns 1. Otherwise togglesMONSTER_RUNTIME_MELEE_ALTERNATE(bit0x04of+0x16,0x1a1af) and returns 1 without attacking when the bit ends clear; when the monster's block is visible block 13 (0x1a1be), plays the attack animation; then calls the target choice (0x1a281) and returns 1. Nowhere in0x1a168–0x1a2cbdoes it test the face between the monster's block and the party's, which the move check tests for a move. - Comparative source: REF-SCUMM-018,
REF-SCUMM-020,
updateMonsterTryCloseAttack. - Used by: Melee attacks › Attack timing, Monsters › How a monster acts, Noticing the party › Losing the party, Melee attacks › The attack sequence, Obstacles and other monsters › Sharing a block, Modes and provocation › What a monster's state changes, Melee attacks › What stops an attack, Monster capabilities › Where it is used, Monster slot › Layout, Monster state flags › Alternating melee attacks, Monster state flags › Turned to stone, Formation › Who a monster attacks, The game clock › Pauses, Sound effects, Level data (INF), Anomalies and bugs
0x1ac1f — Attack position check
- Range:
0x1ac1f–0x1ac5e - Role: Returns 1 when the monster's position (
+0x04) is 4, the centre of its block, or when its type's occupancy class (byte0x1eof the type properties) is 1; otherwise the byte of the position table for its direction and position, which is 1 for the two positions in the half of the block the monster faces. - Comparative source: REF-SCUMM-018,
updateMonsterTryCloseAttack(_monsterCloseAttChkTable1). - Used by: Melee attacks › The attack sequence, Obstacles and other monsters › Sharing a block, Melee attacks › What stops an attack, Formation › Who a monster attacks
0x1aead — Target choice of a close attack
- Range:
0x1aead–0x1afb1 - Role: Argument: a monster. Takes a group from the
close-attack tables by party direction and monster
direction, and one of its two six-slot orders: the second when the
half selector of the monster's direction and position is nonzero (
0x1af12–0x1af18), or on a 1d2 − 1 roll for position 4. For each slot in order: skips a character failing the eligibility test with mask 3 (0x1af3a); skips a character withspell_effects0x140on a 1d20 of 5 or more (0x1af50–0x1af74); otherwise attacks it (0x1af83) and stops unless the type's capability word has0x4000(0x1af97–0x1afa1). - Comparative source: REF-SCUMM-018,
monsterCloseAttack. - Used by: Character eligibility tests › Masks used by character actions, Lasting spell effects, Lasting spells › What lasting effects do, Monster capabilities › Where it is used, Conditions › Conditions, Formation › Who a monster attacks, Level data (INF)
0x1a333 — Ranged action
- Range:
0x1a333–0x1a5a2; wait counter0x1a35c–0x1a381; distance and facing0x1a384–0x1a3c1; block-by-block trace0x1a3cf–0x1a420, with the party-block exit at0x1a412–0x1a420; weapon choice0x1a422–0x1a48a; mind blast0x1a535–0x1a582. - Role: Called by the pursuit decision (
0x1a63d). Returns 0 whenranged_attacks_left(+0x19) is 0 (0x1a350), or when a 1d3 roll exceedsranged_wait(+0x1c), which it then increments. Requires the party within distance 3 and its eight-way direction equal to twice the facing. The trace follows the facing block by block; a block entered before the party's stops it when its face turned back toward the monster has neither bit0x01nor0x02of the wall properties, or when it is occupied. Each block is compared with the party's block before its face is tested (0x1a412–0x1a420), so the face of the party's own block is never tested. The weapon index follows the type's weapon list mode (+0x22): mode 1 cyclesranged_weapon_index(+0x18) through the weapon count (+0x23), mode 2 rolls 1d (count) − 1, and any other mode uses a local variable that nothing sets (0x1a48a). The weapon byte (type+0x24+ index) selects the action: negative, a copy of item −byte is launched, and when no flying object is free the copy's location becomes −1; 0 to 19, a monster spell of that magic object type; 20, a mind blast (sound0x67, messageDS:0x3146, then afflict slots 0 to 5 withCHARACTER_STATUS_PARALYZED, saving-throw category 1, 5 units, event 9); above 20, nothing. It then decrementsranged_attacks_leftunless it is 255 (0x1a584–0x1a58e), clearsranged_waitand returns 1. - Comparative source: REF-SCUMM-008,
REF-SCUMM-020,
updateMonsterTryDistanceAttack. - Used by: Melee attacks › Attack timing, Monsters › How a monster acts, Noticing the party › Losing the party, Melee attacks › The attack sequence, Ranged attacks › When a monster fires, Obstacles and other monsters › Sharing a block, Melee attacks › What stops an attack, Monster slot › Layout, Wall properties › Where each bit is tested, Sound effects, Level data (INF), Anomalies and bugs
0x1a2cc — Monster spell
- Range:
0x1a2cc–0x1a323 - Role: Arguments: a monster and a magic object type. Called by the
ranged action for weapon bytes 0 to 19.
Creates a magic flying object of that type for no caster (−1)
at the monster's block, position and facing, then plays, at the monster's
block, the sound (
+0x12) of the spell definition that the type names in the magic flight properties. - Comparative source: REF-SCUMM-021,
monsterSpellCast. - Used by: Ranged attacks › When a monster fires, Sound effects, Spell definition
0x1a5a3 — Pursuit decision
- Range:
0x1a5a3–0x1a6a2; the switch to wandering is at0x1a60b–0x1a634, the call to the ranged action at0x1a63d. - Role: Behavior of
MONSTER_MODE_PURSUE(first entry of the mode table): calls the ranged action, the close-range action and movement in that order. The block ahead is the neighbor in the monster's facing or, for a type withMONSTER_CAP_ATTACKS_ANY_SIDEand the party in a straight direction, the neighbor toward the party (0x1a5d2–0x1a5f7); it is passed to the close-range action. When that block is the destination and the party is not there, the monster switches to a wander mode, 5 + (1d2 − 1) (0x1a61a–0x1a630).attack_frame(+0x0a) is cleared before the movement call (0x1a65c). - Comparative source: REF-SCUMM-020,
updateMoveMonster. - Used by: Monster behavior modes › How each mode behaves, Melee attacks › Attack timing, Modes and provocation › Changing mode, Monsters › How a monster acts, Noticing the party › Losing the party, Melee attacks › The attack sequence, Obstacles and other monsters › Sharing a block, Melee attacks › What stops an attack, Monster capabilities › Where it is used, Monster slot › Layout, Level data (INF)
0x1a6a3 — Patrol modes
- Range:
0x1a6a3–0x1a705 - Role: Handler for the three patrol modes. Tries a move forward through the move check; when it is refused, adds the mode's turn amount to the direction and calls the move check with no block, which only turns the monster.
- Comparative source: REF-SCUMM-020,
updateMonsterFollowPath. - Used by: Monster behavior modes › How each mode behaves, Directions
0x1a706 — Wander modes
- Range:
0x1a706–0x1a822 - Role: Movement for
MONSTER_MODE_WANDER_LEFTandMONSTER_MODE_WANDER_RIGHT; the turn direction comes from the mode turn amounts. The side test readsWALL_RUNTIME_MONSTER_PASSAGEof the neighbor's face turned toward the monster, through the view sides (0x1a746–0x1a77a); it tests only that bit and leaves the party, occupancy and doors to the later move check. - Comparative source: REF-SCUMM-008,
REF-SCUMM-020,
updateMonstersStraying. - Used by: Monster behavior modes › How each mode behaves, Monster slot › Layout, Wall properties › Where each bit is tested
0x1a823 — Timed inactivity
- Range:
0x1a823–0x1a844 - Role: For
MONSTER_MODE_DELAYEDandMONSTER_MODE_PARALYZED, decrements the slot's counter and switches toMONSTER_MODE_PURSUEwhen it reaches zero. A monster in either mode whose counter is already zero never changes mode (0x1a829). - Comparative source: REF-SCUMM-008,
REF-SCUMM-020,
updateMonstersSpellStatus. - Used by: Monster behavior modes › How each mode behaves, Modes and provocation › Changing mode
0x1a845 — Turn a block's monsters
- Range:
0x1a845–0x1a88b - Role: Arguments: a block and a direction. Gives the direction to
every monster slot on the block whose direction differs, without a
hit-point test; each slot turned gets
skip_update(+0x1b) = 1 (0x1a877), so the monster update skips it once. The update calls it with the block and direction of every slot whose type has occupancy class 1 (0x1a987–0x1a9ad). - Comparative source: REF-SCUMM-020,
setBlockMonsterDirection. - Used by: Monsters › How a monster acts, Obstacles and other monsters › Sharing a block, Monster slot › Layout
0x1a88c — Monster update and mode dispatch
- Range:
0x1a88c–0x1a9c7; mode table at0x1a9c8. - Role: Iterates over the 30 slots. For a slot of the requested update
group, it skips the slot when its hit points (
+0x0e) are not positive (0x1a8b3), when it hasMONSTER_RUNTIME_TURNED_TO_STONE(0x1a8bd), or whenskip_update(+0x1b) is set, which it clears (0x1a8ca–0x1a8d6). Otherwise it runs the notice check, then, for a mode above 0, the provocation check (0x1a8e9), and dispatches on the mode through the table (0x1a900–0x1a90e): modes 4, 8 and 9 have no routine, and values above 10 or negative skip the dispatch. Unless the mode is then 4, 7 or 8, it toggleswalk_frame(+0x06,0x1a96a–0x1a982). For every slot, including those of other groups (0x1a8aejumps to0x1a987), it calls turn a block's monsters when the type's occupancy class is 1. The loop ends with a call to the flying-object pass (0x1a9bd). Groups 0–3 are run by entries 2–5 of the timed-callback table through0x28218. - Comparative source: REF-SCUMM-008,
REF-SCUMM-020,
updateMonsters. - Used by: Monster behavior modes › How each mode behaves, Monster behavior modes, Monsters › How a monster acts, Noticing the party › The check, Modes and provocation › What a monster's state changes, Monster slot › Layout, Monster state flags › Alternating melee attacks, Monster state flags › Turned to stone, Timed updates › Monster update cadence, How the systems affect one another, Move the party, monsters or items
0x1a9de — Flash a damaged monster
- Range:
0x1a9de–0x1aa41 - Role: Called by damage a monster at
0x20619when the monster's block is visible and damage is not deferred. It stops the shared counter (0x1a9e5), draws the view once with the flash countdown at 0 (0x1aa05–0x1aa15), clearsMONSTER_RUNTIME_REVEALED(0x1aa1f), sets the countdown to 1 tick, restarts the counter (0x1aa34) and requests a redraw. The scene redraw loops at0x3f753–0x3f75auntil the countdown is 0 before it copies the new view to the screen (0x3f7ac), so the flash stays on screen for that tick. The same wait applies to the 8 ticks set by the close-range action. - Comparative source: REF-SCUMM-022,
flashMonsterShape. - Used by: The game clock › Pauses, Monsters in the view › Drawing a monster
0x1aa42 — Finish deferred damage
- Range:
0x1aa42–0x1aabd - Role: Redraws the scene, clears
MONSTER_RUNTIME_REVEALEDof every slot that has it (0x1aa6b), kills, with experience, the monsters left with no hit points, and clears the deferred-damage flag (0x1aab2). - Comparative source: REF-SCUMM-020,
updateAllMonsterShapes(_preventMonsterFlash). - Used by: Noticing the party › Where the destination comes from
0x1aabe — Kill a monster
- Range:
0x1aabe–0x1ac1e - Role: Sets hit points to −1, drops copies of the slot's fixed item and,
one time in ten, of its random item into its block, awards the type's
experience when asked, then places the monster on block 0 and
wakes peaceful monsters if it was peaceful. On level 16,
sublevel 1, a type with
MONSTER_CAP_WALL_SPECIAL_TYPE_1instead turns type 0 into type 1 with 150 hit points (0x1abc0–0x1abd4: hit points 150,ranged_weapon_index0,ranged_attacks_left255,graphics_indexand type plus one), or, for any other type, ends the game: overlay 256 entry 4, writeFINAL.SAV(0x1abde), entry 1,0x50416, the ending (0x1abe3), then the exit (0x1abe8–0x1abf0). These are the only calls into overlay 256. Both level-16 branches follow the item drops and the experience; neither moves the monster or wakes others, and the second form keeps the first form's maximum hit points (+0x0c). - Comparative source: REF-SCUMM-014,
killMonsterandDarkMoonEngine::killMonsterExtra. - Used by: Loading, failures and the end of the game › The end of the game, The game loop › How the game ends, Block events › Who sends each event, Modes and provocation › Changing mode, When a monster dies › In what order, Monster capabilities › Where it is used, Place a monster › Behavior, Saving and restoring, Level data (INF), Level 3: reference tables, Level 16: reference tables › The final fight and the end of the game
0x1ad07, 0x1ad24 — Monster attack
- Ranges:
0x1ad07–0x1aeac: attack loop0x1ad24–0x1ad96, with the faulty argument pushed at0x1ad30; effects0x1ad98–0x1aea4 - Role: Arguments: a character slot and a monster; the
target choice calls it for each character it attacks.
Repeats a hit roll as many times as the type's attack count (
+0x06) and, for each hit, adds the dice of attack i (type+0x07+ 3 × i) to a total. The hit roll receives the attack number as its character slot: the loop pushes its counter (%si) at0x1ad30, so attack i is rolled against the defense and spell effects of the character in slot i, not of the target. With a positive total, a type withMONSTER_CAP_ITEM_LOSSmakes the target lose an item when 1d4 − 1 ≠ 3 (0x1ada1–0x1adca); the total is dealt through0x209fcwith no saving throw (0x1add6–0x1addc); thenMONSTER_CAP_POISONS(0x1aded),MONSTER_CAP_PARALYZES(0x1ae3c) andMONSTER_CAP_PETRIFIES(0x1ae78) afflict the target withCHARACTER_STATUS_POISONED,CHARACTER_STATUS_PARALYZEDandCHARACTER_STATUS_PETRIFIED: saving-throw categories 0, 2 and 2, durations 1, 5 and 0, timer events 8, 9 and 0. The poison call is followed by an unconditional clear ofspell_effectsbit0x2000(0x1ae27). - Comparative source: REF-SCUMM-008;
REF-SCUMM-021,
monsterCloseAttack. - Used by: Lasting spell effects, Melee attacks › The attack sequence, Monster capabilities › Where it is used, Level data (INF), Anomalies and bugs
0x1afb2 — Initialize a monster slot
- Range:
0x1afb2–0x1b0c3; hit points are computed at0x1b073–0x1b094. - Role: Clears a 30-byte monster slot, fills it from level or spawn data
and the monster type, then places it on its block. Level loading
reaches it from overlay code at physical file offsets
0x48ccb–0x48d32. Besides its operands, it writesranged_wait(+0x1c, a 1d3 roll,0x1b009–0x1b01d),ranged_attacks_left(+0x19, from type+0x21),ranged_weapon_index(+0x18) = 0,slot_mod_3(+0x1a) = the slot index modulo 3 andsublevel(+0x1d) = the current sublevel, for level monsters and spawned ones alike; a block of 0 leaves the slot cleared (0x1aff6). - Comparative source: REF-SCUMM-007,
loadActiveMonsterData; REF-SCUMM-020,initMonster. - Used by: Level data (INF) › What it becomes in memory, Monster behavior modes › How each mode behaves, Modes and provocation › Changing mode, Ranged attacks › When a monster fires, Noticing the party › Where the destination comes from, Monster slot › From the INF record to the slot, Monster slot › In brief, Monster slot › Other initialized fields, Place a monster › Initializing the monster, Scripted movement, monsters and items › Monsters, Values passed on to other routines › The routines, Bestiary, Level 6: reference tables, Level 8: reference tables
0x1b0ee — Spawn a monster
- Range:
0x1b0ee–0x1b241 - Role: Places a new monster on a block. It refuses a block whose
occupancy is full and the party's block, checks that the new monster can
share an occupied block, then takes the first slot with no hit points or,
failing that, the living monster farthest from the party (distance) among those without
MONSTER_RUNTIME_KEEP_SLOT(0x1b1b8), which it kills without experience (0x1b1f9–0x1b210). It then initializes the slot. - Comparative source: REF-SCUMM-020,
DarkMoonEngine::replaceMonster. - Used by: Modes and provocation › Changing mode, Monster slot › Other initialized fields, Monster state flags › Placed by the level, Place a monster › Sublevels and eviction, Place a monster › Choosing the slot, Place a monster › When nothing happens, Scripted movement, monsters and items › Monsters, Level 4: reference tables › Where they appear, Values passed on to other routines › The routines, Bestiary, Level 2: reference tables, Level 7: reference tables, Level 12: reference tables, Anomalies and bugs, Level 1: reference tables › Level data, Level 3: reference tables › The ant nest, Level 6: reference tables › Level data, Level 8: reference tables › Level data, Level 9: reference tables › Level data, Level 11: reference tables › Level data, Level 13: reference tables › Level data
0x1bb1e — Turn-undead threshold
- Range:
0x1bb1e–0x1bb3e - Role: (level, resistance) → the signed byte of the
turn-undead table at 14 × resistance + min(level, 14)
(
0x1bb25–0x1bb37), with no lower bound. A level of 14 or more reads the first byte of the next row, past the 14 entries of the row (ANOMALY-131). - Used by: Attack spells, Anomalies and bugs
0x1ec1f, 0x24b56 — Turn undead
- Range:
0x1ec1f–0x1ecb5for one monster;0x24b56is its caller. - Callers:
0x24b56is the start routine of definition 62, Turn undead; it examines at most five monsters of the list (0x24c41). - Role:
0x24b56takes the block in front of the party and stops if no monster occupies it. It rolls one twenty-sided die with the dice roll. Then, for each monster there whose type has type flag0x0004and which was not tried before, it marks the monster as tried (state bit0x10) and calls0x1ec1fwith the roll and a level.0x1ec1freads the threshold for the type's turn resistance and that level, the cleric or paladin level (0x24bad). A threshold of −1 calls the monster damage routine0x20808with 500 points, damage flag0x200, no saving throw and no experience. A roll below the threshold (0x1ec50) does nothing. Otherwise the monster switches toMONSTER_MODE_PURSUEwithMONSTER_RUNTIME_AVOID_CLOSER_BLOCKand a counter of 40, and turns to face away from the party. - Comparative source: REF-SCUMM-013,
spellCallback_start_turnUndeadandturnUndeadHit. - Used by: Modes and provocation › Changing mode, Modes and provocation › What a monster's state changes, Monster state flags › Avoiding the party, Sound effects, Attack spells, Level data (INF)
0x2059d — Damage a monster
- Range:
0x2059d–0x20661 - Role: Subtracts damage from the monster's hit points, sets
MONSTER_RUNTIME_PROVOKEDand clearsMONSTER_RUNTIME_AVOID_CLOSER_BLOCK. A type withMONSTER_CAP_DIES_ON_HITdrops to 0 hit points at once. A monster left with no hit points goes to kill a monster, passing on the experience flag of its third argument; a surviving monster within distance 3 of the party records the party's block as destination (0x2065c). When the monster's block is visible, it setsMONSTER_RUNTIME_REVEALED(0x20607); with the deferred-damage flag set it then returns at once (0x2060c–0x20611): no kill and no destination, the kill being left to finish deferred damage. - Comparative source: REF-SCUMM-008,
REF-SCUMM-020,
inflictMonsterDamage. - Used by: Modes and provocation › Reacting to damage, Modes and provocation › What a monster's state changes, When a monster dies › In what order, Noticing the party › Where the destination comes from, Monster capabilities › Where it is used, Monster state flags › Avoiding the party, Monster state flags › Provoked monsters, Level data (INF)
0x20da4 — Monster explosion
- Range:
0x20da4–0x20e25 - Role: Argument: a monster. Called by
damage a monster at
0x205d1for a type withMONSTER_CAP_DIES_ON_HIT, before its hit points become 0. SetsMONSTER_RUNTIME_REVEALED. When the distance from the party's block is below 2 (0x20dc0), it calls the explosion routine0x22d19for the party's block and deals each slot 0–5 damage(slot, 6, 6, 0, 8, 1, 0): 6d6, saving-throw category 1, halved on a save (0x20ddf–0x20dfe); otherwise it calls0x22d19for the monster's block. Clears the flag at0x20e1e. - Comparative source: REF-SCUMM-008,
inflictMonsterDamage. - Used by: When a monster dies › In what order, Saving-throw categories › Other uses of the categories, Modes and provocation, Attack spells, Level data (INF), Monster immunities, Monster behavior modes, Monster state flags
0x20c4b, 0x19b49 — Spell effects on a monster
-
Range:
0x20c4b–0x20d95, with a seven-entry jump table at0x20d96.0x20d20is the paralysis branch.0x19b49is called by effect 6. -
Callers: the spell routines: Hold Person and Hold Monster (effects 0 and 1), Power Word Stun (2), Finger of Death and Slay Living (3), Disintegrate (4), Flesh to Stone (5) and Fear (6); the fourth argument is the saving-throw category, 5 never saving.
-
Role: Applies one of seven effects, numbered 0 to 6, to a monster. When asked, it first tries an evasion: if that succeeds, or if the type's immunity flags have bit
0x0010, it returns −1. Then a successful saving throw returns 0. The conditions below test the type's immunity flags and type flags:Effect Condition Effect on the monster 0, 1, 2 type flag 0x0001(0) or0x0002(1); immunity not0x0002MONSTER_MODE_PARALYZEDwith a counter of 15 (at0x20d20).3 immunity not 0x00081000 points of damage. 4 none 1000 points of damage. 5 none Sets state bit 0x20and the state-change flag.6 immunity not 0x00040x19b49: unless the monster is delayed, peaceful or paralyzed,MONSTER_MODE_PURSUEwithMONSTER_RUNTIME_AVOID_CLOSER_BLOCK, a counter of 20 and one move attempt away from the party.Effect 2 has no type-flag condition. Each applied effect returns 1.
-
Comparative source: REF-SCUMM-013,
magicObjectStatusHitandspellCallback_start_fear.