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 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647
|
-- town2 - "Randen"
-- /*
-- {
-- P_BLADE: Whether woman mentioned the Phoenix Blade
-- (0) You have not spoken to her
-- (1) She has now
--
-- P_FIGHTONBRIDGE:
-- (0) Have not visited the bridge, not fought
-- (1)..(3) (not used) See bridge[2].lua for more
-- (4) Defeated monster on bridge, have not slept at Inn
-- (5) Slept at inn; bridge is passable
--
-- P_FOUNDMAYOR:
-- (0) Have not found the mayor
-- (1) Found the mayor, he does not want company
-- (2) Found mayor & used WARPSTONE to return; he awaits your company
-- (3) You have spoken to the mayor
--
-- P_MAYORGUARD1:
-- (0) The first of the mayor's guards is still being held in the orc camp
-- (1) The first guard was released: gives you money
-- (2) The first guard already gave you money for releasing him
--
-- P_MAYORGUARD2:
-- (0) The second of the mayor's guards is still being held in the orc camp
-- (1) The second guard was released
--
-- P_SIDEQUEST1: Whether you finished the 1st sidequest to seal the portal in
-- the tunnel
-- (0) Still letting monsters through, Ajathar doesn't join
-- (1) The Portal is sealed shut, Ajathar joins
--
-- P_SIDEQUEST2: Whether you finished the 2nd sidequest to save the mayor
-- (0) Mayor still missing
-- (1) Mayor found, Casandra joins
--
-- P_SHOWBRIDGE:
-- (0) Bridge is incomplete
-- (1) Monsters on bridge defeated; slept at Inn: bridge is passable
-- (2) Bridge is totally complete, bridge(2).(lua|map) no longer used at all
--
-- P_TALK_AJATHAR:
-- (0) Have not spoken to Ajathar when you entered the map
-- (1) You have spoken to him at least once already
--
-- P_WARPSTONE: The teleporter from Ajantara <-> Randen
-- (0) Have not used it yet
-- (1) Stepped on the warp stone and created its counterpart in Randen
-- }
-- */
function autoexec()
-- WARPSTONE is found late in the game, so some things are now available
-- that were not available earlier
if (get_progress(P_WARPSTONE) == 1) then
-- Move the guard guarding the houses in the north-east section of town
-- over one tile so we can get in
place_ent(6, "guard")
-- The bridge repairs will now be completed
if (get_progress(P_SHOWBRIDGE) == 1) then
set_progress(P_SHOWBRIDGE, 2)
end
-- If the Mayor had been found, he will now have recovered from his ordeal
-- and will be willing to speak to you
if (get_progress(P_FOUNDMAYOR) == 1) then
set_progress(P_FOUNDMAYOR, 2)
end
end
refresh()
end
function entity_handler(en)
if (en == 0) then
if (get_progress(P_WARPSTONE) == 1) then
bubble(en, "Back again, are you?")
else
bubble(en, "You must be an adventurer. There has been an unusual number of you people around lately.")
end
if (get_progress(P_FOUNDMAYOR) > 0) then
bubble(en, "Oh, and thank you for finding the mayor.")
end
elseif (en == 1) then
if (get_progress(P_FOUNDMAYOR) == 0) then
bubble(en, "My husband is late again.")
elseif (get_progress(P_FOUNDMAYOR) == 1) then
bubble(en, "I'm getting so worried...")
bubble(en, "You don't think Malkaron has something to do with it?")
elseif (get_progress(P_FOUNDMAYOR) == 2) then
bubble(en, "Where is that man?")
else
bubble(en, "Oh... that bad man, making me worry like this, I'm gonna kill him!")
end
elseif (en == 2) then
if (get_progress(P_FIGHTONBRIDGE) > 4) then
if (get_progress(P_SHOWBRIDGE) == 2) then
bubble(en, "Thank you so much for restoring the trade route to the citizens of Randen!")
else
bubble(en, "Welcome to Randen.")
end
else
bubble(en, "This is the town of Randen. We're mostly a coastal trade town, but with the bridge out, trade is extremely slow.")
bubble(en, "Do you think it has something to do with Malkaron? We've heard a lot of rumors about him as of late...")
end
elseif (en == 3) then
if (get_progress(P_FOUNDMAYOR) > 1 and get_progress(P_MAYORGUARD1) > 0 and get_progress(P_MAYORGUARD2) > 0) then
bubble(en, "My husband is so excited that everyone returned safely. He tends to get forgetful when he's like this. Sometimes he doesn't even lock up after himself on his way to work.")
set_obs("room_5door", 0)
set_zone ("room_5door", 0)
elseif (get_progress(P_FIGHTONBRIDGE) > 4) then
bubble(en, "Good day.")
else
if (get_progress(P_BLADE) == 0) then
-- PH: Just my little joke hehe
bubble(en, "I'm just preparing some vegetables.")
bubble(HERO1, "That's a strange knife you've got there.")
bubble(en, "What? Oh, this. Yes, it's a Phoenix Blade.")
bubble(en, "I found it lying about under a pile of leaves in the forest.")
bubble(HERO1, "Isn't there supposed to be someone out looking for that?")
bubble(en, "I heard that, too, but it's been ages and no-one has turned up.")
bubble(en, "I would give it back, but I need it for slicing carrots!")
bubble(HERO1, "Your secret's safe with me.")
set_progress(P_BLADE, 1)
else
bubble(en, "Oh, goodness, I didn't make enough for company... sorry.")
end
end
elseif (en == 4) then
if (get_progress(P_FIGHTONBRIDGE) > 4) then
if (get_progress(P_SHOWBRIDGE) == 2) then
bubble(en, "Wow! Mom says you're the ones who beat up the bad guys! You're so cool!")
else
bubble(en, "Hi!")
end
else
bubble(en, "I'm hungry, I hope mom is done making lunch soon.")
end
elseif (en == 5) then
if (get_progress(P_FIGHTONBRIDGE) > 4) then
if (get_progress(P_WARPSTONE) == 1) then
bubble(en, "Business is good.")
else
bubble(en, "Now that the bridge is repaired I'm back in business!")
end
if (get_treasure(9) == 0) then
bubble(en, "I hear you had something to do with speeding along the bridge's construction. I'd like you to have this.")
chest(9, I_B_SHOCK, 1)
end
if (get_progress(P_SHOWBRIDGE) < 2) then
bubble(en, "You should look around there to see if the workers left anything behind.")
else
if (get_treasure(8) == 0) then
bubble(en, "I found this Olginar Seed on the bridge. You can have it.")
chest(8, I_OSEED, 1)
end
if (get_treasure(90) == 0) then
bubble(en, "Oh, and I found this curious artifact there as well...")
chest(90, I_REGENERATOR, 1)
end
end
else
bubble(en, "If you haven't already noticed, the bridge across Brayden river is gone.")
bubble(en, "It appears that some travelers were stopped by Malkaron's brigands on the bridge, resulting in a volley of magic that left it in cinders.")
set_ent_script(en, "W25")
wait_for_entity(en)
bubble(en, "A new bridge is supposed to be built soon. This town can't survive for long without our major trade route.")
end
elseif (en == 6) then
if (get_progress(P_WARPSTONE) == 1) then
if (get_progress(P_FOUNDMAYOR) < 2) then
bubble(en, "Our mayor is still missing. We're not sure what to do at this point.")
elseif (get_progress(P_FOUNDMAYOR) == 2) then
bubble(en, "$0! The mayor is back now, thank you! He wants to see you right away!")
else
bubble(en, "Thank you again for everything!")
end
else
if (get_progress(P_FOUNDMAYOR) == 0) then
if (get_progress(P_FIGHTONBRIDGE) > 4) then
bubble(en, "The mayor has yet to return from Andra. A few of our men are out looking for him as we speak.")
else
bubble(en, "The mayor was going to Andra to talk to the Council there. I think that he should have been back by now.")
bubble(en, "We may have to go and look for him soon. We need to make sure that he is safe.")
end
elseif (get_progress(P_FOUNDMAYOR) < 2) then
bubble(en, "The mayor is back now, thanks to you. However, the mayor is not seeing any visitors for a while.")
bubble(en, "He is still recovering from his ordeal.")
else
bubble(en, "I have a scripting error.")
end
end
elseif (en == 7) then
if (get_progress(P_WARPSTONE) == 1) then
bubble(en, "Are you enjoying your stay?")
else
if (get_progress(P_FOUNDMAYOR) == 0) then
bubble(en, "The mayor left for Andra with an adventurer that he had just hired and his usual contingent of guards.")
bubble(en, "I wonder if they avoided the trouble at the bridge?")
else
bubble(en, "Thank you!")
end
end
elseif (en == 8) then
bubble(en, "I wonder why those adventurers were stopped at the bridge? I'm not sure I want to try crossing it just yet.")
elseif (en == 9) then
bubble(en, "How long does it take to build a bridge?")
elseif (en == 10) then
LOC_join_ajathar(en)
refresh()
elseif (en == 11) then
bubble(en, "Hey, you can't be back here! What are you trying to do, steal from me?")
elseif (en == 12) then
if (get_progress(P_MAYORGUARD1) == 1) then
bubble(en, "Thanks for rescuing me back there! Here, have this:")
set_gp(get_gp() + 1000)
msg("You acquired 1000 gold pieces!")
set_progress(P_MAYORGUARD1, 2)
else
bubble(en, "Those forces of Malkaron's sure are tough!")
end
elseif (en == 13) then
LOC_join_casandra(en)
refresh()
elseif (en == 14) then
if (get_progress(P_FOUNDMAYOR) < 2) then
bubble(en, "How did you get in here past my locked door?")
elseif (get_progress(P_FOUNDMAYOR) == 2) then
bubble(en, "Oh, $0, thank you for rescuing me!")
set_progress(P_FOUNDMAYOR, 3)
else
bubble(en, "I had a spa installed in my house! What do you think?")
end
end
end
function postexec()
return
end
function refresh()
local x, y
showch("treasure1", -1)
showch("treasure2", -1)
showch("treasure3", 96)
showch("treasure4", 3)
showch("treasure5", 4)
showch("treasure6", 5)
showch("treasure7", 31)
showch("treasure8", 46)
showch("treasure9", 97)
x, y = marker("travelpoint")
if (get_progress(P_WARPSTONE) == 1) then
set_mtile(x, y, 0)
else
set_zone (x, y, 0)
end
-- This NPC will only appear if you spoke with him in the camp
if (get_progress(P_MAYORGUARD1) == 0) then
set_ent_active(12, 0)
end
-- Ditto, plus make sure you cannot speak to a "ghost" over the counter
if (get_progress(P_MAYORGUARD2) == 0) then
x, y = get_ent_tile(11)
set_ent_active(11, 0)
set_zone (x, y + 1, 0)
end
if (not LOC_manor_or_party(AJATHAR)) then
-- Make the NPC look like Ajathar if he has not been recruited yet
set_ent_id(10, AJATHAR)
else
-- Otherwise, remove him from screen
set_ent_active(10, 0)
end
if (get_progress(P_FOUNDMAYOR) > 0 and
not LOC_manor_or_party(CASANDRA)) then
-- Casandra should be available to join your party
set_ent_id(13, CASANDRA)
else
set_ent_active(13, 0)
end
if (get_progress(P_FOUNDMAYOR) > 0 and
get_progress(P_SHOWBRIDGE) > 1) then
set_ent_active(8, 0)
set_ent_active(9, 0)
end
end
-- Show the status of a treasures
function showch(which_marker, which_chest)
-- The zones 'which_chest == -1' means that there is no "chest" where the
-- current treasure is found, but is something like a flower patch that
-- can't be walked upon. If those treasures have been found, remove the
-- obstacle at that location, as well as the triggering zone.
if (which_chest < 0) then
-- Evaluate the chest-less treasure at this location
set_obs(which_marker, 0)
-- We have already found the "treasure chest-less" secret treasure here,
-- so get rid of the 'activating zone' for it
set_zone(which_marker, 0)
elseif (get_treasure(which_chest) == 1) then
set_mtile(which_marker, 265)
-- We have already collected this treasure,
-- so get rid of the 'activating zone' for it
set_zone(which_marker, 0)
end
end
function zone_handler(zn)
if (zn == 1) then
change_map("cave1", "exit")
elseif (zn == 2) then
door_in("room_1i")
elseif (zn == 3) then
door_in("room_3i")
elseif (zn == 4) then
door_in("room_2i")
elseif (zn == 5) then
door_in("room_4i")
elseif (zn == 6) then
door_in("inn_i")
elseif (zn == 7) then
door_in("shop_1i")
elseif (zn == 8) then
door_in("shop_4i")
elseif (zn == 9) then
bubble(HERO1, "Locked.")
elseif (zn == 10) then
door_out("room_1o")
elseif (zn == 11) then
door_out("room_3o")
elseif (zn == 12) then
door_out("room_2o")
elseif (zn == 13) then
door_out("room_4o")
elseif (zn == 14) then
door_out("inn_o")
elseif (zn == 15) then
door_out("shop_1o")
elseif (zn == 16) then
door_out("shop_4o")
elseif (zn == 17) then
-- /* PH added code to check if you do stay over night.
-- This is done indirectly; if your GP goes down it
-- means you must have slept here. */
local old_gp = get_gp()
inn("Wayside Inn", 30, 1)
-- This means you MUST stay at the inn before the bridge gets repaired.
if (get_gp() < old_gp) then
if (get_progress(P_FIGHTONBRIDGE) == 4) then
set_progress(P_FIGHTONBRIDGE, 5)
set_progress(P_SHOWBRIDGE, 1)
end
end
elseif (zn == 18) then
shop(4)
elseif (zn == 19) then
shop(5)
elseif (zn == 20) then
warp("hall_stairs1", 8)
elseif (zn == 21) then
warp("room_5i", 8)
elseif (zn == 22) then
warp("room_4stairs", 8)
elseif (zn == 23) then
warp("hall_stairs2", 8)
elseif (zn == 24) then
chest(3, I_KNIFE2, 1)
refresh()
elseif (zn == 25) then
chest(4, 0, 250)
refresh()
elseif (zn == 26) then
chest(5, I_SALVE, 1)
refresh()
elseif (zn == 27) then
chest(7, I_PURITYGEM, 1)
refresh()
elseif (zn == 28) then
change_map("main", "town2")
elseif (zn == 29) then
chest(10, I_MHERB, 1)
refresh()
elseif (zn == 30) then
book_talk(party[0])
elseif (zn == 31) then
chest(11, I_LTONIC, 1)
refresh()
elseif (zn == 32) then
book_talk(party[0])
elseif (zn == 33) then
bubble(HERO1, "Hmmm... books about herbs.")
elseif (zn == 34) then
if (get_progress(P_FOUNDMAYOR) > 1) then
door_in("mayor_i")
else
bubble(HERO1, "Locked.")
end
elseif (zn == 35) then
bubble(HERO1, "Inns always have boring books.")
elseif (zn == 36) then
change_map("town6", "travelpoint")
elseif (zn == 37) then
touch_fire(party[0])
elseif (zn == 38) then
warp("shop_4hidden", 8)
elseif (zn == 39) then
warp("room_5door", 8)
elseif (zn == 40) then
chest(31, 0, 150)
refresh()
elseif (zn == 41) then
chest(46, I_STRSEED, 2)
refresh()
elseif (zn == 42) then
chest(96, 0, 250)
refresh()
elseif (zn == 43) then
if (get_progress(MAYORGUARD2) > 0) then
bubble(11, "Thank you for rescuing me!")
end
elseif (zn == 44) then
LOC_door("door_guard1")
elseif (zn == 45) then
LOC_door("door_guard2")
elseif (zn == 46) then
chest(97, 0, 1500)
refresh()
elseif (zn == 47) then
door_in("shop_2i")
elseif (zn == 48) then
door_out("shop_2o")
elseif (zn == 49) then
door_in("shop_3i")
elseif (zn == 50) then
door_out("shop_3o")
elseif (zn == 51) then
door_out("mayor_o", 0, -1)
end
end
function LOC_door(which_marker)
sfx(25)
local x, y = marker(which_marker)
set_btile(x, y, 0)
set_mtile(x, y + 1, 519)
set_ftile(x, y, 518)
set_zone(x, y, 0)
set_obs(x, y, 0)
end
function LOC_join_ajathar(en)
local id
local hero = 9
if (get_progress(P_SIDEQUEST1) == 0) then
if (get_progress(P_TALK_AJATHAR) == 0) then
bubble(HERO1, "Hello! You haven't ventured very far!")
bubble(en, "I have been maintaining a constant prayer vigil at this point. It should discourage the monsters from emerging into the town.")
bubble(HERO1, "And what if they DO come out?")
bubble(en, "My training also included swordsmanship.")
set_progress(P_TALK_AJATHAR, 1)
elseif (get_progress(P_TALK_AJATHAR) == 1) then
bubble(en, "I hope I am doing the right thing here.")
end
return
end
if (get_progress(P_TALK_AJATHAR) == 0) then
bubble(en, "Be careful! That tunnel is infested with monsters.")
bubble(HERO1, "Fortunately, I have been successful in closing the Portal. No more monsters will trouble us now.")
set_progress(P_TALK_AJATHAR, 1)
else
bubble(HERO1, "You can rest easy now. I have closed the Portal that let the monsters through.")
end
bubble(en, "Great! Can I offer my services?")
-- Give Ajathar his default equipment
set_all_equip(AJATHAR, I_MACE2, I_SHIELD1, I_HELM1, I_ROBE2, I_BAND1, 0)
id = select_team{AJATHAR}
-- Add the characters that were not selected to the manor
add_to_manor(id)
if (id[1]) then
local script = "L1U2L2U1K"
set_ent_id(en, id[1])
set_ent_script(en, "L1U1"..script)
if (id[2]) then
-- Two heroes were de-selected
set_ent_id(hero, id[2])
set_ent_active(hero, 1)
local x, y = get_ent_tile(en)
place_ent(hero, x, y + 1)
bubble(en, "If you need us, we'll be back at the manor.")
set_ent_speed(hero, 4)
set_ent_speed(en, 4)
set_ent_script(hero, "L1U2"..script)
wait_for_entity(hero, en)
else
-- One hero was de-selected
bubble(en, "If you need me, I'll be back at the manor.")
wait_for_entity(en, en)
end
end
set_ent_active(hero, 0)
set_ent_active(en, 0)
set_progress(P_PLAYERS, get_progress(P_PLAYERS) + 1)
end
function LOC_join_casandra(en)
local id
local hero = 8
bubble(en, "$0, thank you for helping us escape from the orc's camp!")
bubble(HERO1, "Don't mention it. How did you get caught up in that mess anyway?")
bubble(en, "Well, like I mentioned earlier, the mayor needed a bodyguard while he delivered an urgent message to some guy named Tsorin in Andra.")
bubble(en, "That's when we were caught by the orcs. They Mayor ate the note when we were under attack. I have no idea what it was about.")
bubble(HERO1, "Hmm, still sounds a bit fishy.")
bubble(en, "I'd gladly join you to find out what this is all about!")
-- Give Casandra her default equipment
set_all_equip(CASANDRA, I_MACE2, I_SHIELD1, I_HELM1, I_ROBE2, I_BAND1, 0)
id = select_team{CASANDRA}
-- Add the characters that were not selected to the manor
add_to_manor(id)
if (id[1]) then
set_ent_id(en, id[1])
set_ent_script(en, "U8K")
if (id[2]) then
-- Two heroes were de-selected
set_ent_id(hero, id[2])
set_ent_active(hero, 1)
local x, y = get_ent_tile(en)
place_ent(hero, x, y - 1)
bubble(en, "If you need us, we'll be back at the manor.")
set_ent_speed(hero, 4)
set_ent_speed(en, 4)
set_ent_script(hero, "U9K")
wait_for_entity(hero, en)
else
-- One hero was de-selected
bubble(en, "If you need me, I'll be back at the manor.")
wait_for_entity(en, en)
end
end
set_ent_active(hero, 0)
set_ent_active(en, 0)
set_progress(P_PLAYERS, get_progress(P_PLAYERS) + 1)
end
|