1;;---------------------------------------------------------------------------- 2;; The very first line of any session file should be (load "naz.scm"). This 3;; bootstraps some procedures that we need to continue. This is the only place 4;; you should use 'load'. Every other place you want to load a file you should 5;; user 'kern-load'. 'kern-load' ensures that a saved session will be able to 6;; load the file, too. 7;;---------------------------------------------------------------------------- 8(load "naz.scm") 9(kern-script-version "0.7.0") 10 11;; Setup progress bar for loading. I arrived at the number by printing the 12;; current number of steps in src/foogod.c:foogod_progress_bar_finish(). 13(kern-progress-bar-start "Loading" 205) 14 15;; Wrap the original definition of (load ...) with one that advances the 16;; progress bar. 17(define original-load load) 18(define (load file) 19 (kern-progress-bar-advance 1) 20 (original-load file) 21 ) 22 23;;---------------------------------------------------------------------------- 24;; Load the read-only game data. See the note on 'kern-load' vs 'load' above. 25;;---------------------------------------------------------------------------- 26(kern-load "game.scm") 27(kern-load "quests-mech.scm") 28(kern-load "camping-map.scm") 29 30(kern-load "quests-data-static.scm") 31(kern-load "zones.scm") 32(kern-load "runes.scm") 33(kern-load "prices.scm") 34(kern-load "special.scm") 35(kern-load "town-entry.scm") 36(kern-load "pseudorandom-map.scm") 37(kern-load "endless-deeps-mech.scm") 38(kern-load "lost-halls-mech.scm") 39(kern-load "voidgap-mech.scm") 40(kern-load "player.scm") 41 42;;---------------------------------------------------------------------------- 43;; Time -- this needs to be set before loading any dungeon rooms 44;;---------------------------------------------------------------------------- 45(define hour 07) 46(define minutes 00) 47(define time-in-minutes (+ (* hour 60) minutes)) 48(define game-start-time (time-mk 1611 0 0 0 hour minutes)) 49 50(kern-set-clock 51 1611 ; year 52 0 ; month 53 0 ; week 54 0 ; day 55 hour ; hour 56 minutes ; minutes 57 ) 58 59;; NPC's who inhabit multiple places 60(kern-load "gregor.scm") 61(kern-load "kalcifax.scm") 62 63;;---------------------------------------------------------------------------- 64;; Places 65;;---------------------------------------------------------------------------- 66(load "gregors-hut.scm") 67(load "moongate-clearing.scm") 68(load "abandoned-farm.scm") 69(load "abandoned-cellar.scm") 70(load "slimy-cavern.scm") 71(load "trigrave.scm") 72(load "lost-halls.scm") 73(load "enchanters-tower.scm") 74(load "green-tower.scm") 75(load "green-tower-lower.scm") 76(load "mushroom-cave.scm") 77(load "goblin-kingdoms.scm") 78(load "treasury.scm") 79(load "bole.scm") 80(load "glasdrin.scm") 81(load "oparine.scm") 82(load "traps_1.scm") 83(load "traps_2.scm") 84(load "traps_3.scm") 85(load "traps_4.scm") 86(load "thiefs_den.scm") 87(load "keep.scm") 88(load "absalot.scm") 89(load "old-absalot.scm") 90(load "engineers-hut.scm") 91(load "mans-hideout.scm") 92(load "necromancers-lair.scm") 93(load "fire_sea.scm") 94(load "void-temple.scm") 95(load "merciful-death.scm") 96(load "angriss-lair.scm") 97(load "poor-house.scm") 98(load "prison.scm") 99(load "ankh-shrine.scm") 100(load "kraken-lakes.scm") 101(load "endless-deeps.scm") 102(load "forsaken-prison.scm") 103(load "old-mine.scm") 104(load "lich-tomb.scm") 105(load "altar-room.scm") 106(load "dank-cave.scm") 107(load "eastpass.scm") 108(load "westpass.scm") 109(load "crypt.scm") 110(load "ancient-derelict.scm") 111(load "road_to_absalot.scm") 112(load "kun.scm") 113(load "gamestart.scm") 114(load "bandit-hideout.scm") 115(load "brundegardt.scm") 116(load "voidgap-passage.scm") 117 118;;---------------------------------------------------------------------------- 119;; Characters 120;;---------------------------------------------------------------------------- 121 (kern-mk-char 122 'ch_wanderer 123 "The Wanderer" ; name 124 sp_human ; species 125 oc_wanderer ; occ 126 s_wanderer ; sprite 127 faction-player ; starting alignment 128 6 6 6 ; str/int/dex 129 pc-hp-off 130 pc-hp-gain 131 pc-mp-off 132 pc-mp-gain 133 max-health 0 max-health 0 1 ; hp/xp/mp/AP_per_turn/lvl 134 #f ; dead 135 nil ; conv 136 nil ; sched 137 nil ; special ai 138 nil ; container 139 nil ; readied 140 ) 141 142 143 144; ;; For test 145; (kern-mk-char 146; 'ch_thorald_greybeard ; tag 147; "Thorald Greybeard" ; name 148; sp_human ; species 149; oc_wizard ; occ 150; s_companion_wizard ; sprite 151; faction-player ; starting alignment 152; 0 10 2 ; str/int/dex 153; 0 1 ; hp mod/mult 154; 10 5 ; mp mod/mult 155; 240 0 8 speed-human-med-armor 8 ; hp/xp/mp/AP_per_turn/lvl 156; #f ; dead 157; nil ; conv 158; nil ; sched 159; nil ; special ai 160; nil ; container 161; ;;(list t_doom_staff) ; readied 162; nil 163; ) 164 165;;---------------------------------------------------------------------------- 166;; Player Party 167;;---------------------------------------------------------------------------- 168(bind 169 (kern-mk-player 170 'player ; tag 171 s_wanderer ; sprite 172 "Walk" ; movement description 173 sound-walking ; movement sound 174 1 ; food 175 0 ; gold 176 (* 60 60 5) ; turns to next meal (5 hours) 177 nil ; formation 178 m_campsite ; campsite map 179 nil ; campsite formation 180 nil ; vehicle 181 ;; inventory 182 (kern-mk-inventory nil) 183 nil ;; party members (should be nil for initial load file) 184 ) 185 (tbl-mk)) 186 187;;---------------------------------------------------------------------------- 188;; Party members 189;;---------------------------------------------------------------------------- 190(kern-party-add-member player ch_wanderer) 191;;(kern-party-add-member player ch_thorald_greybeard) 192 193 194;;---------------------------------------------------------------------------- 195;; Places 196;;---------------------------------------------------------------------------- 197(load "shard.scm") 198 199;;---------------------------------------------------------------------------- 200;; Astronomy 201;;---------------------------------------------------------------------------- 202(kern-mk-astral-body 203 'sun ; tag 204 "Fyer (the sun)" ; name 205 1 ; relative astronomical distance 206 1 ; minutes per phase (n/a for sun) 207 (/ (* 24 60) 360) ; minutes per degree 208 0 ; initial arc 209 0 ; initial phase 210 '() ; script interface 211 ;; phases: 212 (list 213 (list s_sun 255 "full") 214 ) 215 ) 216 217;;---------------------------------------------------------------------------- 218;; Lumis is the source gate, which means it opens the source moongates on its 219;; phases. We designate this by using the source-moon-ifc as its ifc. 220;; 221;; Note: the arc and phase are calculated to give the moon the right orientation 222;; with respect to phase vs sun position 223;;---------------------------------------------------------------------------- 224(mk-moon 'lumis ; tag 225 "Lumis" ; name 226 5 ; hours per phase 227 60 ; hours per revolution 228 22 ; initial arc 229 0 ; initial phase 230 'source-moon-ifc ; ifc 231 ;; gates (moons are fixed at 8 phases in mk-moon): 232 (list 'mg-1 'mg-2 'mg-3 'mg-4 233 'mg-5 'mg-6 'mg-7 'mg-8 234 ) 235 "yellow") 236 237;;---------------------------------------------------------------------------- 238;; Ord is the destination gate, which means its phase decides the destination 239;; when the player steps through a moongate. We designate this by giving it a 240;; nil ifc. Note that its gates do not need to be listed in the same order as 241;; Lumis. In fact, they don't even need to be the same set of gates. 242;; 243;; Note: the arc and phase are calculated to give the moon the right orientation 244;; with respect to phase vs sun position 245;;---------------------------------------------------------------------------- 246(mk-moon 'ord ; tag 247 "Ord" ; name 248 9 ; hours per phase 249 36 ; hours per revolution 250 67 ; initial arc 251 7 ; initial phase 252 nil ; ifc 253 ;; gates (moons are fixed at 8 phases in mk-moon): 254 (list 'mg-1 'mg-2 'mg-3 'mg-4 255 'mg-5 'mg-6 'mg-7 'mg-8 256 ) 257 "blue") 258 259;; ---------------------------------------------------------------------------- 260;; The diplomacy table. Each entry defines the attitude of the row to the 261;; column. Note that attitudes are not necessarily symmetric. Negative values 262;; are hostile, positive are friendly. 263;; 264;; Note: factions should always be allied with themselves in order for 265;; summoning AI to work properly. 266;; 267;; Formatted for spreadsheet 268;; ---------------------------------------------------------------------------- 269(kern-mk-dtable 270 ;; non pla men cgb acc mon tro spd out gnt dem fgb prs gla 271 (list 2 0 0 0 -1 -2 -2 -2 0 -2 -2 0 0 0 ) ;; none 272 (list 0 2 2 -2 -2 -2 -2 -2 -2 -2 -2 -2 2 2 ) ;; player 273 (list -1 2 2 -1 -2 -2 -2 -2 -2 -2 -2 -2 2 2 ) ;; men 274 (list -1 -2 -2 2 -1 -2 0 -2 -2 -1 -2 -2 0 -2 ) ;; cave goblin 275 (list -1 -2 -1 -1 2 -2 -1 -1 -2 -1 -2 -2 0 -2 ) ;; accursed 276 (list -2 -2 -2 -2 -2 2 -2 0 -2 0 -2 0 0 -2 ) ;; monsters 277 (list -2 -2 -2 0 -1 -2 2 -2 -2 -1 -2 -1 0 -2 ) ;; hill trolls 278 (list -2 -2 -2 -2 -1 0 -2 2 -2 -1 -2 0 0 -2 ) ;; wood spiders 279 (list 0 -2 -2 -2 -2 -2 -2 -2 2 -2 -2 -1 0 -2 ) ;; outlaws 280 (list -2 -2 -2 -1 -1 0 -1 -1 -2 2 -2 -1 0 -2 ) ;; gint 281 (list -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 2 -2 0 -2 ) ;; demon 282 (list 0 -2 -2 -2 -2 0 -2 0 -1 -1 -2 2 0 -2 ) ;; forest goblin 283 (list 0 2 2 0 0 0 0 0 0 0 0 0 2 2 ) ;; prisoners 284 (list -1 2 2 -1 -2 -2 -2 -2 -2 -2 -2 -2 2 2 ) ;; glasdrin 285) 286 287 288;;---------------------------------------------------------------------------- 289;; Startup - this is a one-time only script that runs when the player starts 290;; the game for the first time (or whenever he starts over from scratch, 291;; loading the game from this file). It sets up the story a bit. 292;; 293;; The camera should center on the moongate clearing. Then, a gate should rise 294;; from the ground, pause, then sink back down, leaving the player's sleep 295;; sprite on the ground. Another pause, and then the player should wake up. 296;;---------------------------------------------------------------------------- 297(define (start-scene kplayer) 298 299 (kern-log-msg "A dark gate rises in a quiet clearing...") 300 (moongate-animate black-gate blackgate-stages) 301 (kern-sleep 2000) 302 303 (kern-log-enable #f) 304 (kern-char-set-sleep ch_wanderer #t) 305 (kern-obj-put-at kplayer (list p_moongate_clearing 11 12)) 306 307 (kern-log-enable #t) 308 (kern-log-msg "Then closes without a trace...") 309 (moongate-animate black-gate (reverse blackgate-stages)) 310 (kern-sleep 1000) 311 312 (kern-log-msg "You lie dreaming for a while, of another life...") 313 (kern-sleep 2000) 314 315 (kern-log-enable #f) 316 (kern-char-set-sleep ch_wanderer #f) 317 (kern-player-set-follow-mode) 318 (kern-log-enable #t) 319 (kern-log-msg "...then awaken to a strange new world.") 320 (kern-log-msg "To the southwest you see a cave.") 321 ) 322 323(define (simple-start kplayer) 324 (kern-obj-put-at kplayer (list p_shard 76 114))) 325 326(define (create-char kplayer) 327 (kern-obj-put-at kplayer (list p_char_setup 10 17) 328 )) 329 330;;---------------------------------------------------------------------------- 331;; To skip the extended start scene comment out this next line and uncomment 332;; the line after it. 333;;---------------------------------------------------------------------------- 334;;(kern-set-start-proc start-scene) 335;;(kern-set-start-proc simple-start) 336(kern-add-hook 'new_game_start_hook 'create-char) 337(load "quests-data.scm") 338(quest-assign (quest-data-get 'questentry-charcreate)) 339 340(kern-progress-bar-finish) 341(println "r2g") 342 343 344;;quickstart stuff for playtesting 345 346(if #f 347 (begin 348 (kern-obj-put-at 349 (mk-chest 350 nil ;; trap 351 352 '( 353 354 ;; Food 355 ( 1000 t_food) 356 357 ;; Gold 358 ( 1000 t_gold_coins) 359 360 ;; Reagents 361 ( 55 sulphorous_ash) 362 ( 55 ginseng) 363 ( 55 garlic) 364 ( 55 spider_silk) 365 ( 53 blood_moss) 366 ( 53 black_pearl) 367 ( 51 nightshade) 368 ( 51 mandrake) 369 370 ;; Items 371 ( 9 t_vas_mani_scroll) 372 ( 9 t_in_ex_por_scroll) 373 ( 9 t_sanct_lor_scroll) 374 ( 9 t_wis_quas_scroll) 375 ( 9 t_xen_corp_scroll) 376 ( 9 t_an_xen_ex_scroll) 377 ( 9 t_vas_rel_por_scroll) 378 ( 59 t_gem) 379 ( 9 t_cure_potion) 380 ( 9 t_mana_potion) 381 ( 99 t_xp_potion) 382 ( 99 t_str_potion) 383 ( 99 t_dex_potion) 384 ( 99 t_int_potion) 385 ( 99 t_info_potion) 386 ( 99 t_torch) 387 ( 99 t_picklock) 388 ( 9 t_pick) 389 ( 2 t_dragons_blood) 390 ( 2 t_hydras_blood) 391 ( 2 t_shovel) 392 ;; ( 1 t_rune_k) 393 394 395 ;; Arms 396 ( 1 t_dagger) 397 ( 1 t_mace) 398 ( 1 t_axe) 399 ( 1 t_sword) 400 ( 1 t_2H_axe) 401 ( 1 t_2H_sword) 402 ( 1 t_morning_star) 403 ( 1 t_halberd) 404 ( 1 t_staff) 405 406 ( 1 t_dagger_4) 407 ( 1 t_sword_4) 408 ( 1 t_morning_star_2) 409 ( 1 t_stun_wand) 410 ( 1 t_doom_staff) 411 ( 1 t_eldritch_blade) 412 ( 1 t_mystic_sword) 413 ( 1 t_flaming_sword) 414 415 ( 1 t_shield) 416 ( 1 t_scratched_shield) 417 418 ( 1 t_leather_helm) 419 ( 1 t_chain_coif) 420 ( 1 t_iron_helm) 421 422 ( 1 t_armor_leather) 423 ( 1 t_armor_chain) 424 ( 1 t_armor_plate) 425 426 ( 1 t_iron_helm_4) 427 ( 1 t_armor_leather_4) 428 ( 1 t_armor_chain_4) 429 ( 1 t_armor_plate_4) 430 431 ( 1 t_chrono) 432 ( 1 t_spiked_shield) 433 434 ( 1 t_sling) 435 ( 3 t_spear) 436 437 ( 1 t_sling_4) 438 ( 1 t_magic_axe) 439 440 (20 t_oil) 441 (20 t_slime_vial) 442 443 ( 1 t_self_bow) 444 ( 1 t_bow) 445 ( 1 t_long_bow) 446 ( 1 t_great_bow) 447 (500 t_arrow) 448 449 ( 1 t_lt_crossbow) 450 ( 1 t_crossbow) 451 ( 1 t_hvy_crossbow) 452 ( 1 t_trpl_crossbow) 453 (500 t_bolt) 454 455 )) 456 (list p_char_setup 16 17)) 457 458 (kern-obj-put-at 459 (mk-ladder-down 'p_moongate_clearing 18 18) 460 (list p_char_setup 17 17)) 461 462 (kern-obj-put-at 463 (mk-ladder-down 'p_trigrave 16 16) 464 (list p_char_setup 17 16)) 465 466 (kern-obj-put-at 467 (mk-ladder-down 'p_fire_sea 4 4) 468 (list p_char_setup 17 15)) 469 470 (kern-obj-put-at 471 (mk-ladder-down 'p_oparine 1 1) 472 (list p_trigrave 17 16)) 473 474 (kern-obj-put-at 475 (mk-ladder-down 'p_lost_garrison 22 22) 476 (list p_oparine 1 1)) 477 478 )) 479