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
|
//-----------------------------------------------------------------------------
// Illia Forsaken Inn - Lobby
// $@illia_progress = 5
//
// Level progress:
// 0: Initial state
// 1: Mysterious voice is talking
// 2: Luvia is appearing
// 3: Luvia is waiting for a talk, to trigger the fight
// 4: Hero talked to Luvia. Initiating a talk and demonic spirit waves
// 5: All Demonic spirits waves are spawned
// 6: Demonic spirit waves beaten. Talk while preparing the witch guards
// 7: Luvia is escaping, Witch guards appear
// 8: Witch guards defeated. Door is open.
//-----------------------------------------------------------------------------
052-2.gat,40,19,0|script|#InnDoorTrigger|32767,2,2,
{
set @step, 5;
if ($@illia_progress < @step) goto L_ShouldNotBeHere;
if ($@illia_level_5_progress == 8) goto L_Warp;
message strcharinfo(0), "A magical field prevents you from going further...";
end;
L_Warp:
warp "052-2.gat", 23, 71;
message strcharinfo(0), "This place is full of dust... *coughs*";
end;
L_ShouldNotBeHere:
percentheal -100, 0;
end;
}
052-2.gat,33,40,0|script|#EntranceTrigger|32767,4,2,
{
set @step, 5;
if ($@illia_progress < @step) goto L_ShouldNotBeHere;
if ($@illia_level_5_progress == 0 && strcharinfo(0) == $@ILLIA_HERO$) goto L_StartVoices;
end;
L_StartVoices:
set $@illia_level_5_progress, 1;
cmdothernpc "#MysteriousVoice", "Start";
end;
L_ShouldNotBeHere:
percentheal -100, 0;
end;
}
052-2.gat,1,1,0|script|#LuviaShadow|127,
{
end;
// Escape sequence
OnCommandEscape:
initnpctimer;
end;
OnTimer100:
if ($@illia_level_5_progress != 7)
end;
npcwarp 39, 35, "#LuviaShadow";
misceffect FX_DARK_TELEPORT;
npcwarp 1, 1, "Luvia?";
end;
OnTimer750:
if ($@illia_level_5_progress != 7)
end;
npcwarp 1, 1, "#LuviaShadow";
stopnpctimer;
setnpctimer 0;
end;
// Invoke sequence
OnCommandInvoke:
initnpctimer;
end;
OnTimer650:
if ($@illia_level_5_progress != 2)
end;
npcwarp 39, 35, "#LuviaShadow";
misceffect FX_EVIL_SUMMON;
end;
OnTimer1500:
if ($@illia_level_5_progress != 2)
end;
npcwarp 1, 1, "#LuviaShadow";
npcwarp 39, 35, "Luvia?";
set $@illia_level_5_progress, 3;
stopnpctimer;
setnpctimer 0;
end;
OnNN:
message strcharinfo(0), "The last guard is down. Let's go after Luvia now!";
end;
}
052-2.gat,1,1,0|script|#MysteriousVoice|127,
{
end;
onInit:
setarray $@illia_lobby_voices$, "Finally.", "I was...", "Waiting...", "For you!";
end;
OnCommandStart:
set $@illia_lobby_voices_index, 0;
initnpctimer;
end;
// Voices loop
OnTimer2000:
if ($@illia_level_5_progress != 1)
end;
npcwarp rand(30,42), rand(32,38), "?";
cmdothernpc "?", "Talk";
end;
OnTimer3000:
if ($@illia_level_5_progress != 1)
end;
npcwarp 1, 1, "?";
set $@illia_lobby_voices_index, $@illia_lobby_voices_index + 1;
// FIXME Uncomment next line, comment the next next, when getarraysize is repaired.
//if ($@illia_lobby_voices_index < getarraysize($@illia_lobby_voices$)) goto L_Continue;
if ($@illia_lobby_voices_index < 4)
goto L_Continue;
// End the process
stopnpctimer;
setnpctimer 0;
set $@illia_lobby_voices_index, 0;
set $@illia_level_5_progress, 2;
cmdothernpc "#LuviaShadow", "Invoke";
end;
L_Continue:
setnpctimer 0;
end;
}
// Dummy npc to display the mysterious voice,
// as a workaround to fakenpcname causing problems
052-2.gat,1,1,0|script|?|127,
{
end;
OnCommandTalk:
npctalk $@illia_lobby_voices$[$@illia_lobby_voices_index];
end;
}
052-2.gat,1,1,0|script|Luvia?|371,2,2
{
if ($@illia_level_5_progress != 3) end;
if (isin("052-2.gat", 37,36, 41,39)) goto L_HandleTalk;
// Notify too far
mes "You see a strange and frightening, yet beautiful woman.";
if (strcharinfo(0) == $@ILLIA_HERO$)
mes "Maybe she knows something about this place.";
close;
L_HandleTalk:
if (strcharinfo(0) == $@ILLIA_HERO$)
goto L_TalkToHero;
goto L_TalkToHelper;
end;
L_TalkToHelper:
mes "She gives you a quick look then gives her attention to " + $@ILLIA_HERO$ + ".";
close;
L_TalkToHero:
menu
"Are you Luvia? Your sister Valia sent me to save you! Where is Ismuth?", -;
set $@illia_level_5_progress, 4;
initnpctimer;
close;
// Talk sequence timers
OnTimer1500:
if ($@illia_level_5_progress != 4)
end;
npctalk "Yes " + $@ILLIA_HERO$ + ", I am Luvia.";
end;
OnTimer4500:
if ($@illia_level_5_progress != 4)
end;
npctalk "How nice of all of you to have come to save me!";
end;
OnTimer7500:
if ($@illia_level_5_progress != 4)
end;
npctalk "But I fear...";
end;
OnTimer10500:
if ($@illia_level_5_progress != 4)
end;
npctalk "... that you are mistaken about who has to be saved!";
end;
OnTimer13500:
if ($@illia_level_5_progress != 4)
end;
npctalk "Don't make these faces...";
end;
OnTimer16500:
if ($@illia_level_5_progress != 4)
end;
npctalk "Valia is just helping me by sending new soldiers for my personal army!";
end;
OnTimer21500:
if ($@illia_level_5_progress != 4)
end;
npctalk "So, if I may... Let's see what you are made of!";
end;
// Monster invokes timers
OnTimer24500:
if ($@illia_level_5_progress != 4)
end;
npctalk "Demonotis!";
misceffect FX_EVIL_SUMMON;
callsub S_GetHeroRect;
areamonster "052-2.gat", $@illia_lobby_x1, $@illia_lobby_y1, $@illia_lobby_x2, $@illia_lobby_y2, "", 1101, 20 + 16 - 480/(30+$Illia_Luvia_Harvest), "Luvia?::onDSDeath";
callsub S_ClearHeroRect;
end;
OnTimer44000:
if ($@illia_level_5_progress != 4)
end;
npctalk "Demonotis!";
misceffect FX_EVIL_SUMMON;
callsub S_GetHeroRect;
areamonster "052-2.gat", $@illia_lobby_x1, $@illia_lobby_y1, $@illia_lobby_x2, $@illia_lobby_y2, "", 1101, 28 + 16 - 480/(30+$Illia_Luvia_Harvest), "Luvia?::onDSDeath";
callsub S_ClearHeroRect;
end;
OnTimer77000:
if ($@illia_level_5_progress != 4)
end;
npctalk "Demonotis!";
misceffect FX_EVIL_SUMMON;
callsub S_GetHeroRect;
areamonster "052-2.gat", $@illia_lobby_x1, $@illia_lobby_y1, $@illia_lobby_x2, $@illia_lobby_y2, "", 1101, 42 + 16 - 480/(30+$Illia_Luvia_Harvest), "Luvia?::onDSDeath";
callsub S_ClearHeroRect;
// That was the last spawn: reset the timer to start the CheckInvoke loop.
set $@illia_level_5_progress, 5;
setnpctimer 0;
end;
// Talk and Witch guard invokes timers
OnTimer6500:
if ($@illia_level_5_progress != 6)
end;
npctalk "Okay. You have some skill.";
end;
OnTimer10000:
if ($@illia_level_5_progress != 6)
end;
npctalk "But that was only the beginning!";
end;
OnTimer13000:
if ($@illia_level_5_progress != 6)
end;
npctalk "I'll leave you in the good hands of your predecessors. Farewell!";
end;
OnTimer18500:
if ($@illia_level_5_progress != 6)
end;
npctalk "Demonotis Major!";
misceffect FX_EVIL_SUMMON;
misceffect FX_MAGIC_DARK_EXPLOSION;
callsub S_GetHeroRect;
areamonster "052-2.gat", $@illia_lobby_x1, $@illia_lobby_y1, $@illia_lobby_x2, $@illia_lobby_y2, "", 1103, 8 + (16 - 480/(30+$Illia_Luvia_Harvest))/3, "Luvia?::onWGDeath";
callsub S_ClearHeroRect;
end;
OnTimer20000:
if ($@illia_level_5_progress != 6)
end;
set $@illia_level_5_progress, 7;
cmdothernpc "#LuviaShadow", "Escape";
setnpctimer 0;
end;
// Monsters checks timer loop
OnTimer2000:
if ($@illia_progress != 5)
goto L_Clear;
if ($@illia_level_5_progress != 5 && $@illia_level_5_progress != 7)
end;
setnpctimer 0;
// Mock players randomly (more or less once every 40 secs) and if still enough mobs running after them
if ($@illia_level_5_progress == 5 && rand(20) == 0 && (mobcount("052-2.gat", "Luvia?::onDSDeath") > 20))
npctalk "Ahaha! Run... Run!";
if ($@illia_level_5_progress == 5 && (mobcount("052-2.gat", "Luvia?::onDSDeath") < 0))
goto L_AllWavesClear;
if ($@illia_level_5_progress == 7 && (mobcount("052-2.gat", "Luvia?::onWGDeath") < 0))
goto L_AllWavesClear;
end;
L_Clear:
stopnpctimer;
setnpctimer 0;
killmonster "052-2.gat", "Luvia?::onDSDeath";
killmonster "052-2.gat", "Luvia?::onWGDeath";
end;
L_AllWavesClear:
set $@illia_level_5_progress, $@illia_level_5_progress + 1;
stopnpctimer;
setnpctimer 0;
if ($@illia_level_5_progress == 6)
startnpctimer;
if ($@illia_level_5_progress == 8)
goto L_ChaseLuvia;
end;
L_ChaseLuvia:
set $@illia_progress, 6;
callfunc "UpdateIlliaProgress";
set $@illia_max_time, $@illia_max_time + 600;
areatimer "052-2.gat", 19, 18, 48, 43, 2000, "#LuviaShadow::OnNN";
end;
S_GetHeroRect:
if (isloggedin($@ILLIA_HERO_ID) == 0)
goto L_Clear;
attachrid($@ILLIA_HERO_ID);
set $@illia_lobby_x, getx();
set $@illia_lobby_y, gety();
set $@illia_lobby_x1, $@illia_lobby_x - 12;
set $@illia_lobby_y1, $@illia_lobby_y - 8;
set $@illia_lobby_x2, $@illia_lobby_x + 12;
set $@illia_lobby_y2, $@illia_lobby_y + 8;
if ($@illia_lobby_x1 < 20)
set $@illia_lobby_x1, 20;
if ($@illia_lobby_y1 < 19)
set $@illia_lobby_y1, 19;
if ($@illia_lobby_x2 > 47)
set $@illia_lobby_x2, 47;
if ($@illia_lobby_y2 > 42)
set $@illia_lobby_y2, 42;
detachrid;
return;
S_ClearHeroRect:
set $@illia_lobby_x1, 0;
set $@illia_lobby_y1, 0;
set $@illia_lobby_x2, 0;
set $@illia_lobby_y2, 0;
return;
onDSDeath:
end;
onWGDeath:
end;
}
|