Speed running Monkey Island

Jun 02, 2023

I recently did an interview about speed running Monkey Island (I'll post a link when it's available).

One of the topics was how speed runners dislike random events and the end of Monkey Island 2 has a lot of randomness around when LeChuck appears. I was asked how this worked and to be honest that was a long time ago and I don't remember every little scrap of code. It is also possible that I didn't write it. But what I do have is the SCUMM source code for Monkey Island 2 and I tracked down the code.

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
    }
}

There are some other random conditions about what item you picked up last, etc, but this is the core of it.

P.S. If you're wondering my SCUMM uses - in variable names, it's because it started out as a variant of LISP.

P.P.S. It's also worth noting that this is for the original MI2, The special editions and SCUMMVM might have changed how this works.