1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264
|
-- cave4 - "Cave south of Oracle's tower and west of Denorian village"
--
function autoexec()
copy_tile_all(39, 92, 21, 46, 5, 8)
refresh()
end
function entity_handler(en)
if (en == 0) then
LOC_talk_demnas(en)
elseif (en == 1) then
-- You have not spoken to Corin about the troll
if (get_progress(109) == 0) then
if (get_progress(55) < 4) then
-- You have not yet faced the troll down the stairs
bubble(en, "Oh, $0, it's great to see you!")
bubble(en, "I traced the missing statue here to Demnas, but before I could confront him, a horde of Malkaron's followers attacked him.")
bubble(200, "Malkaron's minions have been here?")
bubble(en, "Yes, and during the battle, the statue was broken in half and Malkaron's men took off with it.")
bubble(en, "Demnas was so enraged that when he found me, he locked me in this room with this troll.")
bubble(200, "A troll? So there really IS a troll? How did you defeat it?")
bubble(en, "I haven't. I hit it with a sleep spell as soon as I was locked in here.")
set_ent_facing(en, 3)
bubble(en, "It's down the stairs right there. Why don't you go take care of it now?")
set_progress(109, 1)
else
-- You have defeated the troll
bubble(en, "$0! I saw you run down the stairs there before I could tell you about the troll!")
bubble(200, "Yea, the troll was asleep, but it wasn't much of a problem to beat.")
bubble(en, "My, my. So modest.")
if (get_numchrs() == 1) then
bubble(200, "Well, what can I say? I'm just that good!")
else
bubble(201, "Well, what can we say? We're just that good!")
end
bubble(en, "If that's so, then let me join your party!")
LOC_join_corin(en)
end
-- Corin told you about the troll
elseif (get_progress(109) == 1) then
-- You have not fought the troll yet
if (get_progress(55) < 4) then
bubble(en, "I'll wait up here. I'm not ready to take on a troll just yet.")
-- You fought the troll
else
bubble(en, "Good work! Let me join your team!")
LOC_join_corin(en)
end
else
bubble(en, "Hi, $0. Let me join your team!")
LOC_join_corin(en)
end
refresh()
elseif (en == 2) then
-- Statue will not talk, but Demnas attacks if you try to grab it
en = 0
bubble(en, "Not so fast!")
set_ent_facing(200, 0)
LOC_talk_demnas(en)
end
end
function postexec()
return
end
function refresh()
showch("treasure1", 62)
showch("treasure2", 63)
showch("treasure3", 64)
showch("treasure4", 65)
showch("treasure5", 66)
if (get_progress(57) > 0) then
set_ent_active(0, 0)
end
if (get_progress(70) == 2) then
set_zone("door4", 2)
set_obs("door4", 0)
end
if (not LOC_manor_or_party(2)) then
-- Make the NPC look like Corin if he has not been recruited yet
set_ent_id(1, 2)
else
-- Otherwise, remove him from the screen
set_ent_active(1, 0)
end
if (get_progress(55) > 2) then
set_ent_active(2, 0)
end
end
function zone_handler(zn)
if (zn == 0) then
combat(10)
elseif (zn == 1) then
change_map("main", "cave4")
elseif (zn == 2) then
LOC_doors_in("door1")
LOC_doors_in("door2")
LOC_doors_in("door3")
LOC_doors_in("door4")
LOC_doors_in("door5")
LOC_doors_in("door6")
LOC_doors_in("door7")
LOC_doors_in("door8")
elseif (zn == 3) then
LOC_doors_out("door1")
LOC_doors_out("door2")
LOC_doors_out("door3")
LOC_doors_out("door4")
LOC_doors_out("door5")
LOC_doors_out("door6")
LOC_doors_out("door7")
LOC_doors_out("door8")
elseif (zn == 4) then
if (get_progress(70) == 0) then
bubble(200, "Locked.")
elseif (get_progress(70) == 1) then
bubble(200, "What luck! The key from that crazy Demnas guy unlocks this door!")
set_progress(70, 2)
refresh()
end
elseif (zn == 5) then
bubble(200, "Aw... it's full of normal junk.")
elseif (zn == 6) then
chest(62, 95, 1)
refresh()
elseif (zn == 7) then
chest(63, 165, 1)
refresh()
elseif (zn == 8) then
chest(64, 106, 1)
refresh()
elseif (zn == 9) then
chest(65, 117, 2)
refresh()
elseif (zn == 10) then
chest(66, 68, 1)
refresh()
elseif (zn == 11) then
--
copy_tile_all(45, 92, 21, 46, 5, 8)
warp("ustairs", 8)
--
elseif (zn == 12) then
autoexec()
warp("dstairs", 8)
elseif (zn == 13) then
if (get_progress(55) < 4) then
bubble(200, "The Denorians were right. There really WAS a troll. Looks like it's already dead, though.")
msg("The troll suddenly lunges at you... it was only asleep!", 0, 0)
set_run(0)
msg("TODO: There needs to be a combat here...", 0, 0)
set_run(1)
bubble(200, "If this troll really DID steal the statue from the Denorians, it was probably being directed by that scumbag Demnas.")
bubble(200, "He used this poor bugger and then left him here to rot.")
wait(100)
bubble(200, "Well, I should go back to the village now and report all this.")
set_progress(55, 4)
else
bubble(200, "This cell is now his tomb.")
end
elseif (zn == 14) then
-- Nothing: no random battles here
elseif (zn == 15) then
if (get_progress(55) > 2) then
msg("The statue is no longer here.", 58, 0)
else
bubble(200, "This statue of the Oracle appears to be broken in half!")
end
end
end
-- Show the status of a chest
function showch(which_marker, which_chest)
-- Set tiles if -1 passed in as 'which_chest' or if chest already opened
if (which_chest < 0 or get_treasure(which_chest) == 1) then
set_btile(which_marker, 256)
set_zone(which_marker, 0)
end
end
function LOC_doors_in(which_marker)
sfx(26)
set_foreground(0)
set_btile(which_marker, 240)
set_mtile(which_marker, 251)
end
function LOC_doors_out(which_marker)
sfx(26)
set_btile(which_marker, 250)
set_mtile(which_marker, 0)
set_foreground(1)
end
function LOC_join_corin(en)
local id
--
set_all_equip(2, 2, 38, 50, 56, 74, 0)
id = select_team{2}
--
add_to_manor(id)
if (id[1]) then
set_ent_id(en, id[1])
set_ent_speed(en, 4)
if (id[2]) then
-- Two heroes were de-selected
set_ent_id(0, id[2])
set_ent_active(0, 1)
set_ent_speed(0, 4)
if (get_ent_tiley(200) > get_ent_tiley(1)) then
-- Hero is below Corin
set_ent_tilex(0, get_ent_tilex(en) + 1)
set_ent_tiley(0, get_ent_tiley(en))
else
-- Hero is anywhere else
set_ent_tilex(0, get_ent_tilex(en))
set_ent_tiley(0, get_ent_tiley(en) + 1)
end
bubble(en, "If you need us, we'll be back at the manor.")
set_ent_movemode(0, 2)
set_ent_movemode(en, 2)
move_entity(0, 37, 73, 1)
move_entity(en, 37, 73, 1)
wait_for_entity(0, en)
else
-- One hero was de-selected
bubble(en, "If you need me, I'll be back at the manor.")
set_ent_movemode(en, 2)
move_entity(en, 37, 73, 1)
wait_for_entity(en, en)
end
end
set_progress(100, get_progress(100) + 1)
end
function LOC_talk_demnas(en)
bubble(en, "So you're back trying to steal the other half of the statue from me, are you?")
bubble(200, "Huh? Have we met before?")
bubble(en, "Filthy swine! You cannot have this statue!")
bubble(200, "Does this mean you're the one responsible for the disappearance of the statue from a village near here?")
bubble(en, "Uh... Are... Are you accusing me of stealing this statue?!")
bubble(200, "Well, the thief was traced back to this cave.")
bubble(en, "Oh, so now I'm a thief?!!")
bubble(200, "That depends... did you take the statue or not?")
bubble(en, "What if I did?")
bubble(200, "Well, then you will give it back... or it will be taken by force!")
bubble(en, "That has been tried before already. You prove to be as stupid as you look.")
bubble(en, "Now I, Demnas, will destroy you!")
drawmap()
screen_dump()
set_run(0)
combat(11)
set_run(1)
if (get_alldead() == 1) then
return
end
set_progress(57, 1)
refresh()
drawmap()
screen_dump()
sfx(5)
msg("Bronze key procured", 255, 0)
set_progress(70, 1)
sfx(5)
msg("Broken Denorian Statue procured", 255, 0)
set_progress(55, 3)
refresh()
end
|