Back to Page
Revision 1 (current)
Edited by Sand on 6/2/2023 4:37 PM
!!! LeChuck random appearance algorithm
Ron Gilbert posted
[https://www.grumpygamer.com/speed_running_mi|the SCUMM source code]
for the algorithm that controls
the random appearance of LeChuck
at the end of the game.
%%SRC_EMBED scumm
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
}
}
%%END_EMBED
Ron adds:
%%QUOTE
There are some other random conditions about what item you picked up last, etc, but this is the core of it.
%%QUOTE_END