File: sunarin.lua

package info (click to toggle)
kq 0.99.cvs20070319-1.1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 8,344 kB
  • ctags: 2,870
  • sloc: ansic: 26,328; sh: 3,737; makefile: 203; perl: 100
file content (109 lines) | stat: -rw-r--r-- 2,690 bytes parent folder | download
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
-- sunarin - "Sunarin Tower"

function autoexec()
  return
end


function entity_handler(en)
  if (en == 0) then
    local x, y = get_ent_tile(HERO1)
    move_entity(HERO2, x, y + 1)
    wait_for_entity(HERO2)

    bubble(en, "I am the king of thieves!")
    if (get_progress(P_AYLA_QUEST) == 7 and get_ent_chrx(HERO1) ~= 0) then
      bubble(HERO1, "Yea? Well I'm Ayla... you know, "..pick("Daughter of Malkaron",
        "Princess Ayla", "heir to Dungar's estate").."!")
      bubble(en, "Oh really. Is that a fact?")
      thought(HERO1, "Uh, oh. Wrong thing to say...")
      bubble(en, "Guards!!")
      move_entity(1, x - 1, y)
      move_entity(2, x - 1, y + 1)
      move_entity(3, x + 1, y)
      move_entity(4, x + 1, y + 1)
      wait_for_entity(1, 4)
      set_run(0)
      combat(61)
      set_run(1)
      if (get_alldead() == 1) then
        bubble(en, "And now, your remains will be food for the fishes!")
        return
      end

      set_ent_active(1, 0)
      set_ent_active(2, 0)
      set_ent_active(3, 0)
      set_ent_active(4, 0)

      bubble(en, "You shall rue the day you came against me!")
      wait(50)
      set_ent_active(0, 0)
      wait(50)
      bubble(HERO1, "Whoa! He just disappeared! Oh well, that treasure is still down there.")
    else
      bubble(en, "Honor me, for I am king!")
    end
  elseif (en == 1) then
    bubble(en, "WE GUARD THE SACRED TREASURE!")
  elseif (en == 2) then
    bubble(en, "None shall inherit the treasure except who joins the guild!")
  elseif (en == 3) then
    bubble(en, "Who are you? Are you trying to steal from us?")
  elseif (en == 4) then
    bubble(255, "The man glowers at you, but says nothing.")
  end
end


function postexec()
  return
end


function refresh()
  showch("treasure1", 32)
end


-- Show the status of treasures
function showch(which_marker, which_chest)
  -- Set tiles if chest already opened
  if (get_treasure(which_chest) == 1) then
    set_zone(which_marker, 0)
  end

  -- Only treasure1 needs to change its obstacle setting
  if (which_marker == "treasure1") then
    set_obs(which_marker, 0)
  end
end


function zone_handler(zn)
  if (zn == 1) then
    change_map("main", "town5", 2, -1)
  elseif (zn == 2) then
    LOC_door("door1")
  elseif (zn == 3) then
    touch_fire(party[0]);
  elseif (zn == 4) then
    bubble(HERO1, "The door appears to be locked.")
  elseif (zn == 5) then
    bubble(HERO1, "That's a treasure chest!")
    bubble(HERO1, "Stay tuned for KQ 1.0 Final!")
  end

end


function LOC_door(which_marker)
  sfx(25)

  local x, y = marker(which_marker)
  set_mtile(x, y, 0)
  set_mtile(x, y + 1, 0)
  set_obs(x, y, 0)
  set_shadow(x, y, 8)
  set_zone(x, y, 0)
end