summaryrefslogtreecommitdiff
path: root/npc/018-6-1/main.txt
blob: 7509b39388ce172206c6dc1bca66124c51fd251f (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
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
// TMW2 Scripts
// Author:
//    Jesusalva
// Description:
//    Controls Elenium Mines, specially the instances

// Main Controller for Instanced maps
018-6-1,0,0,0	script	#01861_InstCtrl	NPC_HIDDEN,{
    end;

// Map, x, y, width, height, mob, amount
function AreaMonsterB {
    .@m$=getarg(0);
    .@x1=getarg(1);
    .@x2=.@x1+getarg(3);
    .@y1=getarg(2);
    .@y2=.@y1+getarg(4);
    .@mi=getarg(5);
    .@am=getarg(6);
    areamonster(.@m$, .@x1, .@y1, .@x2, .@y2, strmobinfo(1, .@mi), .@mi, .@am, instance_npcname(.name$)+"::OnKill"+.@mi);
    return;
}

// (var, value)
function SetIfVoid {
    if (!getarg(0))
        return getarg(1);
    return 0;
}

// Bifs won't respawn
OnKill1226:
OnKill1227:
OnKill1228:
    end;

// Others: Wait 30 seconds and respawn
OnKill1178:
    .@mi=SetIfVoid(.@mi, 1178);
OnKill1051:
    .@mi=SetIfVoid(.@mi, 1051);
OnKill1074:
    .@mi=SetIfVoid(.@mi, 1074);
OnKill1123:
    .@mi=SetIfVoid(.@mi, 1123);
OnKill1176:
    .@mi=SetIfVoid(.@mi, 1176);
OnKill1026:
    .@mi=SetIfVoid(.@mi, 1026);

    // Common utils
    /*
    // Respawn monster after 30s
    getmapxy(.@m$, .@x, .@y, 0);
    sleep(30000);
    AreaMonsterB(.@m$, .@x-2, .@y-2, 4, 4, .@mi, 1);
    */
    end;

OnInstanceInit:
    // Generate map ID
    getmapxy(.@m$, .@x, .@y, UNITTYPE_NPC);

    // Bif monsters
    AreaMonsterB(.@m$,  40,  49, 7, 8, BigEleniumBif, 5);
    AreaMonsterB(.@m$,  95,  51, 7, 8, BigEleniumBif, 5);
    AreaMonsterB(.@m$, 145,  83, 6, 5, EleniumBif, 5);
    AreaMonsterB(.@m$,  62,  86, 6, 5, EleniumBif, 5);
    AreaMonsterB(.@m$,  65, 130, 6, 5, EleniumBif, 5);
    AreaMonsterB(.@m$, 125, 158, 6, 5, SmallEleniumBif, 4);
    AreaMonsterB(.@m$, 129, 183, 6, 5, SmallEleniumBif, 4);
    AreaMonsterB(.@m$,  34, 181, 5, 5, SmallEleniumBif, 4);

    // Common Monsters
    AreaMonsterB(.@m$,  80, 172, 54, 25, BlackSlime, 16);
    AreaMonsterB(.@m$,  89, 167, 54, 25, DarkLizard, 8);
    AreaMonsterB(.@m$,  96, 103, 56, 29, BlackScorpion, 17);
    AreaMonsterB(.@m$, 101, 105, 54, 25, MountainSnake, 9);
    AreaMonsterB(.@m$,  70,  45, 44, 25, WickedMushroom, 14);
    AreaMonsterB(.@m$,  68,  45, 31, 21, Archant, 7);
    end;

}
/////////////////////////////
018-6-1,83,26,0	script	#ToForgottenChamber	NPC_SUMMONING_CIRC,0,0,{
    dispbottom l("It looks dangerous.");
    end;

OnTouch:
    .@q=getq(LoFQuest_Barbara);
    .@q2=getq2(LoFQuest_Barbara);
    .@q3=getq3(LoFQuest_Barbara);
    // Skipped cutscenes, show you the EXIT
    if (.@q == 1 && .@q3 != 1)
        cwarp "017-1", 32, 45;

    if (.@q >= 1) {
        warp BarbaraInstCheck(0), 90, 91;
        // Complete the first arc if possible
        if (.@q == 1) {
            setnpcdialogtitle l("Forgotten Chamber");
            mesn l("Forgotten Chamber");
            mesq l("You see yourself in a strange chamber. Strange drawings litter the walls.");
            next;
            mesn l("Forgotten Chamber");
            mesq l("You can see in distance two portals working, and two portals offline.");
            next;
            mesn l("Forgotten Chamber");
            mesq l("It seems to be a puzzle, you can only imagine what needs to be done in order to enable the right portals.");
            next;
            setq1 LoFQuest_Barbara, 2;
            setq3 LoFQuest_Barbara, 0;
            closeclientdialog;
        }
        // Update M0 NPCs based on quest state
        if (.@q > 2)
            enablenpc instance_npcname("#ToForgottenShrine", .@q2);
        if (.@q == 2) {
            // Note: state 64 and 128 are temporary and must be removed
            if (.@q3 & 64)
                setq3 LoFQuest_Barbara, .@q3^64;
            // Safety update
            .@q3=getq3(LoFQuest_Barbara);

            if (.@q3 & 128)
                setq3 LoFQuest_Barbara, .@q3^128;
            // Safety update
            .@q3=getq3(LoFQuest_Barbara);

            if (.@q3 == 5)
                enablenpc instance_npcname("#ToForgottenShrine", .@q2);
            if (.@q3 == 3)
                enablenpc instance_npcname("#ToSouthHall", .@q2);
        }

    } else {
        Exception("ERROR, YOU SHOULD NOT BEEN SEEING THIS. 018-6-1.TFC");
    }
    end;

OnInit:
    disablenpc .name$;
    end;

}

///////////////////////////// Minievents
018-6-1,128,131,0	script	Wounded Soldier#01861	NPC_GUARD_DEAD,{
    //npctalk3 l("Please find her and don't worry with me! And be careful!");
    npctalk3 l("*scream in pain*");
    close;

OnMain:
    mesn l("Wounded Soldier");
    mesq l("Hey, you! Are you here on Kenton's orders?!");
    next;
    setnpcdialogtitle l("Benjamin, Wounded Soldier");
    mesn l("Benjamin, Wounded Soldier");
    mesq l("My name is Benjamin, and I was in charge of an incursion here to capture Barbara.");
    next;
    mesn l("Benjamin, Wounded Soldier");
    mesq l("My unit, however, was attacked! An assassin snuck up on us!");
    mesc l("You help Benjamin in getting up.");
    next;
    mesn l("Benjamin, Wounded Soldier");
    mesq l("I hope my men are safe, that was yesterday. I am barely alive.");
    mesc l("You know what is worse? THIS WHOLE CAVE HAVE DEATH PENALTY ON!!!"), 1;
    next;
    mesn l("Benjamin, Wounded Soldier");
    mesq l("I shall report to Kenton. I now entrust this quest in your hands!");
    next;
    mesn l("Benjamin, Wounded Soldier");
    mesq l("And please, bring those criminals to justice! Barbara and the Assassin!");
    next;
    mesc l("With a wave, Benjamin returns to report Kenton about the outcome.");
    setq3 LoFQuest_Barbara, 1;
    disablenpc instance_npcname(.name$); // NPC will now go to rest
    close;

OnInit:
    .sex=G_MALE;
    disablenpc .name$;
    end;
OnInstanceInit:
    if (debug) setnpcdisplay instance_npcname(.name$), NPC_WOUNDEDSOLDIER;
    disablenpc instance_npcname(.name$);
    end;
}

// Event trigger
018-6-1,121,132,0	script	#01861TriggerWS1	NPC_HIDDEN, 0, 10,{
    end;
OnTouch:
    .@q=getq(LoFQuest_Barbara);
    .@q2=getq2(LoFQuest_Barbara);
    .@q3=getq3(LoFQuest_Barbara);
    if (.@q == 1 && .@q3 == 0) {
        enablenpc instance_npcname("Wounded Soldier#01861", .@q2);
        addtimer2(500, instance_npcname("Wounded Soldier#01861", .@q2)+"::OnMain");
    }
    end;

OnInit:
    disablenpc .name$;
    end;
}

///////////////////////////// Minievents
018-6-1,89,70,0	script	Barbara#01861	NPC_INJURIED_GIRL,{
    //npctalk3 l("Please find her and don't worry with me! And be careful!");
    npctalk3 l("*scream in pain*");
    close;

OnMain:
    showavatar NPC_INJURIED_GIRL;  // this is handled by avatars.xml

    .@q=getq(LoFQuest_Barbara);
    .@q2=getq2(LoFQuest_Barbara);
    .@q3=getq3(LoFQuest_Barbara);

    // Barbara was taken hostage or murdered - save this data
    @evil=0; // Temporary variable to show the murder option or not
    setnpcdialogtitle l("Wounded Girl");
    mesn l("Wounded Girl");
    mesq l("...");
    next;
    mesn l("Wounded Girl");
    mesq l("...I guess I can't hide anymore...");
    next;
    sshake(rand2(3,5), false);
    mesn l("Wounded Girl");
    mesq l("Ah!");
    next;
    setnpcdialogtitle l("Barbara, Wounded Girl");
    mesn l("Barbara, Wounded Girl");
    mesq l("Sorry, I haven't seen you. My name is Barbara.");
    next;
    select
        l("My name is ")+strcharinfo(0),
        l("I'm here to arrest you.");
    mes "";
    if (@menu == 1) {
        mesn l("Barbara, Wounded Girl");
        mesq l("Pleased to meet you. What brings you down here?");
        next;
        mesn strcharinfo(0);
        mesq l("I'm here to arrest a criminal.");
        next;
    } else {
        @evil+=1;
    }
    mesn l("Barbara, Wounded Girl");
    mesq l("Please spare me. I'm gravely wounded. I'm innocent, I swear!");
    next;
    select
        l("Why should I spare you?"),
        l("Where is the item you've stolen?");
    mes "";
    mesn l("Barbara, Wounded Girl");
    mesq l("I... I confess. I did steal an apple. I was hungry! I am very poor.");
    next;
    mesn l("Barbara, Wounded Girl");
    mesq l("My family died when I was just a little girl... I have been trying to survive...");
    next;
    select
        l("Cut the chat short and go straight to the point!"),
        l("I'm listening, but don't hope me to buy your story.");
    mes "";
    if (@menu == 2) {
        mesn l("Barbara, Wounded Girl");
        mesq l("You know, if you're poor, you can't get too close to the Noble district.");
        next;
        mesn l("Barbara, Wounded Girl");
        mesq l("They left me no inheirtance, either. Even surviving has been a struggle. I'm not strong enough to kill the living potatos for @@.", getitemlink(Potatoz));
        next;
        mesn l("Barbara, Wounded Girl");
        mesq l("The monsters here are too strong, and as I said before, I can't get close to the Transcedence Portal nor to get training.");
        next;
        select
            l("I'm not here to listen stories, I need you to return what you've stole.");
    } else {
        @evil+=1;
    }
    mesn l("Barbara, Wounded Girl");
    mesq l("I can't give you the Apple I've stole. Because, I was stolen first!");
    next;
    select
        l("I don't believe you."),
        l("Let's say I believe you. Who stole you? Benjamin?");
    mes "";
    if (@menu == 1) {
        mesn l("Barbara, Wounded Girl");
        mesq l("But- But you have to! It is the ")+b(l("truth"))+"!";
        next;
        select
            l("And whom do you claim to be the thief?"),
            rif(@evil, l("[Kill her]")),
            l("Barbara. You're under arrest by Kenton's orders. Please surrend peacefully.");
        mes "";
        @evil+=1;
        switch (@menu) {
        case 2:
            mesn l("Barbara, Wounded Girl");
            mesq l("OH MY, PLEASE DON'T!");
            next;
            mesn l("Barbara, Wounded Girl");
            mesq l("I NEVER TOUCHED THE SOUL MENHIR! I SWEAR YOU, I'M INNOCENT! PLEASE HAVE MERCY!!");
            next;
            mesc l("Really kill Barbara?"), 1;
            mesc l("WARNING: THIS ACTION IS IRREVERSIBLE."), 1;
            if (askyesno() == ASK_YES) {
                mes "";
                mesc l("She falls in a single blow. You'll attribute her death to the Mysterious Assassin.");
                BARBARA_STATE=1;
                setq1 LoFQuest_Barbara, 5;
                disablenpc instance_npcname(.name$); // NPC will now go to rest
                close;
            } else {
                @evil=false;
                mesn l("Barbara, Wounded Girl");
                mesc l("*sigh*");
                mesq l("Thank you...");
                next;
            }
            break;
        case 3:
            mesn l("Barbara, Wounded Girl");
            mesq l("...I have no other choice, do I?");
            next;
            mesn l("Barbara, Wounded Girl");
            mesq l("But be warned, I don't have the Apple with me. It's further in.");
            // The quest is not over yet - do not set BARBARA_STATE
            setq1 LoFQuest_Barbara, 5;
            disablenpc instance_npcname(.name$); // NPC will now go to rest
            close;
            break;
        }
    } else {
        mesn l("Barbara, Wounded Girl");
        mesq l("Oh no, Benjamin is a city guard, he would never do that. I hope.");
        next;
    }
L_MainStory:
    mesn l("Barbara, Wounded Girl");
    mesq l("A hooded man attacked me, and left me in this state.");
    next;
    mesn l("Barbara, Wounded Girl");
    mesq l("The hooded man was about to deliver me a final blow, but then he saw the Apple I've stole...");
    next;
    mesn l("Barbara, Wounded Girl");
    mesq l("...And for some reason he took the apple and went further in the caves.");
    next;
    mesn l("Barbara, Wounded Girl");
    mesq l("Maybe if you go back the way you're coming, you find him...");
    next;
    mesn l("Barbara, Wounded Girl");
    mesq l("By the way, I can't say for sure it was a man. He smelled like onions, and his face was shinning.");
    next;
    // FIXME: Should she be so blunt?
    mesn l("Barbara, Wounded Girl");
    mesq l("I'm only assuming it was a man because the lack of boobs.");
    next;
    mesn l("Barbara, Wounded Girl");
    mesq l("So... I'm at your hands now... What will you do with me?");
    next;
    select
        l("Listen to her story again."),
        rif(@evil, l("[Kill her]")),
        l("You're under arrest. I have to bring you back to Kenton."),
        l("I have some healing items with me, we should tend your wounds first.");
    mes "";
    switch (@menu) {
    // Murder
    case 2:
        mesn l("Barbara, Wounded Girl");
        mesq l("OH MY, PLEASE DON'T!");
        next;
        mesn l("Barbara, Wounded Girl");
        mesq l("I NEVER TOUCHED THE SOUL MENHIR! I SWEAR YOU, I'M INNOCENT! PLEASE HAVE MERCY!!");
        next;
        mesc l("Really kill Barbara?"), 1;
        mesc l("WARNING: THIS ACTION IS IRREVERSIBLE."), 1;
        if (askyesno() == ASK_YES) {
            mes "";
            mesc l("She falls in a single blow. You'll attribute her death to the Mysterious Assassin.");
            BARBARA_STATE=1;
            setq1 LoFQuest_Barbara, 5;
            disablenpc instance_npcname(.name$); // NPC will now go to rest
            close;
        } else {
            @evil=false;
            mesn l("Barbara, Wounded Girl");
            mesc l("*sigh*");
            mesq l("Thank you...");
            next;
        }
    // Repeat
    case 1:
        goto L_MainStory;
        break;
    // Healing
    case 4:
        mesn l("Barbara, Wounded Girl");
        mesq l("I'm afraid my wounds are too critical. I'm bleeding. I was cursed. And I can't even move.");
        next;
        if (countitem(ElixirOfLife)) {
            mesc l("You have an @@ - Should you give her that?", getitemlink(ElixirOfLife));
            if (askyesno() == ASK_YES) {
                mes "";
                mesn l("Barbara, Wounded Girl");
                mesq l("It's true enough an @@ could heal even a dead tree, and would dispel almost every status ailment I could have.", getitemlink(ElixirOfLife));
                next;
                mesn l("Barbara, Wounded Girl");
                mesq l("But my case requires extended treatment. I need to be hospitalized. I'm afraid it is too late for the Elixir to have effect...");
                next;
            }
        }
        mesn strcharinfo(0);
        mesq l("...You're right. My medicine cannot heal you.");
        next;
        mesn l("Barbara, Wounded Girl");
        mesq l("I think the Doctor, on Dimond's Cove could help me, but that means passing by Kenton...");
        next;
    // Arrest
    case 3:
        mesn l("Barbara, Wounded Girl");
        mesq l("...I have no other choice, do I?");
        next;
        mesn l("Barbara, Wounded Girl");
        mesc l("*sigh*");
        mesq l("But be warned, I don't have the Apple with me. It's further in.");
        mes "";
        mesc l("Barbara was apprehended. It would be weird to show her on your inventory, so we won't.");
        // The quest is not over yet - do not set BARBARA_STATE
        setq1 LoFQuest_Barbara, 5;
        disablenpc instance_npcname(.name$); // NPC will now go to rest
        close;
    }
    Exception("Invalid Barbara Dialog State - 0");
    close;

OnInit:
    .sex=G_FEMALE;
    disablenpc .name$;
    end;
OnInstanceInit:
    disablenpc instance_npcname(.name$);
    end;
}

// Event trigger
018-6-1,84,71,0	script	#01861TriggerBB1	NPC_HIDDEN, 0, 10,{
    end;
OnTouch:
    .@q=getq(LoFQuest_Barbara);
    .@q2=getq2(LoFQuest_Barbara);
    .@q3=getq3(LoFQuest_Barbara);
    if (.@q == 4) {
        enablenpc instance_npcname("Barbara#01861", .@q2);
        addtimer2(500, instance_npcname("Barbara#01861", .@q2)+"::OnMain");
    }
    end;

OnInit:
    disablenpc .name$;
    end;
}