summaryrefslogtreecommitdiff
path: root/npc/001-2-36/hector.txt
blob: b4f801be8c33d8c12728a2efee2f2a902bfb052a (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
// TrainingRoom
// Author:
//    jak1
//    omatt
//    toams
// Story:
//    Reid
//    Teru
// Spellchecking & Dialogs:
//     Reid
//     toams
// Variable:
// .fightingActive
//    0 = no fight active
//    1 = swordfight active
//    2 = bowfight active
//    3 = skillfight
// ArtisQuests_TrainingLegion
// 0    not started at all
// 1    swordTraining finished
// 2    bowTraining finished
// 3    bow and sword finished
// 4    end of training
// .mobID is related to quest state
//
// TODO adding rand messages like "try hit it harder..." for wave's
// TODO in first, second, and third training, input some tips about related weapon given.


001-2-36,32,36,0	script	Hector#001-2-36	NPC_LUCAS,{


    'instanceID = instance_id();
    'npcName$ = strnpcinfo(NPC_NAME_UNIQUE); // required for call the label in the npc of this one instance
    attachnpctimer;
    initnpctimer;

    function waveEnded {

        if (.fightingActive == 1)
        {
            npctalk3(l("Well done, you aren't even bleeding that much!"));
            if (getq(.quest_training) == 0)
                setq(.quest_training, 1);
            if (getq(.quest_training) == 2)
                setq(.quest_training, 3);
        }
        if (.fightingActive == 2)
        {
            npctalk3(l("Great! Don't mind those scorched hairs, they will grow back."));
            if (getq(.quest_training) == 0)
                setq(.quest_training, 2);
            if (getq(.quest_training) == 1)
                setq(.quest_training, 3);
        }
        if (.fightingActive == 3)
        {
            if (getq(.quest_training) == 3)
            {
                npctalk3(l("Congratulations, you have finished your training."));
                sleep2(2000);
                npctalk3(l("The only way to improve yourself is practice, practice and some more practice."));
                setq(.quest_training, 4);
                setq(Artis_Legion_Progress, 2);
            }
            else
            {
                npctalk3(l("You finished training the bashing skill. Pretty powerful isn't it?"));
            }
        }

        .currentWaveLevel = 1;
        .fightingActive = 0;
        'mobDead = 0;
        end;
    }

    function mobSpawn {

        if (.fightingActive != 0)
        {
            if (.currentWaveLevel == .maxWaves)
            {
                npctalk3(l("Last Wave!"));
            }
            else
            {
                npctalk3(l("Wave " + .currentWaveLevel + "!"));
            }

            areamonster('map$, .mobCoordinate[0], .mobCoordinate[1], .mobCoordinate[2], .mobCoordinate[3],
            /*           map          x1                 y1                x2                 y2            */
                        strmobinfo(1, .mobID[.fightingActive]), .mobID[.fightingActive], .currentWaveLevel, 'npcName$+"::OnTrainingMobDead");
            /*          mob display        mob id                amount                  label              */
        }

        end;
    }

    function trainingEnd {

        sleep2(1500);
        npctalk3(l("This training is over!"));
        .fightingActive = 0;
        .currentWaveLevel = 1;
        killmonster('map$, "All");
        stopnpctimer();
        end;
    }

    function checkWeapon {
        // check for sword in swordtraining
        if (getiteminfo(getequipid(EQI_HAND_R), ITEMINFO_SUBTYPE) != W_1HSWORD && .fightingActive == 1)
        {
            npctalk3(l("Hey! Use your sword!"));
            trainingEnd;
        }

        // check for bow in bowtraining
        if (getiteminfo(getequipid(EQI_HAND_R), ITEMINFO_SUBTYPE) != W_BOW && .fightingActive == 2)
        {
            npctalk3(l("Hey! Use your bow!"));
            trainingEnd;
        }

        // no weapons may be equiped when training skill
        if (getequipid(EQI_HAND_R) != -1 && .fightingActive == 3)
        {
            npctalk3(l("Hey! No weapons allowed this round!"));
            trainingEnd;
        }

    }


    function mobKilled {

        'mobDead = 0; // reset the count

        checkWeapon; // check if correct weapon is in use

        // on first skill training give SM_BASH skill and explain how to use it.
        if (getq(.quest_training) == 3 && .currentWaveLevel == 1)
            {
                setcamnpc(strnpcinfo(NPC_NAME_UNIQUE)); // focus the npc when he talk to the player
                speech(S_LAST_NEXT,
                    l("Using a skill consumes Mana."),
                    l("It takes a while to have full Mana again."),
                    l("The more intelligence points you have, the faster it goes."),
                    l("If you sit, you regain your Mana faster."),
                    l("Or you can drink a mana potion. This restores some Mana. How much depends on the potion."),
                    l("Here take one! I have plenty of them."));
                closedialog;
                getitem(.mana_potion, 1);
                sleep2(3000);
            }

        if (.currentWaveLevel == .maxWaves )
        {
            waveEnded;
        }


        .currentWaveLevel++; // next wave after killed dummy

        mobSpawn;
    }

    function swordTraining {
        speech(S_LAST_BLANK_LINE | S_LAST_NEXT,
            l("You chose the sword for this training, make sure to equip it or we can't start."));

        speech(S_LAST_BLANK_LINE | S_NO_NPC_NAME,
            l("I will place some dummies in the fighting arena. @@ waves of dummies, kill them to finish this training.", .maxWaves),
            l("Ready?"));

        askyesno;
        if (@menu == ASK_NO)
        {
            closedialog;
            end;
        }

        closedialog;
        .fightingActive = 1;
        initnpctimer;
    }

    function bowTraining {
        speech(S_LAST_BLANK_LINE | S_LAST_NEXT,
            l("You chose the bow for this training, make sure to equip it or we can't start."));

        speech(S_LAST_BLANK_LINE | S_NO_NPC_NAME,
            l("I've set these dummies on fire. Don't get too close to the dummies or the fire will hurt you."),
            l("The range of your bow makes it possible to kill them from a distance."),
            l("Ready?"));

        askyesno;
        if (@menu == ASK_NO)
        {
            closedialog;
            end;
        }

        .fightingActive = 2;
        initnpctimer;
    }

    function skillTraining {

        if (getq(.quest_training) == 3)
        {
            //Give bashing skill
            skill(.skill_name, 1, 0);

            speech(S_LAST_BLANK_LINE | S_NO_NPC_NAME,
                l("Lets teach you the bashing skill. This is a very powerful way to hit your enemy by using only your bare hands."),
                l("To use the skill you have to open your skills menu. Here you select the offensive tab and select the bash skill. When the bash skill is selected, press the use button the use the skill."));
        }

        speech(S_LAST_BLANK_LINE | S_NO_NPC_NAME,
            l("You can only use this skill with bare hands, so make sure to unequip your weapons."),
            l("@@ waves of dummies, you know how that ends.", .maxWaves),
            l("Ready?"));

            askyesno;
            if (@menu == ASK_NO)
            {
                closedialog;
                end;
            }

        .fightingActive = 3;
        initnpctimer;
    }

    function checkCombatZone {

        getmapxy('map$, @x, @y, 0);
                if (@x < 24 || @x > 32 || @y < 33 || @y > 43)
                return 1;
            return 0;
    }

    // choose training and start it
    function trainingStart {

        if (checkCombatZone())
        {
            npctalk3(l("Please enter the combat zone on the left."));
            closedialog;
            end;
        }
        if (.fightingActive == 0)
        {
            switch (getq(.quest_training))
            {
                case 0: speech(S_FIRST_BLANK_LINE | S_LAST_BLANK_LINE,
                    l("Which weapon do you want to train? Bow or sword?"));

                    switch (select(l("I'll start with the sword."),
                                   l("I would like to train the bow first."),
                                   l("I don't feel like training today, see you later.")))
                    {
                        case 1: swordTraining; break;
                        case 2: bowTraining; break;
                        case 3: closedialog; end;
                    }
                    break;
                case 1: speech(S_FIRST_BLANK_LINE | S_LAST_BLANK_LINE,
                    l("You have finished the sword training. Do you want to start training the bow?"));

                    switch (select(l("Yes, I'm ready for some arrow shooting!"),
                                   l("Can I train the sword some more?"),
                                   l("I don't feel like training today, see you later.")))
                    {
                        case 1: bowTraining; break;
                        case 2: swordTraining; break;
                        case 3: closedialog; end;
                    }
                    break;
                case 2: speech(S_FIRST_BLANK_LINE | S_LAST_BLANK_LINE,
                    l("You have finished the bow training. Do you want to start training the sword?"));

                    switch (select(l("Yes, teach me how to cut and slice these dummies!"),
                                   l("Can I train the bow some more?"),
                                   l("I don't feel like training today, see you later.")))
                    {
                        case 1: swordTraining; break;
                        case 2: bowTraining; break;
                        case 3: closedialog; end;
                    }
                    break;
                case 3: speech(S_FIRST_BLANK_LINE | S_LAST_BLANK_LINE,
                    l("You have mastered both the bow and the sword. The only thing left to teach you is the bashing skill."));

                    switch (select(l("A skill? That sounds useful!"),
                                   l("Can I train the sword some more?"),
                                   l("I would rather like to train the bow again."),
                                   l("I don't feel like training today, see you later.")))
                    {
                        case 1: skillTraining; break;
                        case 2: swordTraining; break;
                        case 3: bowTraining; break;
                        case 4: closedialog; end;
                    }
                    break;
                case 4: speech(S_FIRST_BLANK_LINE | S_LAST_BLANK_LINE,
                    l("Sure, which training do you want to start?"));

                    switch (select(l("Skill training please"),
                                l("Can I train the sword some more?"),
                                l("I would like to train the bow again."),
                                l("I've changed my mind, see you later.")))
                    {
                        case 1: skillTraining; break;
                        case 2: swordTraining; break;
                        case 3: bowTraining; break;
                        case 4: closedialog; end;
                    }
                    break;
            }
        closedialog;

        npctalk3(l("Let's begin"));

        mobSpawn;
        }
    }

    function mainLoop {

        // if fighting is active say encouraging words to the player
        if (.fightingActive != 0)
        {
            switch (.fightingActive)
            {
                case 1: npctalk3(l("Attack with your sword and kill them!")); end;
                case 2: npctalk3(l("Use your bow and kill them!")); end;
                case 3: npctalk3(l("Hey lazy bum! Attack the dummies")); end;
                default: break;
            }
        }

        // only start if player talked with Lozerk and is not an enemy
        if (getq(Artis_Legion_Progress) < 1 || faction_standing("LEGION", true) < 1)
        {
            speech(S_FIRST_BLANK_LINE | S_LAST_NEXT,
                        l("This is the training ground. And I ain't training nobody unless Lieutenant Lozerk tells me to!"),
                        l("So please get out!"));
                        closedialog;
                        end;
        }
        else
        {
            switch (getq(.quest_training))
                {
                    case 0: speech(S_FIRST_BLANK_LINE | S_LAST_NEXT,
                        l(.mockingGreeting$[rand(getarraysize(.mockingGreeting$))]),
                        l("Do you want some training? To be honest, it looks like you could use some..."));
                        break;
                    case 4: speech(S_FIRST_BLANK_LINE | S_LAST_NEXT,
                        l("Your training is finished, I taught you all I know."),
                        l("So now go and explore the world!"));
                        switch (select(
                            l("Can I first have an other look at your book?"),
                            l("Before doing that can I improve my fighting skills some more?"),
                            l("Okay!")))
                        {
                            case 1: doevent("#EvolTutorial::OnRemoteHelp");; break;
                            case 2: trainingStart; break;
                            case 3: closedialog; end;
                        }
                        closedialog;
                        end;
                    default: speech(S_FIRST_BLANK_LINE | S_LAST_NEXT,
                        l("Hello again, ready to continue your lessons?")); break;
                }

            do
            {
                selectd(
                    l("Yes, train me!"),
                    l("Hmm... But what is exactly this training?"),
                    l("I'm a bit lost in this game, can you first give me few tips?"),
                    l("Not right now, it looks like I got other stuff to do."));

                switch (@menu)
                {
                    case 1: trainingStart; break;
                    case 2:
                        // here text who explain what is the training of this npc
                        speech(S_FIRST_BLANK_LINE | S_LAST_NEXT | S_LAST_BLANK_LINE | S_NO_NPC_NAME,
                            l("In this training, my goal is to teach you how to be a skilled warrior, who can use a sword, a bow and a skill."),
                            l("For this, you need a sword and a bow."),
                            l("After you gathered your weapons, I will teach you how to use them."));
                        break;
                    case 3:
                        speech(S_FIRST_BLANK_LINE | S_LAST_NEXT | S_LAST_BLANK_LINE | S_NO_NPC_NAME,
                        l("I have a book with all the info you need, do you want to read it?"));
                            askyesno;
                                if (@menu == ASK_YES)
                                {
                                    doevent("#EvolTutorial::OnRemoteHelp");
                                    closedialog;
                                    end;
                                }
                        break;
                    case 4: closedialog; end;

                    default: closedialog; end;
                }
            } while (1);
        }
    }

    mainLoop;
    closedialog;
    end;

OnTimer1000:
    if (.fightingActive != 0)
    {
        if (checkCombatZone())
            {
            npctalk3(l("You left the combat zone!"));
            trainingEnd;
            }
        checkWeapon;
        initnpctimer;
    }
    end;

OnTrainingMobDead:
    // the amount of mob spawned depend on currentwave
    if (++'mobDead == .currentWaveLevel)
    {
        mobKilled;
    }
    end;

OnInit:
    .mana_potion = LargeMana;
    .skill_name = SM_BASH;
    .quest_training = ArtisQuests_TrainingLegion;
    .quest_debug = .quest_training;
    .maxWaves = 3;

    .currentWaveLevel = 1;
    .fightingActive = 0;

    // TODO FIXME translation
    // here input some sentences "hello noob" like, the npc pick randomly a sentence
    setarray .mockingGreeting$[0], "Hey noob!", "Hey somethingwholooklikeawarrior...", "Sup' chibi.";
    setarray .mobID[0],0, Dummy, FireDummy, Dummy; // an array of dummies, one for each training
    setarray .mobCoordinate[0], 24, 34, 31, 41; // this represent the square of "ring" training

    end;

}