LeChuck random appearance algorithm

Ron Gilbert posted the SCUMM source code for the algorithm that controls the random appearance of LeChuck at the end of the game.
lechuck-appearance-chance is 4
lechuck-appearance-interval is 300
times-lechucks-appeared-recently += 1
foo = (3 - times-lechucks-appeared-recently)
foo = (random foo)
if (!foo) {     ; after he's popped up a couple times he's likely to disappear for a while
    times-lechucks-appeared-recently = 0
    lechuck-appearance-chance is 10 ; that is, 1 in 10
    lechuck-appearance-interval is 500
}
if (magic-doll) {   ; speed him way up after you make the doll
    if (owner-of needle is selected-actor) {    ; and have the needle
    lechuck-appearance-chance is 2
    lechuck-appearance-interval is 120
    }
}
Ron adds:
There are some other random conditions about what item you picked up last, etc, but this is the core of it.

GameResources/DOS/MonkeyIsland2 last edited by Sand on 6/2/2023 4:37 PM
Page History Latest diff List referrers View Source