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
|
function script HalloweenQuestWaterPumpkins {
if (Quest_Halloween != 5 || $@HalloweenQuest_PumpkinHunter$ != "")
goto L_Return;
$@HalloweenQuest_PumpkinHunter$ = strcharinfo(0);
donpcevent "Oscar::OnCommandSpg";
goto L_Return;
L_Return:
return;
}
011-1,94,38,0 script Oscar NPC142,{
// Check we are at the good time of the year
if (!(gettime(6) == 11 && (gettime(5) >= 4 && gettime(5) <= 30))) goto L_NoEvent;
// Check halloween quest has been done or not.
@halloween_year = (Annual_Quest & BYTE_0_MASK) >> BYTE_0_SHIFT;
if (@halloween_year < (gettime(7) - 2000)) goto L_AdjustYear;
goto L_Init;
L_AdjustYear:
Quest_Halloween = 0;
@halloween_year = gettime(7) - 2000;
callsub S_Update_Annual_Quest;
goto L_Init;
L_NoEvent:
mes "[Oscar]";
mes "\"Welcome here!";
mes "I'm the owner of this farm. I'm growing fruits around here as you can see.\"";
next;
mes "\"Some of my fruits are for sale in my shop right here.";
mes "Don't hesitate to drop by. They are cheap!\"";
close;
L_Init:
if (@halloween_year == (gettime(7) - 2000) + 1) goto L_QuestAlreadyDone;
if (Quest_Halloween == 0) goto L_Introduce;
if (Quest_Halloween == 1 || Quest_Halloween == 2) goto L_CheckSeeds;
if (Quest_Halloween == 3) goto L_HelpGrowSeeds;
if (Quest_Halloween == 4) goto L_HelpFillWaters;
if (Quest_Halloween == 5 && $@HalloweenQuest_PumpkinHunter$ == "") goto L_HelpWaterPatches;
if (Quest_Halloween == 5 && $@HalloweenQuest_PumpkinHunter$ == strcharinfo(0)) goto L_HelpCleanPumpkins;
if (Quest_Halloween == 5 && $@HalloweenQuest_PumpkinHunter$ != "") goto L_WateringBusy;
if (Quest_Halloween == 6) goto L_GetReward;
if (Quest_Halloween == 10) goto L_GetSlap;
goto L_End;
L_Introduce:
mes "[Oscar]";
mes "\"Heya!\"";
next;
mes "\"I just came back from a long trip... Really tiring, but so interesting.\"";
menu
"Oh? Where did you go?", L_Next,
"Well... I believe.", L_End;
L_Next:
mes "[Oscar]";
mes "\"Well, I travelled to the economic center of this continent.";
mes "It's north-east of here. Quite far I must say.\"";
next;
mes "\"But it was worth it really.";
mes "I went there to see ways to improve my little plantation here.";
mes "Oh well, sell some of my fruits too, see some of my fellow farmers. Classic business.\"";
next;
mes "\"Until a few days ago, they were holding a large party to celebrate Halloween.";
mes "Very nice really... And in particular, I saw these strange veggies they call pumpkins.\"";
next;
mes "\"They taste really good you see, but ahah, they weren't really for eating at that moment!";
mes "Anyway, I wondered if I could grow some here. Until now I only grow apples and oranges.\"";
menu
"That's an interesting idea!", L_Next1,
"Really, I hate pumpkins.", L_End;
L_Next1:
mes "[Oscar]";
mes "\"However, I couldn't get any seeds, but I heard rumors in that city, saying we could find pumpkins in the forests north-east of here.";
mes "Most likely there are pumpkin seeds laying around them.\"";
next;
mes "\"They also mentioned something strange about them, but hey, who cares! Just rumors!\"";
next;
if (BaseLevel < 45)
goto L_TooYoung;
mes "\"Do you think you can get some for me?\"";
menu
"Sure. Leave it to me!", L_Next2,
"Well, I don't have time for that right now.", L_End;
L_Next2:
mes "[Oscar]";
mes "\"Thanks so much " + strcharinfo(0) + "!";
mes "I can't wait to try them!\"";
Quest_Halloween = 1;
goto L_End;
L_TooYoung:
mes "\"Ahm... That may be a little dangerous for you though. I don't want to send a kid in the deep forest.\"";
goto L_End;
L_End:
@halloween_year = 0;
close;
L_CheckSeeds:
if (countitem("PumpkinSeeds") < $@halloween_num_seeds)
goto L_NotEnoughSeeds;
delitem "PumpkinSeeds", $@halloween_num_seeds;
Quest_Halloween = 3;
mes "[Oscar]";
mes "\"Yes you found them! I can start to make them grow now!";
mes "Thank you so much " + strcharinfo(0) + "!\"";
goto L_End;
L_NotEnoughSeeds:
mes "[Oscar]";
mes "\"Oh, it looks like you didn't find enough seeds yet...\"";
goto L_End;
L_HelpGrowSeeds:
// Wait 20 seconds before triggering the next step.
if (@halloween_seeds_timer == 0)
@halloween_seeds_timer = gettimetick(2);
if ((gettimetick(2) - @halloween_seeds_timer) < 5)
goto L_WaitGrowSeeds;
mes "[Oscar]";
mes "\"Oh, you are back!\"";
next;
mes "You notice Oscar looks quite disappointed.";
next;
mes "[Oscar]";
mes "\"You see I could use some more help from you.";
mes "My supplies of water are quite low because of the long trip I made.";
mes "And I've been watering the pumpkin patches, but unfortunately I'm already out of water before I can see anything growing.\"";
next;
mes "\"If you could help me fill these " + $@halloween_num_water_bottles + " bottles with water, that would be very kind of you!\"";
@nature_magic = getskilllv(SKILL_MAGIC_NATURE);
if (@nature_magic > 1)
goto L_ProposeUseKaflosh;
@nature_magic = 0;
menu
"Yeah sure!", L_Next3,
"That sounds boring to do. No thanks.", L_End;
L_Next3:
getinventorylist;
if (@inventorylist_count == 100 && countitem("EmptyBottle") == 0)
goto L_InventoryFull;
@inventorylist_count = 0;
Quest_Halloween = 4;
goto L_GetEmptyBottles;
L_ProposeUseKaflosh:
@nature_magic = 0;
menu
"Yeah sure!", L_Next4,
"Maybe I can help you water them with magic!", L_WaterWithKaflosh,
"That sounds boring to do. No thanks.", L_End;
L_Next4:
getinventorylist;
if (@inventorylist_count == 100 && countitem("EmptyBottle") == 0)
goto L_InventoryFull;
Quest_Halloween = 4;
goto L_GetEmptyBottles;
L_GetEmptyBottles:
mes "[Oscar]";
mes "\"Ok, here are the " + $@halloween_num_water_bottles + " empty bottles.\"";
next;
mes "\"Oh and while you fill these bottles, why not bring some friends here as well?";
mes "Let's not be reckless. Maybe these rumors about the pumpkins are true.";
mes "Oh, unless you consider yourself strong enough to take care of this alone!\"";
getitem "EmptyBottle", $@halloween_num_water_bottles;
goto L_End;
L_WaitGrowSeeds:
mes "[Oscar]";
mes "\"Thanks again " + strcharinfo(0) + "!";
mes "I'm planting these seeds right now.\"";
next;
mes "\"Stay around if you want to see what it looks like!";
mes "Amazing I tell you, amazing!\"";
goto L_End;
L_HelpFillWaters:
mes "[Oscar]";
mes "\"Hey, you again!\"";
next;
if ($@HalloweenQuest_PumpkinHunter$ != "")
goto L_WateringBusy;
mes "\"So do you have the " + $@halloween_num_water_bottles + " bottles filled with fresh water?\"";
menu
"Yes! Fresh and clear water.", L_Next5,
"Oh, not yet. I'm on my way.", L_End;
L_Next5:
if (countitem("BottleOfWater") < $@halloween_num_water_bottles)
goto L_NotEnoughWaters;
// make an additional check here, since the player had a dialog pause in the above menu.
if ($@HalloweenQuest_PumpkinHunter$ != "")
goto L_WateringBusy;
delitem "BottleOfWater", $@halloween_num_water_bottles;
mes "[Oscar]";
mes "\"Many thanks! I wonder what I would have done without you!";
mes "I'll water the patches right away. Watch this!\"";
Quest_Halloween = 5;
$@HalloweenQuest_PumpkinHunter$ = strcharinfo(0);
callsub S_StartPumpkinsSpawn;
goto L_End;
L_WaterWithKaflosh:
getinventorylist;
if (@inventorylist_count == 100 && countitem("BottleOfWater") == 0)
goto L_InventoryFull;
mes "[Oscar]";
mes "\"Oh, I see!";
next;
mes "\"So, I'm waiting you show me your skills!";
mes "Water the pumpkin patches right here with your awesome magic!\"";
next;
mes "\"Here is one bottle of water to do it.\"";
next;
mes "\"By the way, I told you about the rumors concerning these pumpkins.";
mes "Why not bring some friends here? Oh, unless you consider yourself strong enough!\"";
Quest_Halloween = 5;
getitem "BottleOfWater", 1;
goto L_End;
L_HelpWaterPatches:
// We check again here that the player has magic skills
// This case happens when the player has logged off
// during the infestation phase.
@nature_magic = getskilllv(SKILL_MAGIC_NATURE);
if (!(@nature_magic > 1))
goto L_HelpFillWaters;
@nature_magic = 0;
mes "[Oscar]";
mes "\"Come on, water the pumpkin patches right here with your awesome magic!";
mes "For sure you will be more efficient than me!\"";
goto L_End;
L_WateringBusy:
mes "[Oscar]";
mes "\"Sorry. I'm really busy at the moment.";
mes "May you come back later? Thank you, thank you...";
mes "Sorry I have to take care of this now!\"";
goto L_End;
L_HelpCleanPumpkins:
mes "[Oscar]";
mes "\"Help me clean all these pumpkins! It's a disaster!\"";
goto L_End;
L_NotEnoughWaters:
mes "[Oscar]";
mes "\"That's not enough bottles to water all these pumpkin patches.";
mes "Please bring me more.\"";
goto L_End;
S_Update_Annual_Quest:
Annual_Quest = (Annual_Quest & ~(BYTE_0_MASK) | (@halloween_year << BYTE_0_SHIFT));
return;
OnCommandSpg:
callsub S_StartPumpkinsSpawn;
end;
S_StartPumpkinsSpawn:
$@HalloweenQuest_PumpkinsCount = $@halloween_num_pumpkins;
$@HalloweenQuest_PumpkinsState = 0;
initnpctimer;
return;
L_QuestAlreadyDone:
mes "[Oscar]";
mes "\"I'm relieved all this mess is sorted out now.";
mes "That was interesting, but really, fruits are more quiet!\"";
goto L_End;
OnInit:
$@halloween_num_seeds = 12;
$@halloween_num_water_bottles = 15;
$@halloween_num_pumpkins = $@halloween_num_seeds * 4;
end;
OnTimer1000:
goto L_TimerFunction;
OnTimer2000:
goto L_TimerFunction;
OnTimer3000:
goto L_TimerFunction;
L_TimerFunction:
if ($@HalloweenQuest_PumpkinsState != 1)
end;
callsub S_CheckPlayer;
$@HalloweenQuest_PumpkinsTimer = $@HalloweenQuest_PumpkinsTimer + 1;
if (mobcount("011-1", "Oscar::OnPD") <= 0 &&
mobcount("011-1", "Oscar::OnPDP") <= 0 &&
$@HalloweenQuest_PumpkinsCount <= 0)
goto L_AllPumpkinsDead;
// A quick "cheer up"
if ($@HalloweenQuest_PumpkinsTimer == 300)
npctalk strnpcinfo(0), "Hurry up " + $@HalloweenQuest_PumpkinHunter$ + "! My farm is being ruined!";
// 7 mins max
if ($@HalloweenQuest_PumpkinsTimer > 420)
goto L_PumpkinsRuined;
if (getnpctimer(0) >= 2900)
goto L_TrySpawnPumpkin;
end;
L_TrySpawnPumpkin:
if ($@HalloweenQuest_PumpkinsCount > 0)
areamonster "011-1", 97, 40, 101, 44, "", 1063, 1, "Oscar::OnPD";
setnpctimer 0;
end;
OnTimer2500:
if ($@HalloweenQuest_PumpkinsState != 0)
end;
areamonster "011-1", 97, 40, 101, 44, "", 1063, 2, "Oscar::OnPD";
end;
OnTimer6000:
if ($@HalloweenQuest_PumpkinsState != 0)
end;
emotion EMOTE_AFRAID;
npctalk strnpcinfo(0), "Oh no, these pumpkins look strange and infested with bugs! Help me get rid of them " + $@HalloweenQuest_PumpkinHunter$ + "!";
$@HalloweenQuest_PumpkinsState = 1;
setnpctimer 0;
end;
OnPD:
if (strcharinfo(0) != $@HalloweenQuest_PumpkinHunter$)
goto L_KillBadHunter;
$@HalloweenQuest_PumpkinsCount = $@HalloweenQuest_PumpkinsCount - 1;
if (@discover_poisonous_pumpkin_again == 0)
message strcharinfo(0), "Oh no! These pumpkins are poisonous as well!";
@discover_poisonous_pumpkin_again = 1;
// Small damages
misceffect FX_PUMPKIN_EXPLOSION, strcharinfo(0);
heal -10, 0;
sc_start SC_POISON, 1, 3;
// Spawn mobs or get items
@halloween_rand = rand(0,100);
// Seeds reward
if (@halloween_rand < 10)
getitem "PumpkinSeeds", 1;
// Pumpkin helmet reward
if (@halloween_rand >= 10 && @halloween_rand < 17)
getitem "PumpkinHelmet", 1;
// huntsman spider x1
if (@halloween_rand < (15*BaseLevel)/100)
areamonster "011-1", 97, 40, 101, 44, "", 1083, 1, "Oscar::OnPDP";
// Or spider x1
if (@halloween_rand >= (15*BaseLevel)/100 && @halloween_rand < (75*BaseLevel)/100)
areamonster "011-1", 97, 40, 101, 44, "", 1012, 1, "Oscar::OnPDP";
// Or archant x2
if (@halloween_rand >= (75*BaseLevel)/100)
areamonster "011-1", 97, 40, 101, 44, "", 1060, 2, "Oscar::OnPDP";
@halloween_rand = 0;
end;
OnPDP:
end;
L_KillBadHunter:
misceffect FX_PUMPKIN_EXPLOSION, strcharinfo(0);
heal -Hp, 0;
end;
L_PumpkinsRuined:
npctalk strnpcinfo(0), "No! " + $@HalloweenQuest_PumpkinHunter$ + " how could you let that happen? All my farm is a mess now! All my trees are infested with bugs!";
goto L_Fail;
L_AllPumpkinsDead:
goto L_Success;
S_CheckPlayer:
if (attachrid(getcharid(3, $@HalloweenQuest_PumpkinHunter$)) == 0)
goto L_PlayerOff;
if (ispcdead())
goto L_PlayerDead;
if (isin("011-1",20,5,130,110) == 0)
goto L_PlayerLeft;
detachrid;
return;
L_PlayerOff:
npctalk strnpcinfo(0), "What? Where is " + $@HalloweenQuest_PumpkinHunter$ + "? Someone, help me!";
goto L_Fail;
L_PlayerLeft:
npctalk strnpcinfo(0), "What the!! " + $@HalloweenQuest_PumpkinHunter$ + " left me alone with all this! Someone, help me!";
goto L_Fail;
L_PlayerDead:
npctalk strnpcinfo(0), "Oh no I can't believe it! " + $@HalloweenQuest_PumpkinHunter$ + " just died! Someone, help me!";
goto L_Fail;
L_Fail:
// If the player is logged off, since we check every second that the player
// is online, we can consider it's an accident, so we will allow to redo the quest
// Otherwise, it's a "valid" fail.
if (attachrid(getcharid(3, $@HalloweenQuest_PumpkinHunter$)))
Quest_Halloween = 10;
goto L_Clean;
L_Success:
// Make this check again or the server will crash.
if (attachrid(getcharid(3, $@HalloweenQuest_PumpkinHunter$)) == 0)
goto L_PlayerOff;
Quest_Halloween = 6;
emotion EMOTE_GRIN;
npctalk strnpcinfo(0), "Hurray, " + $@HalloweenQuest_PumpkinHunter$ + " you did it! Thank you thank you! Come here!";
goto L_Clean;
L_Clean:
killmonster "011-1", "Oscar::OnPD";
killmonster "011-1", "Oscar::OnPDP";
$@HalloweenQuest_PumpkinHunter$ = "";
$@HalloweenQuest_PumpkinsCount = 0;
$@HalloweenQuest_PumpkinsState = 0;
$@HalloweenQuest_PumpkinsTimer = 0;
stopnpctimer;
detachrid;
end;
L_GetReward:
mes "[Oscar]";
mes "\"" + strcharinfo(0) + ", you were wonderful!";
mes "My farm is safe thanks to you!\"";
next;
mes "\"Look, when I went to this city a few days ago, I could find this magnificient fruit.";
mes "I believe not many exist in the world, but hey, this one is for you!\"";
getinventorylist;
if (@inventorylist_count == 100 && countitem("GoldenDeliciousApple") == 0)
goto L_InventoryFull;
@inventorylist_count = 0;
getitem "GoldenDeliciousApple", 1;
@halloween_year = gettime(7) - 2000 + 1;
Quest_Halloween = 0;
callsub S_Update_Annual_Quest;
goto L_End;
L_GetSlap:
mes "[Oscar]";
mes "\"Ah! There you are "+strcharinfo(0)+"!";
next;
mes "\"As you can see, my farm is safe now.";
mes "I can't really say it's thanks to you though!\"";
next;
mes "\"Well, I won't be a bad guy.";
mes "Take this for your trouble and farewell!\"";
getinventorylist;
if (@inventorylist_count == 100 && countitem("CandyPumpkin") == 0)
goto L_InventoryFull;
@inventorylist_count = 0;
getitem "CandyPumpkin", 5;
@halloween_year = gettime(7) - 2000 + 1;
Quest_Halloween = 0;
callsub S_Update_Annual_Quest;
goto L_End;
L_InventoryFull:
@inventorylist_count = 0;
next;
mes "\"Ah, but you cannot carry anything else!";
mes "Make some room first.\"";
goto L_End;
}
|