File: town3.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 (193 lines) | stat: -rw-r--r-- 6,707 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
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


-- town3 - "Andra"

--
function autoexec()
  if (get_progress(108) == 4) then
    --
    set_ent_active(1, 0)
  end
  refresh()
end
function entity_handler(en)
  if (en == 0) then
    bubble(en, "This is the town of Andra.")
  elseif (en == 1) then
    LOC_talk_tsorin(en)
  elseif (en == 2) then
    bubble(en, "I wish the weapon shop sold slingshots.")
  elseif (en == 3 or en == 4) then
    bubble(en, "We're guarding against goblins.")
  elseif (en == 8) then
    bubble(en, "Caffeine, caffeine, caffeine, caffeine...")
  elseif (en == 9) then
    LOC_talk_oldguy(en)
  end
end
function postexec()
  return
end
function refresh()
  showch("treasure1", 12)
  showch("treasure2", 13)
  showch("treasure3", 14)
  showch("treasure4", 99)
  showch("treasure5", 100)
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
  -- Only treasure4 needs to change its Layer2 tile
  if (which_marker == "treasure4") then
    set_mtile(which_marker, 0)
  end
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", "town3")
  elseif (zn == 2) then
    door_in("inn_i")
  elseif (zn == 3) then
    door_out("inn_o")
  elseif (zn == 4) then
    door_in("shop_1i")
  elseif (zn == 5) then
    door_out("shop_1o")
  elseif (zn == 6) then
    door_in("room_1i")
  elseif (zn == 7) then
    door_out("room_1o")
  elseif (zn == 8) then
    door_in("shop_2i")
  elseif (zn == 9) then
    door_out("shop_2o")
  elseif (zn == 10) then
    door_in("room_4i")
  elseif (zn == 11) then
    door_out("room_4o")
  elseif (zn == 12) then
    door_in("shop_3i")
  elseif (zn == 13) then
    door_out("shop_3o")
  elseif (zn == 14) then
    bubble(200, "Locked.")
  elseif (zn == 15) then
    inn("Riverside Inn", 35, 1)
  elseif (zn == 16) then
    shop(6)
  elseif (zn == 17) then
    shop(7)
  elseif (zn == 18) then
    shop(8)
  elseif (zn == 19) then
    shop(9)
  elseif (zn == 20) then
    door_in("shop_4i")
  elseif (zn == 21) then
    door_out("shop_4o")
  elseif (zn == 22) then
    chest(12, 0, 1)
    refresh()
  elseif (zn == 23) then
    chest(14, 115, 1)
  elseif (zn == 24) then
    book_talk(party[0])
  elseif (zn == 25) then
    chest(13, 46, 1)
  elseif (zn == 26) then
    bubble(200, "Various books about magic.")
  elseif (zn == 27) then
    bubble(200, "The art of battle-magic.")
  elseif (zn == 28) then
    bubble(200, "How magic can make you rich!")
  elseif (zn == 29) then
    bubble(200, "Ten reasons why you should never call a wizard 'pencil-neck'.")
  elseif (zn == 30) then
    touch_fire(party[0])
  elseif (zn == 31) then
    bubble(200, "Inns always have boring books.")
  elseif (zn == 32) then
    chest(99, 146, 1)
    refresh()
  elseif (zn == 33) then
    bubble(200, "The barrel is empty.")
  elseif (zn == 34) then
    chest(100, 0, 200)
    refresh()
  end
end
function LOC_talk_oldguy(en)
  if (get_progress(17) == 0) then
    bubble(en, "To the north of here is a temple. It is nearly impenetrable from the outside, even to Malkaron's armies.")
    bubble(en, "However, monsters have somehow appeared INSIDE the temple. They need help in any way possible.")
    bubble(200, "I can probably help. What can I do?")
    bubble(en, "I hear that the monsters are coming through a portal in the caves under the temple. Seal it up to stop the monsters.")
    bubble(200, "How do I seal the portal?")
    bubble(en, "I don't know. You should ask someone in the temple.")
  elseif (get_progress(17) == 1) then
    bubble(en, "Use that Goblin Item to seal the portal in the temple.")
  else
    bubble(en, "Good work in the temple! We thank you most graciously!")
  end
end -- LOC_talk_oldguy
function LOC_talk_tsorin(en)
  if (get_progress(108) == 0) then
    bubble(en, "Tsorin:", "Thank you for visiting our town. What do you need?")
    bubble(200, "I'm not sure. To get through the pass to the south, I guess.")
    bubble(en, "I'm afraid I cannot allow that. There is a civil upheaval in the Goblin Lands and so cannot allow anyone to pass.")
    if (get_numchrs() == 1) then
      bubble(200, "I'm pretty sure I need to get through there.")
    else
      bubble(200, "We're pretty sure we need to get through there.")
    end
    msg("Tsorin eyes you warily.", 255, 0)
    bubble(en, "Well, I have to know if I can trust you first. Here, take this note to Derig.")
    msg("Tsorin hands you an envelope with his seal on it.", 18, 0)
    bubble(en, "He lives back in Ekla, and if he says you can pass, I shall let you pass.")
    set_progress(108, 1)
  elseif (get_progress(108) == 1) then
    bubble(en, "If you have trouble finding Derig, ask around town. Someone's bound to know where he's wandered off to.")
  elseif (get_progress(108) == 2) then
    msg("You hand the note to Tsorin.", 18, 0)
    bubble(en, "Hmm, I see. Since Derig says you are trustworthy, I can let you pass through the fort.")
    if (get_numchrs() == 1) then
      bubble(200, "Can you tell me why I need this security clearance?")
    else
      bubble(200, "Can you tell us why we need this security clearance?")
    end
    bubble(en, "The Oracle's Statue was stolen from a village shrine south of here. It caused such problems that civil war has ensued. As a safety to our citizens, we have closed the border to try to capture the thief or thieves.")
    if (get_numchrs() == 1) then
      bubble(200, "If you want, I can help find this missing statue.")
    else
      bubble(200, "If you want, we can help you find this missing statue.")
    end
    bubble(en, "That would be wonderful! Find the Oracle to the south and ask her what she would like you to do.")
    bubble(en, "Present this Seal to the guards, and tell them that you're acting with my authority.")
    msg("Tsorin's Seal procured!", 25, 0)
    bubble(en, "I'm fear I cannot send anyone to protect you - you must take the utmost care.")
    set_progress(108, 3)
  elseif (get_progress(108) == 3) then
    bubble(en, "You can find the Oracle to the south. She will help you find this missing statue.")
  elseif (get_progress(108) == 4) then
    bubble(en, "Thank you for all you've done.")
  end
end -- LOC_talk_tsorin