summaryrefslogtreecommitdiff
path: root/npc/002-1/peter.txt
blob: 1bdcff69841ff26e60a6013134b2876e45dbd371 (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
// TMW2 script
// Author:
//   Jesusalva
// Original evol script authors: 4144, Ablu, Alastrim, Qwerty Dragon, Reid, Vasily_Makarov
// Description:
//    Rat hunter.
// Variable:
//    ShipQuests_Peter
// Values:
//    0   Doesn't know the quest.
//    & 1   Task given.
//    & 2   Task completed (easy level).
//    & 4   Task completed (medium level).
//    & 8   Task completed (hard level).
// Setq2:
//      Number of killed Rattos:
//      & 1 - Ratto 1
//      & 2 - Ratto 2
//      & 4 - Ratto 3
//      & 8 - Ratto 4
//      = 15: All rattos killed
// Setq3:
//      Instance ID (so we can destroy it later)
//
// Others:
// @peter = Accepted Task ID
// @pt_mob = ID of the monster you were tasked with killing

002-1,35,24,0	script	AreaNPC#Peter	NPC_HIDDEN,0,1,{

OnTouch:
    .@q = getq(ShipQuests_Peter);
    .@q2 = getq2(ShipQuests_Peter);
    .@q3 = getq3(ShipQuests_Peter);
    if (BaseLevel < 8) goto L_Stop;

    if (.@q && isinstance(.@q3) && .@q3 > 0) goto L_Rfail;
    doevent "Peter::OnGiveTask";
    close;

L_Stop:
    doevent "Peter::OnStop";
    close;

L_Rfail:
    doevent "Peter::OnReturnFail";
    close;
}

002-1,33,25,0	script	Peter	NPC_RATTO_SAILOR,{
    .@q = getq(ShipQuests_Peter);
    .@q2 = getq2(ShipQuests_Peter);
    .@q3 = getq3(ShipQuests_Peter);
    if (BaseLevel < 8) goto OnTooWeak;

    if (!.@q || !isinstance(.@q3) || .@q3 <= 0) goto L_Task;
    if (.@q2 < 15) goto L_ReturnFail;
    dispbottom l("I am broken?! Please report! Debug data: @@ (@@)", .@q, .@q2);
    close;

OnGiveTask:
L_Task:
    if (!.@q)
        setq ShipQuests_Peter, 1, 0, -1;
    mesn;
    mesq lg("Hey, girl!", "Hey, man!");
    next;
    mesq l("I need somebody who can rid the hold of the ship of these creatures. Can you help me?");
    next;

    menu
        l("Yeah, but what reward will I get?"), L_BonusTask,
        l("No, they are way too dangerous for me!"), -;

    mes "";
    mesn;
    mesq l("Hehe, hehe. Well, come back if you change your mind.");

    close;

OnLowTime:
    if ((getmap() ~= "002-2") || (getmap() ~= "nard"))
        dispbottom l("Time is running out... Hurry up!");
    end;

OnTooWeak:
    mesn;
    mesq lg("I need someone to help me clean the edge of the ship, but you aren't strong enough for now.");
    close;

OnStop:
    slide 35, 26;

    mesn;
    mesq l("You can't go there!");

    close;

OnReturnFail:
L_ReturnFail:
    .@q3 = getq3(ShipQuests_Peter);
    instance_destroy(.@q3);
    setq2 ShipQuests_Peter, 0;
    setq3 ShipQuests_Peter, -1;
    mesn;
    mesq l("I see it's not so easy to get rid of the monsters. Do you want to try again?");
    next;

    menu
        l("Yeah, but I would like to make sure I get a reward."), L_BonusTask,
        l("No, they are way too dangerous for me!"), -;

    mes "";
    mesn;
    mesq l("Hehe, hehe. Well, come back if you change your mind.");

    close;

L_BonusTask:
    mes "";
    mesn;
    mesq l("There are three kind of monsters which frequently attacks our fair vessel.");
    next;
    mesn;
    .@q = getq(ShipQuests_Peter);
    if (!(.@q & 2)) {
        mes l("- I currently need your help with @@.", getmonsterlink(Squirrel)); // 750 HP, don't attack, 110 ms
        mes l("I'll give you @@ GP for this job.", 350);
        mes "";
    }
    if (!(.@q & 4)) {
        mes l("- I currently need your help with @@.", getmonsterlink(Ratto)); // 500 HP, 80 DMG, 1572 dps, 120 ms
        mes l("I'll give you @@ GP for this job.", 550);
        mes "";
    }
    if (!(.@q & 8)) {
        mes l("- I currently need your help with @@.", getmonsterlink(Croc)); // 1900 HP, 145 DMG, 1872 dps, 600 ms
        mes l("I'll give you @@ GP for this job.", 1000);
        mes "";
    }
    // TODO: This could be done a daily quest
    if (.@q == 15) {
        mes l("- I currently need your help with @@, but there's no reward.", getmonsterlink(Ratto));
    }
    next;

    select
        l("I'm not feeling like it today... Sorry."),
        rif(!(.@q & 2), l("I will take the @@ Bounty.", "Squirrel")),
        rif(!(.@q & 4), l("I will take the @@ Bounty.", "Ratto")),
        rif(!(.@q & 8), l("I will take the @@ Bounty.", "Croc")),
        rif(.@q == 15, l("Why not, I need to train anyway."));

    if (@menu == 1)
        close;

    @peter=@menu;

    goto L_Start;


L_Start:
    mes "";
    mesc l("Some of them are pretty strong. Do you need an explanation about hit'n'run and the monster you're about to face?");
    if (askyesno() == ASK_YES) {
        mes "";
        mesc l(".:: Hit'n'Run Tactic ::.");
        mesc l("Sometimes, you just cannot afford to be hit. But even with a melee weapon, you don't need to be hit.");
        next;
        mesc l("The strategy is simple. When you hit the enemy, walk one or two tiles backwards.");
        mesc l("If you miss, walk two or three tiles backwards. This way, you avoid being hit.");
        next;
        if (@peter == 2)
            mesc l("Squirrels are healthy, but they never attack. They run away from you, so good luck catching it!");
        else if (@peter == 4)
            mesc l("Crocs are dangerous and very healthy, but very slow. Use that on your advantage.");
        else
            mesc l("Rattos are very fast. They walk fast and attack fast. I advise bringing some healing items!");
        next;
    }
    mes "";
    mesn;
    mesq l("Okay, you can start!");

// Init Instance
OnStartOutside:
    .@ID=getcharid(0);
    @MAP_NAME$="nard@"+str(.@ID); // Max 4 chars for map name
    .@INSTID = instance_create("002-2@a"+(.@ID), getcharid(3), IOT_CHAR);
    .@instanceMapName$ = instance_attachmap("002-2", .@INSTID, 0, @MAP_NAME$);
    setq2 ShipQuests_Peter, 0;
    setq3 ShipQuests_Peter, .@INSTID;

    // It'll be self-destroyed when time runs out (2 minutes)
    instance_set_timeout(180, 180, .@INSTID);
    instance_init(.@INSTID);

    // Save in a less reliable way the challenge you took
    if (@peter == 2) {
        @peter=2;
        @pt_mob=Squirrel;
    } else if (@peter == 3) {
        @peter=4;
        @pt_mob=Ratto;
    } else if (@peter == 4) {
        @peter=8;
        @pt_mob=Croc;
    } else {
        @peter=0;
        @pt_mob=Ratto;
    }

    warp @MAP_NAME$, 33, 24;
    addtimer(100000, "Peter::OnLowTime");
    addtimer(120000, "Peter::OnTimeout");

    // Spawn the Monsters
    areamonster @MAP_NAME$, 23, 19, 57, 40, strmobinfo(1, @pt_mob), @pt_mob, 1, "RattosControl::OnRatto1Death";
    areamonster @MAP_NAME$, 23, 19, 57, 40, strmobinfo(1, @pt_mob), @pt_mob, 1, "RattosControl::OnRatto2Death";
    areamonster @MAP_NAME$, 23, 19, 57, 40, strmobinfo(1, @pt_mob), @pt_mob, 1, "RattosControl::OnRatto3Death";
    areamonster @MAP_NAME$, 23, 19, 57, 40, strmobinfo(1, @pt_mob), @pt_mob, 1, "RattosControl::OnRatto4Death";

    close;

OnTimeout:
    if (!(getmap() ~= "002-2") && !(getmap() ~= "nard"))
        end;
    .@q3 = getq3(ShipQuests_Peter);
    instance_destroy(.@q3);
    setq2 ShipQuests_Peter, 0;
    setq3 ShipQuests_Peter, -1;
    mesn;
    mesq l("Hey! Be careful. You can't stay in this basement for so long, you're going to get sick. Come outside and take a break, maybe you can try again later.");
    warp "002-1@"+LOCATION$, 35, 26;
    close;

OnDone:
    if (@peter)
        setq ShipQuests_Peter, getq(ShipQuests_Peter)|@peter, 0, -1;

    warp "002-1@"+LOCATION$, 35, 26;
    .@q = getq(ShipQuests_Peter);
    mesn;
    mesq l("Good job!") + " " + l("Here's your reward!");
    getexp @peter*52, @peter;
    switch (@peter) {
        case 2: @peter=350; break;
        case 4: @peter=550; break;
        case 8: @peter=1000; break;
    }

    Zeny = Zeny + @peter;
    message strcharinfo(0), l("You receive @@ GP!", @peter);
    close;

OnInit:
    .sex = G_MALE;
    .distance = 5;
    end;
}