summaryrefslogtreecommitdiff
path: root/npc/052-2/lobby.txt
blob: 48fdac032b85643cf7d84da9b43cccabfd1bbb34 (plain) (blame)
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
052-2,40,19,0	script	#InnDoorTrigger	NPC32767,2,2,{
    @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", 23, 71;
    message strcharinfo(0), "This place is full of dust... *coughs*";
    end;

L_ShouldNotBeHere:
    heal -100, 0;
    end;

}

052-2,33,40,0	script	#EntranceTrigger	NPC32767,4,2,{
    @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:
    $@illia_level_5_progress = 1;
    donpcevent "#MysteriousVoice::OnCommandStart";
    end;

L_ShouldNotBeHere:
    heal -100, 0;
    end;
}

052-2,1,1,0	script	#LuviaShadow	NPC127,{
end;

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;

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?";
    $@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,1,1,0	script	#MysteriousVoice	NPC127,{
end;

OnInit:
    setarray $@illia_lobby_voices$, "Finally.", "I was...", "Waiting...", "For you!";
    end;

OnCommandStart:
    $@illia_lobby_voices_index = 0;
    initnpctimer;
    end;

OnTimer2000:
    if ($@illia_level_5_progress != 1)
        end;
    npcwarp rand(30,42), rand(32,38), "?";
    donpcevent "?::OnCommandTalk";
    end;

OnTimer3000:
    if ($@illia_level_5_progress != 1)
        end;
    npcwarp 1, 1, "?";
    $@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;
    $@illia_lobby_voices_index = 0;
    $@illia_level_5_progress = 2;
    donpcevent "#LuviaShadow::OnCommandInvoke";
    end;

L_Continue:
    setnpctimer 0;
    end;

}

052-2,1,1,0	script	?	NPC127,{
end;

OnCommandTalk:
    npctalk strnpcinfo(0), $@illia_lobby_voices$[$@illia_lobby_voices_index];
    end;

}

052-2,1,1,0	script	Luvia?	NPC371,2,2,{
    if ($@illia_level_5_progress != 3) end;
    if (isin("052-2", 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;

L_TalkToHelper:
    mes "She gives you a quick look then gives her attention to " + $@iLLIA_HERO$ + ".";
    close;

L_TalkToHero:
    mes "Are you Luvia? Your sister Valia sent me to save you! Where is Ismuth?";
    next;
    $@illia_level_5_progress = 4;
    initnpctimer;
    close;

OnTimer1500:
    if ($@illia_level_5_progress != 4)
        end;
    npctalk strnpcinfo(0), "Yes " + $@iLLIA_HERO$ + ", I am Luvia.";
    end;

OnTimer4500:
    if ($@illia_level_5_progress != 4)
        end;
    npctalk strnpcinfo(0), "How nice of all of you to have come to save me!";
    end;

OnTimer7500:
    if ($@illia_level_5_progress != 4)
        end;
    npctalk strnpcinfo(0), "But I fear...";
    end;

OnTimer10500:
    if ($@illia_level_5_progress != 4)
        end;
    npctalk strnpcinfo(0), "... that you are mistaken about who has to be saved!";
    end;

OnTimer13500:
    if ($@illia_level_5_progress != 4)
        end;
    npctalk strnpcinfo(0), "Don't make these faces...";
    end;

OnTimer16500:
    if ($@illia_level_5_progress != 4)
        end;
    npctalk strnpcinfo(0), "Valia is just helping me by sending new soldiers for my personal army!";
    end;

OnTimer21500:
    if ($@illia_level_5_progress != 4)
        end;
    npctalk strnpcinfo(0), "So, if I may... Let's see what you are made of!";
    end;

OnTimer24500:
    if ($@illia_level_5_progress != 4)
        end;
    npctalk strnpcinfo(0), "Demonotis!";
    misceffect FX_EVIL_SUMMON;
    callsub S_GetHeroRect;
    areamonster "052-2", $@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 strnpcinfo(0), "Demonotis!";
    misceffect FX_EVIL_SUMMON;
    callsub S_GetHeroRect;
    areamonster "052-2", $@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 strnpcinfo(0), "Demonotis!";
    misceffect FX_EVIL_SUMMON;
    callsub S_GetHeroRect;
    areamonster "052-2", $@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.
    $@illia_level_5_progress = 5;
    setnpctimer 0;
    end;

OnTimer6500:
    if ($@illia_level_5_progress != 6)
        end;
    npctalk strnpcinfo(0), "Okay. You have some skill.";
    end;

OnTimer10000:
    if ($@illia_level_5_progress != 6)
        end;
    npctalk strnpcinfo(0), "But that was only the beginning!";
    end;

OnTimer13000:
    if ($@illia_level_5_progress != 6)
        end;
    npctalk strnpcinfo(0), "I'll leave you in the good hands of your predecessors. Farewell!";
    end;

OnTimer18500:
    if ($@illia_level_5_progress != 6)
        end;
    npctalk strnpcinfo(0), "Demonotis Major!";
    misceffect FX_EVIL_SUMMON;
    misceffect FX_MAGIC_DARK_EXPLOSION;
    callsub S_GetHeroRect;
    areamonster "052-2", $@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;
    $@illia_level_5_progress = 7;
    donpcevent "#LuviaShadow::OnCommandEscape";
    setnpctimer 0;
    end;

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", "Luvia?::OnDSDeath") > 20))
        npctalk strnpcinfo(0), "Ahaha! Run... Run!";
    if ($@illia_level_5_progress == 5 && (mobcount("052-2", "Luvia?::OnDSDeath") < 0))
        goto L_AllWavesClear;
    if ($@illia_level_5_progress == 7 && (mobcount("052-2", "Luvia?::OnWGDeath") < 0))
        goto L_AllWavesClear;
    end;

L_Clear:
    stopnpctimer;
    setnpctimer 0;
    killmonster "052-2", "Luvia?::OnDSDeath";
    killmonster "052-2", "Luvia?::OnWGDeath";
    end;

L_AllWavesClear:
    $@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:
    $@illia_progress = 6;
    callfunc "UpdateIlliaProgress";
    $@illia_max_time = $@illia_max_time + 360;
    areatimer 0, "052-2", 19, 18, 48, 43, 2000, "#LuviaShadow::OnNN";
    end;

S_GetHeroRect:
    if (!(attachrid($@iLLIA_HERO_ID)))
        goto L_Clear;
    if(!(isin("052-2", 20, 21, 47, 43)))
        goto L_Clear;

    $@illia_lobby_x = getx();
    $@illia_lobby_y = gety();

    $@illia_lobby_x1 = $@illia_lobby_x - 12;
    $@illia_lobby_y1 = $@illia_lobby_y - 8;
    $@illia_lobby_x2 = $@illia_lobby_x + 12;
    $@illia_lobby_y2 = $@illia_lobby_y + 8;

    if ($@illia_lobby_x1 < 20)
        $@illia_lobby_x1 = 20;
    if ($@illia_lobby_y1 < 19)
        $@illia_lobby_y1 = 19;
    if ($@illia_lobby_x2 > 47)
        $@illia_lobby_x2 = 47;
    if ($@illia_lobby_y2 > 42)
        $@illia_lobby_y2 = 42;

    detachrid;
    return;

S_ClearHeroRect:
    $@illia_lobby_x1 = 20;
    $@illia_lobby_y1 = 19;
    $@illia_lobby_x2 = 47;
    $@illia_lobby_y2 = 42;
    return;

OnDSDeath:
    end;

OnWGDeath:
    end;

}