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
|
// TMW 2 Script
// Author:
// Jesusalva
// Micksha
// Description:
// Basement Boss Fight
042-2,41,22,0 script #KDoor0422 NPC_HIDDEN,0,0,{
function kdoor0422Spawn;
end;
OnTouch:
.@label$=instance_npcname(.name$)+"::OnKillBoss";
.@g=getcharid(2);
if (($KAMELOT_QUEST[.@g] & 4) && !mobcount(getmap(), .@label$)) {
warp "042-2@"+.@g, 58, 139;
} else {
dispbottom l("Powerful magic repels you!");
percentheal -5, -5;
slide 38, 28;
}
end;
OnArrival:
.@g=getcharid(2);
if (.@g < 1)
percentheal -100, -100;
if (getmap() != "042-2@"+.@g)
end;
if ($@KAMELOT_WAVE[.@g] != 3)
end;
$@KAMELOT_WAVE[.@g]+=1;
initnpctimer;
//if ($@KAMELOT_WAVE == 0)
// goto OnKillMob;
// TODO: Fire dialog
// TODO: Stun yourself for cutscene
// ...
end;
OnTimer1000:
.@m$=instance_mapname("042-2");
mapannounce .@m$, "??? : What's this? Why do I hear a commotion up there??", 0;
.@gcount=$KAMELOT_PC[.@g];
kdoor0422Spawn(.@gcount*2, 20, 24, 59, 59); // Prologue monsters
end;
OnTimer30000:
.@m$=instance_mapname("042-2");
mapannounce .@m$, "??? : WHAT?! It is not possible. Who are you, and how did you manage to come down here?", 0;
.@gcount=$KAMELOT_PC[.@g];
end;
OnTimer35000:
.@m$=instance_mapname("042-2");
.@n$=instance_npcname(.name$);
mapannounce .@m$, "??? : The sheer power of our lord should prevent anyone not under his control to go here.", 0;
maptimer .@m$, 5000, .@n$+"::OnVerifyIntent";
end;
OnTimer60000:
.@m$=instance_mapname("042-2");
mapannounce .@m$, "??? : HAHAHA! Meh, you will die anyways, so I can tell you that you never will even see our Lord.", 0;
end;
OnTimer67000:
.@m$=instance_mapname("042-2");
mapannounce .@m$, "??? : You require the key hidden in the caves, additionally you must overcome the magical seal.", 0;
end;
OnTimer74000:
.@m$=instance_mapname("042-2");
mapannounce .@m$, "??? : Both is impossible for weaklings like you lot.", 0;
end;
OnTimer80000:
.@m$=instance_mapname("042-2");
mapannounce .@m$, "General Krukan : Both is impossible for weaklings like you lot. Minions, ATTACK!", 0;
kdoor0422Spawn(.@gcount*2, 20, 24, 59, 59);
end;
OnTimer100000:
.@m$=instance_mapname("042-2");
mapannounce .@m$, "General Krukan : MUhahahahaha! Minions, Dispose of these Adventurers! Kill them already!", 0;
kdoor0422Spawn(.@gcount*2, 20, 24, 59, 59);
end;
OnTimer120000:
.@m$=instance_mapname("042-2");
mapannounce .@m$, "General Krukan : *facepalm* Now, you're just being pathetic minions. How about you try a different approach and kill them already!", 0;
kdoor0422Spawn(.@gcount*2, 20, 24, 59, 59);
end;
OnTimer180000:
.@m$=instance_mapname("042-2");
.@n$=instance_npcname(.name$);
mapannounce .@m$, "General Krukan : Looks like if you want something done right you have to do it yourself. Charge!", 0;
.@gcount=$KAMELOT_PC[.@g];
kdoor0422Spawn(.@gcount*3, 20, 24, 59, 59);
.@mob=monster(.@m$, 34, 26, strmobinfo(1, GeneralKrukan), GeneralKrukan, 1, .@n$+"::OnKillBoss");
// Reconfigure the monster
setunitdata(.@mob, UDT_LEVEL, .@avg);
setunitdata(.@mob, UDT_STR, 1+.@avg/3);
setunitdata(.@mob, UDT_AGI, 1+.@avg/3);
setunitdata(.@mob, UDT_VIT, 1+.@avg/3);
setunitdata(.@mob, UDT_INT, 1+.@avg/3);
setunitdata(.@mob, UDT_DEX, 1+.@avg/3);
setunitdata(.@mob, UDT_LUK, 1+.@avg/3);
setunitdata(.@mob, UDT_ADELAY, 1372);
setunitdata(.@mob, UDT_ATKRANGE, 3);
// Battle Status
setunitdata(.@mob, UDT_MAXHP, .@avg*300);
setunitdata(.@mob, UDT_HP, .@avg*400);
setunitdata(.@mob, UDT_ATKMIN, .@avg*65/10);
setunitdata(.@mob, UDT_ATKMAX, .@avg*85/10);
setunitdata(.@mob, UDT_DEF, 1+.@avg);
setunitdata(.@mob, UDT_MDEF, 1+.@avg*8/10);
setunitdata(.@mob, UDT_HIT, .@avg*12); // Advised: x3
setunitdata(.@mob, UDT_FLEE, .@avg*39/10); // Advised: x4
// Critical calculation
.@min=15;
.@max=max(.@min, min(50, .@avg/4));
setunitdata(.@mob, UDT_CRIT, rand2(.@min, .@max));
// Loop through
setd("$@GTEMP_"+.@m$, .@mob);
setd("$@GTEMP1_"+.@m$, 10);
setd("$@GTEMP2_"+.@m$, .@gdcount);
end;
OnTimer185000:
.@m$=instance_mapname("042-2");
.@mob=getd("$@GTEMP_"+.@m$);
.@gdcount=getd("$@GTEMP2_"+.@m$);
.@ratio=getunitdata(.@mob, UDT_HP)*10/getunitdata(.@mob, UDT_MAXHP);
if (.@ratio < getd("$@GTEMP1_"+.@m$)) {
mapannounce .@m$, "General Krukan : "+any("Charge!", "To the Abyss with you already!", "Kill them already!", "More of them are coming!", "Minions, ATTACK!"), 0;
kdoor0422Spawn(.@gcount*2, 20, 24, 59, 59);
setd("$@GTEMP1_"+.@m$, .@ratio);
}
setnpctimer 180001;
end;
OnVerifyIntent:
.@g=getcharid(2);
if (.@g < 1) percentheal -100, -100;
mesq l("Who are you, and how did you manage to come down here? The sheer power of our Lord prevents anyone not under his control to go here.");
select
l("We are strong fighters, and we want to free the King from his obsession."),
l("Oh, yea, you are right, it was a mistake. Bye-bye.");
mes "";
if (@menu == 2) {
mesc l("ARE YOU SURE?"), 1;
mesc l("This will remove you from the quest!");
next;
if (askyesno() == ASK_YES) {
mapannounce getmap(), "General Krukan : I praise you for running away, "+strcharinfo(0)+". You're not a fool it seems.", 0;
warp "014-4", 67, 27;
percentheal 100, 100;
closeclientdialog;
end;
}
} else {
getexp $KAMELOT_MX[.@g]*6, $KAMELOT_MX[.@g]*2;
}
mesc l("With fresh conviction, you prepare yourself to the fight which draws near.");
getitem GuildCoin, 1;
close;
OnKillMob:
if (!playerattached()) end;
.@g=getcharid(2);
if (.@g < 1) percentheal -100, -100;
getexp $KAMELOT_MX[.@g]*5, $KAMELOT_MX[.@g]*2;
end;
OnKillBoss:
setd("$@GTEMP_"+.@m$, 0);
setd("$@GTEMP1_"+.@m$, 0);
setd("$@GTEMP2_"+.@m$, 0);
.@g=getcharid(2);
dispbottom l("This is all in KAMELOT for now.");
$KAMELOT_QUEST[.@g]=$KAMELOT_QUEST[.@g]|4; // FIXME
// Player Reward for completing this stage
getitem GuildCoin, min(1, $KAMELOT_MX[.@g]/20);
getexp $KAMELOT_MX[.@g]*50, $KAMELOT_MX[.@g]*10;
// Guild Reward for completing this stage
.@ggp=300+$KAMELOT_MX[.@g]*5;
.@gxp=$KAMELOT_MX[.@g]*10;
$GUILD_BANK[.@g]+=.@ggp;
guildgetexp(.@gxp); // 10xp per player average level (max 1000/1500)
// Announce
mapannounce getmap(), strcharinfo(0)+" has defeated Krukan!", 0;
// Guild Master Notification
.@gm$=getguildmaster(.@g);
if (!getcharid(3, .@gm$)) end;
.@gma=getcharid(3, .@gm$);
.@gmb=getcharid(0, .@gm$);
if (!isloggedin(.@gma, .@gmb)) end;
message .@gm$, strcharinfo(0)+" defeated Krukan: Guild GP +"+.@ggp+" Guild XP +"+.@gxp;
// TODO: maptimer to give EXP to helpers/survivors
// TODO: Arrest scene
// TODO: Actual arresting
end;
function kdoor0422Spawn {
.@label$=instance_npcname(.name$)+"::OnKillMob";
.@gcount=getarg(0);
.@x1=getarg(1);
.@y1=getarg(2);
.@x2=getarg(3);
.@y2=getarg(4);
.@avg=$KAMELOT_MX[.@g];
.@m$=getmap();
freeloop(true);
for (.@i=0; .@i < .@gcount; .@i++) {
.@mobId=any(CursedSoldier, CursedArcher); // 50-50 ratio
.@mob=areamonster(.@m$, 21, 24, 59, 99, strmobinfo(1, .@mobId), .@mobId, 1, .@label$);
// Reconfigure the monster
setunitdata(.@mob, UDT_LEVEL, .@avg);
setunitdata(.@mob, UDT_STR, 1+.@avg/4);
setunitdata(.@mob, UDT_AGI, 1+.@avg/4);
setunitdata(.@mob, UDT_VIT, 1+.@avg/4);
setunitdata(.@mob, UDT_INT, 1+.@avg/4);
setunitdata(.@mob, UDT_DEX, 1+.@avg/4);
setunitdata(.@mob, UDT_LUK, 1+.@avg/4);
setunitdata(.@mob, UDT_ADELAY, 1672);
setunitdata(.@mob, UDT_ATKRANGE, (.@mobId == CursedArcher ? any(6,7) : any(1,2)));
// Battle Status
setunitdata(.@mob, UDT_MAXHP, .@avg*33);
setunitdata(.@mob, UDT_HP, .@avg*33);
setunitdata(.@mob, UDT_ATKMIN, .@avg*45/10);
setunitdata(.@mob, UDT_ATKMAX, .@avg*65/10);
setunitdata(.@mob, UDT_DEF, 1+.@avg*9/10);
setunitdata(.@mob, UDT_MDEF, 1+.@avg*5/10);
setunitdata(.@mob, UDT_HIT, .@avg*4); // Advised: x3
setunitdata(.@mob, UDT_FLEE, .@avg*35/10); // Advised: x4
// Critical calculation
.@min=2;
.@max=max(.@min, min(25, .@avg/5));
setunitdata(.@mob, UDT_CRIT, rand2(.@min, .@max));
// Loop through
}
freeloop(false);
return;
}
// Script end
}
|