summaryrefslogtreecommitdiff
path: root/npc/005-1/ayasha.txt
blob: eb0c761d5b4664d4eddf5188a2de21fd15047918 (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
// Author:
//    Crazyfefe
//    Jesusalva
// Description:
//  Ayasha takes care of the children of Candor Village, and is in charge of protecting them.
//  The kids sometimes go play outside of city walls, and this makes her upset.
//  Even if no attack happened in Candor for a while.
// Variables:
//  CandorQuest_HAS
//      0: Not met
//      1: Already met
//      2: Quest ongoing
//      3: Found all kids
//      4: Reward given

005-1,52,81,0	script	Ayasha	NPC_HUMAN_FEMALE_NOOB,{

    
    function quest_findAllKids
    {
        setq CandorQuest_HAS, 2;
        mesn;
        mesq l("Good luck!");
        close;
    }

    .@has = getq(CandorQuest_HAS);
    if (.@has == 0)
    {
        speech S_LAST_NEXT,
            l("Ah, the kids are playing hide and seek, but I am afraid they went too far. A monster attack could start anytime, after all."),
            l("I am currently very worried with them. They're just children! They don't know how to fight!"),
            l("Could you perhaps help me to find all kids?");
        do
        {
            select
                l("Yes!"),
                l("I can't, sorry.");

            setq CandorQuest_HAS, 1;
            switch (@menu)
            {
                case 1:
                    quest_findAllKids;
                    break;
            }
        } while (@menu != 2);
    }
    else if (.@has == 1)
    {
        mesn;
        mesq l("Even if the city has not been attacked on the last few years, I can't help but be concerned while the kids are playing hide and seek."),
        next;
        mesq l("Could you perhaps help me to find all kids?");
        next;

        do
        {
            select
                l("Yes!"),
                l("I can't, sorry.");

            switch (@menu)
            {
                case 1:
                    quest_findAllKids;
                    break;
            }
        } while (@menu != 2);
    }
    else if (.@has == 2)
    {
        mesn;
        mesq l("You still haven't found all of them yet.");
        close;
    }
    else if (.@has == 3)
    {
        speech S_LAST_NEXT,
            l("Thank you, here is your reward and... some pocket money.");
            narrator("You receive 30 exp and 50 GP.");
        getexp 30, 0;
        Zeny = (Zeny + 50);
        setq CandorQuest_HAS, 4;
        close;
    }
    else
    {
        mesn;
        mesq l("Thank you for your help.");
        if (BaseLevel >= 24 && gettimetick(2) > .RENT_TIME) goto L_Sword;
        close;
    }

    //closedialog;
    //goodbye;
    close;

L_Sword:
    menu
        l("The children are safe, could you rent me your sword?"), L_Rent,
        l("You're welcome!"), -;
    close;

L_Rent:
    // This code is equivalent to: speech S_FIRST_BLANK_LINE | S_LAST_NEXT
    mes "";
    mesn;
    mesq l("Ah, I guess you want to fight at the cave north of me...");
    next;
    mesq l("The children are safe, aren't they...?");
    next;
    mesq l("I can rent it to you for 500 GP, during 15 minutes. Deal?");
    next;
    menu
        rif(Zeny >= 500 && gettimetick(2) > .RENT_TIME, l("Deal!")), L_DoRent,
        l("Maybe later."), -;
    close;

L_DoRent:
    if (gettimetick(2) <= .RENT_TIME) mesq l("Sorry, you was taking too long to decide and I've rented my sword to somebody else.");
    if (gettimetick(2) <= .RENT_TIME) close;
    .RENT_TIME=gettimetick(2)+(15*60);
    set Zeny, Zeny - 500;
    // Here must use item ID
    rentitem 3518, (15*60);
    mes "";
    mesn;
    mesq l("Here it is. Take care with it!");
    close;

OnInit:
    .sex = G_FEMALE;
    .distance = 5;
    .RENT_TIME=0;
    end;
}


function	script	CheckEnfant	{
    @kids_count = 0;
    @count_tmp = 0;
    if (debug)
        npctalk3 l("Hello, I am K-@@, of the @@ order.", @kids, $@KidsBits[@kids]);
    if (STARTAREA & $@KidsBits[@kids])
        goto L_Already;
    STARTAREA = STARTAREA | $@KidsBits[@kids];

    goto L_Loop;

L_KidsTally:
    if (debug)
        npctalk3 l("You found @@ out of @@ kids.", @kids_count, @count_tmp);
    if (@kids_count == 6)
    {
        message strcharinfo(0), "That must have been the last kid.";
        setq CandorQuest_HAS, 3;
    }
    speech S_FIRST_BLANK_LINE | S_LAST_NEXT,
        l("Oh! You found me. Good job!");
        narrator("You receive 5 exp.");
    getexp 5,0;
    close;
    return;

L_Loop:
    while (@count_tmp < 6) {
        if (STARTAREA & $@KidsBits[@count_tmp])
            @kids_count = (@kids_count + 1);
        @count_tmp = (@count_tmp + 1);
    }
    goto L_KidsTally;

L_Already:
    mesn;
    mesq l("Thanks for playing with us! Can you find my friends?");
    close;

    return;
}
005-1,69,90,0	script	Charda	NPC_CHILD8,{
    @kids = 0;
    if (getq(CandorQuest_HAS) == 2)
    {
        CheckEnfant();
    } else {
        mes l("The kid is not paying attention to you.");
        close;
    }
    end;
OnInit:
    // This works at same var from KidsBits. We start counting from 10, then.
    setarray $@KidsBits, (1 << 10), (1 << 11), (1 << 12), (1 << 13), (1 << 14), (1 << 15);
    .sex = G_OTHER;
    .distance = 1;
    end;
}
005-1,23,84,0	script	Faris	NPC_CHILD7,{
    @kids = 1;
    if (getq(CandorQuest_HAS) == 2)
    {
        CheckEnfant();
    } else {
        mes l("The kid is not paying attention to you.");
        close;
    }
    end;
OnInit:
    .sex = G_MALE;
    .distance = 1;
    end;
}
005-1,84,21,0	script	Ghada	NPC_CHILD5,{
    @kids = 2;
    if (getq(CandorQuest_HAS) == 2)
    {
        CheckEnfant();
    } else {
        mes l("The kid is not paying attention to you.");
        close;
    }
    end;
OnInit:
    .sex = G_MALE;
    .distance = 1;
    end;
}
005-1,38,58,0	script	Latif	NPC_HUMAN_M_ARTIS,{
    @kids = 3;
    if (getq(CandorQuest_HAS) == 2)
    {
        CheckEnfant();
    } else {
        mes l("The kid is not paying attention to you.");
        close;
    }
    end;
OnInit:
    .sex = G_MALE;
    .distance = 1;
    end;
}
005-1,18,43,0	script	Rasin	NPC_CHILD3,{
    @kids = 4;
    if (getq(CandorQuest_HAS) == 2)
    {
        CheckEnfant();
    } else {
        mes l("The kid is not paying attention to you.");
        close;
    }
    end;
OnInit:
    .sex = G_MALE;
    .distance = 1;
    end;
}
005-1,38,65,0	script	Lilly	NPC_CHILD6,{
    @kids = 5;
    if (getq(CandorQuest_HAS) == 2)
    {
        CheckEnfant();
    } else {
        mes l("The kid is not paying attention to you.");
        close;
    }
    end;
OnInit:
    .sex = G_MALE;
    .distance = 1;
    end;
}

005-1,53,81,0	script	AyashaDebug	NPC_MONA,{
    showavatar NPC_MONA;  // this is handled by avatars.xml
    mesn;
    mesq l("Reset?");
    next;
    menu
        l("Yes."),  L_Reset,
        l("Test"),  L_Charda,

        l("No."),   L_Close;

L_Reset:
    setq CandorQuest_HAS, 0;
    STARTAREA = STARTAREA &~ (1 << 10);
    STARTAREA = STARTAREA &~ (1 << 11);
    STARTAREA = STARTAREA &~ (1 << 12);
    STARTAREA = STARTAREA &~ (1 << 13);
    STARTAREA = STARTAREA &~ (1 << 14);
    STARTAREA = STARTAREA &~ (1 << 15);
    mes l("Reset!");
    goto L_Close;

L_Charda:
    STARTAREA = STARTAREA &~ (1 << 10);
    mes l("Charda clean!");
    goto L_Close;

L_Close:
    //showavatar;  // Use this to hide the showavatar
    close;

// Use @shownpc to enable AyashaDebug
OnInit:
    if (!debug)
        disablenpc .name$;
    end;
}