1 ;;----------------------------------------------------------------------------
5 ;;----------------------------------------------------------------------------
6 (define (mk-zone x y w h) (list 'p_green_tower x y w h))
7 (kern-mk-sched 'sch_deric
8 (list 0 0 (mk-zone 17 4 1 1) "sleeping")
9 (list 6 0 (mk-zone 30 30 5 5) "working")
10 (list 12 0 (mk-zone 52 54 1 1) "eating")
11 (list 13 0 (mk-zone 30 30 5 5) "working")
12 (list 18 0 (mk-zone 52 54 1 1) "eating")
13 (list 19 0 (mk-zone 30 30 5 5) "working")
14 (list 21 0 (mk-zone 13 2 4 4) "idle")
15 (list 22 0 (mk-zone 17 4 1 1) "sleeping")
18 ;;----------------------------------------------------------------------------
20 ;;----------------------------------------------------------------------------
21 (define (deric-mk tell-secret?) (list tell-secret? (mk-quest)))
22 (define (deric-tell-secret? deric) (car deric))
23 (define (deric-set-tell-secret! deric) (set-car! deric #t))
24 (define (deric-bandit-quest deric) (cadr deric))
26 ;;----------------------------------------------------------------------------
29 ;; Deric is a Captain of the Rangers in Green Tower.
30 ;;----------------------------------------------------------------------------
32 (define (deric-name knpc kpc)
33 (say knpc "I am Captain Deric, commander of the Rangers, at your service."))
35 (define (deric-job knpc kpc)
36 (say knpc "I command the Rangers, though I aspire to greater things. I "
37 "think I have proved myself quite well as a leader, but around here "
38 "you have to wait for someone to die before you get promoted!"))
40 (define (deric-health knpc kpc)
41 (say knpc "I am the very definition of good health!"))
43 (define (deric-rangers knpc kpc)
44 (say knpc "Right then! The Rangers are charged with keeping the peace in "
45 "the Great Wood. We enforce the law, keep an eye on the goblins, that "
46 "sort of thing. We're also charged with maintenance of the forest and "
47 "keeping the roads in and out clear. If I say so myself, we have done "
48 "an amazing job under my leadership. Thanks to the hard work of my "
49 "people, of course. Ahem."))
51 (define (deric-two knpc kpc)
52 (say knpc "The upper level of the tower is mostly fortifications. The lower "
53 "level is where the council chamber, barracks, kitchen and other "
54 "facilities are. We also have a prison down there. Some think the "
55 "lower level is haunted."))
57 (define (deric-haunted knpc kpc)
58 (say knpc "They say the lower level is haunted, and I for one have heard "
59 "some strange noises. They sound like they're coming from deep within "
60 "the walls - chanting, or shrieking. But I've never seen any ghosts. "
61 "And of course I am not afraid of such things!"))
63 (define (deric-gen knpc kpc)
64 (say knpc "A splendid old chap, if a bit daft. He's a legend among the "
65 "Rangers for his efforts during the Goblin War, and one of the last "
66 "surviving veterans. Still looks to be in good shape physically, but "
67 "he's gone a bit native, if you know what I mean."))
69 (define (deric-native knpc kpc)
70 (say knpc "Yes, he's adopted some of the habits of the Wood Folk - the "
71 "forest goblins. But I don't suspect him of conspiring against us - if "
72 "I did I would turn him in and perhaps get a promotion! But alas, 'tis "
75 (define (deric-shroom knpc kpc)
76 (say knpc "A nice old hag. Bit of a witch, but not any trouble. Keeps a "
77 "reagent shop in the northeast corner of town."))
79 (define (deric-abe knpc kpc)
80 (say knpc "A queer young man. Queer as in strange, you know, not that "
81 "other... well, maybe... it's hard to say. Anyway, he studies the "
82 "ruins in the southwest corner. Working for the Royal Library or some "
86 (define (deric-tower knpc kpc)
87 (say knpc "Yes, the Tower itself which gives Green Tower its name is "
88 "located in the center of town. It is my command post and headquarters "
89 "for the Rangers. A fascinating building! Did you know it is built on "
90 "the ruins of an older tower?")
91 (if (kern-conv-get-yes-no? kpc)
92 (say knpc "Interesting, eh? Not that I'm an expert on such things. "
93 "You'd have to talk with old Abe, or perhaps Shroom, to learn "
95 (say knpc "'Tis true! What is now the Tower was once only the central "
96 "spire of a very great structure that reached much higher! And "
97 "much lower as well, if young Abe is to be believed. Currently "
98 "there are only two stories.")))
100 (define (deric-ambition knpc kpc)
101 (say knpc "Yes, I am quite ambitious and not afraid to admit it! No point "
102 "sneaking about when one is ambitious, it just makes people nervous. "
103 "I wouldn't do anything immoral to advance my position, of course, "
104 "I believe too firmly in the principles of our great society. Do you "
105 "have any ambitions?")
106 (if (kern-conv-get-yes-no? kpc)
108 (say knpc "Well, enough about you! I hope someday to be a Lord. "
109 "Do you think I have a chance?")
110 (if (kern-conv-get-yes-no? kpc)
112 (say knpc "I knew it! You know, I wasn't sure if I could trust "
113 "you, but you're obviously a person of insight, so I'll "
114 "let you in on a secret.")
115 (deric-set-tell-secret! (kobj-gob-data knpc)))
116 (say knpc "[laughing] I'm sorry if I must disagree! People of "
117 "destiny are never appreciated by their fellows.")))
118 (say knpc "[sigh] So many people lead worthless, wasted lives. I'm glad "
119 "I'm not one of them!")))
121 (define (deric-secret knpc kpc)
122 (if (deric-tell-secret? (kobj-gob-data knpc))
123 (say knpc "In the lower level of the Tower there is a hidden passage. "
124 "Go down the ladder and enter the southeast supply room. "
125 "On the east wall is a secret door! "
126 "I have no idea what it was for.")
127 (say knpc "Nothing I want to tell a stranger like you!")))
129 (define (deric-afraid knpc kpc)
130 (say knpc "Of course not! Fear is the hobgoblin of little minds. "
131 "Or is it hobgoblins are the fear of little minds? "
132 "Damn, I can never remember that silly saying."))
134 (define (deric-prison knpc kpc)
135 (say knpc "Yes. Very secure. We currently only have one prisoner, "
136 "a forest goblin we caught skulking around here. "
137 "A quite vicious-looking brute, I must say. "
138 "Not that I am afraid of him. Ahem."))
140 (define (deric-gobl knpc kpc)
141 (say knpc "Sneaky fellows! Why, just the other day I caught one here in town and had him thrown into prison."))
143 (define (deric-brute knpc kpc)
144 (say knpc "Very suspicious. He obviously did not come to trade, "
145 "for he carried no merchandise. And he speaks not a lick of Common. "
146 "In fact, he refuses to say anything! Well, some time spent "
147 "underground should loosen his tongue. I'll find out what he's "
150 (define (deric-default knpc kpc)
151 (say knpc "You must ask another of that!"))
153 ;; Scan the player party looking for mercs
156 (define (deric-hail knpc kpc)
158 (define (get-ranger-merc)
159 (let ((mercs (filter (lambda (kchar)
160 (kbeing-is-npc-type? kchar 'ranger))
161 (kern-party-get-members (kern-get-player)))))
162 (cond ((null? mercs) nil)
166 (define (rm-ranger-merc)
167 (let ((kmerc (get-ranger-merc)))
168 (if (not (null? kmerc))
171 (say knpc "I'll need to re-assign that ranger to a patrol.")
172 (kern-char-leave-player kmerc)
175 (cond ((in-player-party? 'ch_nate)
176 (say knpc "I see you have apprehended the bandit leader! "
177 "Deliver him downstairs to the jailer and I will give you the "
180 (quest-data-update-with 'questentry-bandits 'captured-nate-and-talked-to-deric 1 (quest-notify nil))
182 ((has? kpc t_prisoner_receipt 1)
183 (say knpc "Putting that bandit behind bars will look very good on my "
184 "record! Here is your reward.")
185 (give-player-gold 100)
186 (kern-char-add-experience kpc 64)
187 (take kpc t_prisoner_receipt 1)
188 (quest-done! (deric-bandit-quest (kobj-gob-data knpc)) #t)
190 (quest-data-update-with 'questentry-bandits 'done 1 (grant-party-xp-fn 30))
191 (quest-data-complete 'questentry-bandits)
194 (say knpc "Well met, indeed!")
197 (define (deric-bye knpc kpc)
198 (say knpc "Until next time"))
200 (define (deric-thie knpc kpc)
201 (say knpc "Hm. The goblin brute we have locked up below may be a thief. But "
202 "he's been in our prison for some time. Now, our rangers did report "
203 "a lone man traveling north through the forest, but we know not "
204 "whence. The only thing to the north is Bole.")
205 (quest-data-update 'questentry-thiefrune 'tower 1)
206 (quest-data-update-with 'questentry-thiefrune 'bole 1 (quest-notify (grant-party-xp-fn 10)))
209 (define (deric-accu knpc kpc)
210 (say knpc "I assure you, my good man, there are no Accursed around here."))
213 (define (deric-band knpc kpc)
214 (let ((quest (deric-bandit-quest (kobj-gob-data knpc))))
215 (cond ((quest-done? quest)
216 (say knpc "I don't expect any more trouble from bandits since I "
217 "had their leader apprehended. "
218 "By you, of course. "
219 "But I had it done. "
221 ((quest-accepted? quest)
222 (say knpc "The bandits have a hideout somewhere in these "
223 "woods. Keep searching! And bring me their leader "
227 (say knpc "So you've heard of our bandit problem. "
228 "Yes, they have a secret hideout somewhere in these woods. "
229 "I would have flushed them out long ago, "
230 "but I haven't the men to spare. You understand. ")
233 "Say, you seem like a plucky sort. "
234 "If you capture the bandit leader and bring him here I'll "
235 "gladly reward you for your trouble. What do you say?")
238 (quest-accepted! quest #t)
239 (say knpc "Good! You may need some help. "
240 "[He gives you a parchment]."
241 "These orders will temporarily assign one of my Rangers "
242 "to you. Just ask one to join your party.")
243 (give kpc t_ranger_orders 1)
244 (quest-data-update-with 'questentry-bandits 'talked-to-deric 1 (quest-notify nil))
246 (say knpc "You'll never gain a reputation that way!")))
251 (ifc green-tower-conv
252 (method 'abe deric-abe)
253 (method 'afra deric-afraid)
254 (method 'ambi deric-ambition)
255 (method 'aspi deric-ambition)
256 (method 'band deric-band)
257 (method 'brut deric-brute)
258 (method 'bye deric-bye)
259 (method 'comm deric-rangers)
260 (method 'default deric-default)
261 (method 'die deric-ambition)
262 (method 'gen deric-gen)
263 (method 'hail deric-hail)
264 (method 'haun deric-haunted)
265 (method 'heal deric-health)
266 (method 'job deric-job)
267 (method 'name deric-name)
268 (method 'nati deric-native)
269 (method 'pris deric-prison)
270 (method 'prom deric-ambition)
271 (method 'rang deric-rangers)
272 (method 'secr deric-secret)
273 (method 'shro deric-shroom)
274 (method 'skul deric-brute)
275 (method 'stor deric-two)
276 (method 'thie deric-thie)
277 (method 'towe deric-tower)
278 (method 'two deric-two)
279 (method 'gobl deric-gobl)
282 (define (mk-deric tag)
284 (kern-mk-char tag ; tag
288 s_ranger_captain ; sprite
289 faction-men ; starting alignment
293 max-health -1 max-health 0 4 ; hp/xp/mp/AP_per_turn/lvl
297 'townsman-ai ;; special ai