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
|
// ==============================================================================
// BattleGround System - Flavius 2
// ==============================================================================
// Registration NPC's
// *********************************************************************
bat_room,142,227,4 script Registration::Fl2R_Guillaume 4_M_KY_KNT,{
end;
OnInit:
waitingroom "Battle Station 10 Players",10,"Flavius_BG2::OnGuillaumeJoin",1;
end;
OnEnterBG:
set $@FlaviusBG2_id1, waitingroom2bg("bat_b02",390,10,"Flavius_BG2::OnGuillaumeQuit","");
end;
}
bat_room,142,204,0 script Registration::Fl2R_Croix 4_M_CRU_KNT,{
end;
OnInit:
waitingroom "Battle Station 10 Players",10,"Flavius_BG2::OnCroixJoin",1;
end;
OnEnterBG:
set $@FlaviusBG2_id2, waitingroom2bg("bat_b02",10,290,"Flavius_BG2::OnCroixQuit","");
end;
}
// Battleground Engine
// *********************************************************************
- script Flavius_BG2 -1,{
end;
OnInit:
disablenpc "Guillaume Vintenar#fl2";
disablenpc "Croix Vintenar#fl2";
disablenpc "Therapist in battle#fl21";
disablenpc "Therapist in battle#fl22";
end;
OnGuillaumeQuit:
OnCroixQuit:
set BG_Delay_Tick, gettimetick(2) + 1200;
end;
OnGuillaumeJoin:
OnCroixJoin:
if( $@FlaviusBG2 == 0 )
donpcevent "Flavius_BG2::OnReadyCheck";
end;
OnReadyCheck:
if( $@FlaviusBG2 )
end;
set .@Guillaume, getwaitingroomstate(0,"Fl2R_Guillaume");
set .@Croix, getwaitingroomstate(0,"Fl2R_Croix");
if( .@Guillaume < 10 || .@Croix < 10 )
{
mapannounce "bat_room","Battleground -- Flavius [80-99] G: " + .@Guillaume + "/10, C: " + .@Croix + "/10",1,0x808000;
end;
}
// BG Variables
set $@FlaviusBG2, 1;
set $@FlaviusBG2_Victory, 0;
set .Guillaume_Score, 0;
set .Guillaume_Loss, 0;
set .Croix_Score, 0;
set .Croix_Loss, 0;
set .Match, 0;
// Prepare NPC
donpcevent "#gfl2_respawn::OnBGStart";
donpcevent "#cfl2_respawn::OnBGStart";
enablenpc "Therapist in battle#fl21";
enablenpc "Therapist in battle#fl22";
disablenpc "Guillaume Vintenar#fl2";
disablenpc "Croix Vintenar#fl2";
// Build and Warp Teams
donpcevent "Fl2R_Guillaume::OnEnterBG";
donpcevent "Fl2R_Croix::OnEnterBG";
announce "Battleground -- Flavius [80-99] has started!",0,0x808000;
initnpctimer;
// Start Match!!
OnRoundStart:
sleep 2000;
if( $@FlaviusBG2 != 1 ) end;
areapercentheal "bat_b02",382,2,397,17,100,100;
areapercentheal "bat_b02",2,282,17,297,100,100;
bg_warp $@FlaviusBG2_id1,"bat_b02",311,224;
bg_warp $@FlaviusBG2_id2,"bat_b02",87,75;
sleep 2000;
if( $@FlaviusBG2 != 1 ) end;
set .Match, .Match + 1;
// Crystal Spawn
set .Guillaume_Crystal, bg_monster($@FlaviusBG2_id1,"bat_b02",328,150,"Crystal Guillaume",1914,"Flavius_BG2::OnGuillaumeBreak");
setcell "bat_b02",327,151,329,149,cell_basilica,1;
setcell "bat_b02",327,151,329,149,cell_walkable,1;
set .Croix_Crystal, bg_monster($@FlaviusBG2_id2,"bat_b02",62,150,"Crystal Croix",1915,"Flavius_BG2::OnCroixBreak");
setcell "bat_b02",62,149,60,151,cell_basilica,1;
setcell "bat_b02",62,149,60,151,cell_walkable,1;
// Guardian Spawns
bg_monster $@FlaviusBG2_id1,"bat_b02",328,160,"Guillaume Guardian",1949,"Flavius_BG2::OnGuiGuardian";
bg_monster $@FlaviusBG2_id1,"bat_b02",328,140,"Guillaume Guardian",1950,"Flavius_BG2::OnGuiGuardian";
set .Guillaume_Guardian, 2;
bg_monster $@FlaviusBG2_id2,"bat_b02",62,160,"Croix Guardian",1949,"Flavius_BG2::OnCroGuardian";
bg_monster $@FlaviusBG2_id2,"bat_b02",61,140,"Croix Guardian",1950,"Flavius_BG2::OnCroGuardian";
set .Croix_Guardian, 2;
// Announces
mapannounce "bat_b02","The Battle of Flavius [ " + .Match + " ] Round has begun!!",1,0x808000;
end;
OnRoundStop:
// Remove Monsters
killmonster "bat_b02","Flavius_BG2::OnGuiGuardian";
killmonster "bat_b02","Flavius_BG2::OnCroGuardian";
setcell "bat_b02",327,151,329,149,cell_walkable,0;
setcell "bat_b02",327,151,329,149,cell_basilica,0;
killmonster "bat_b02","Flavius_BG2::OnGuillaumeBreak";
setcell "bat_b02",62,149,60,151,cell_walkable,0;
setcell "bat_b02",62,149,60,151,cell_basilica,0;
killmonster "bat_b02","Flavius_BG2::OnCroixBreak";
end;
OnGuiGuardian:
if( set(.Guillaume_Guardian, .Guillaume_Guardian - 1) <= 0 )
{
setcell "bat_b02",327,151,329,149,cell_walkable,0;
setcell "bat_b02",327,151,329,149,cell_basilica,0;
mapannounce "bat_b02","The Guillaume Crystal is vulnerable to attack!",1,0x0000FF;
}
end;
OnCroGuardian:
if( set(.Croix_Guardian, .Croix_Guardian - 1) <= 0 )
{
setcell "bat_b02",62,149,60,151,cell_walkable,0;
setcell "bat_b02",62,149,60,151,cell_basilica,0;
mapannounce "bat_b02","The Croix Crystal is vulnerable to attack!",1,0xFF0000;
}
end;
OnGuillaumeBreak:
donpcevent "Flavius_BG2::OnRoundStop";
set .Guillaume_Loss, .Guillaume_Loss + 1;
if( set(.Croix_Score, .Croix_Score + 1) < 2 )
{
bg_updatescore "bat_b02",.Guillaume_Score,.Croix_Score;
mapannounce "bat_b02","The Guillaume Crystal has been destroyed!",1,0x0000FF;
donpcevent "Flavius_BG2::OnRoundStart";
}
else
{
bg_updatescore "bat_b02",.Guillaume_Score,.Croix_Score;
mapannounce "bat_b02","The Croix army has won the Battle of Flavius!",1,0xFF0000;
set $@FlaviusBG2_Victory, 2;
donpcevent "Flavius_BG2::OnMatchEnd";
}
end;
OnCroixBreak:
donpcevent "Flavius_BG2::OnRoundStop";
set .Croix_Loss, .Croix_Loss + 1;
if( set(.Guillaume_Score, .Guillaume_Score + 1) < 2 )
{
bg_updatescore "bat_b02",.Guillaume_Score,.Croix_Score;
mapannounce "bat_b02","The Croix Crystal has been destroyed!",1,0xFF0000;
donpcevent "Flavius_BG2::OnRoundStart";
}
else
{
bg_updatescore "bat_b02",.Guillaume_Score,.Croix_Score;
mapannounce "bat_b02","The Guillaume army has won the Battle of Flavius!",1,0x0000FF;
set $@FlaviusBG2_Victory, 1;
donpcevent "Flavius_BG2::OnMatchEnd";
}
end;
OnTimer2400000:
mapannounce "bat_b02","Battle of Flavius will ends in 5 minutes",1,0x808000;
end;
OnTimer2640000:
mapannounce "bat_b02","Battle of Flavius will ends in 1 minute",1,0x808000;
end;
OnTimer2700000:
if( .Croix_Score > .Guillaume_Score )
{
mapannounce "bat_b02","The Croix army has won the Battle of Flavius!",1,0xFF0000;
set $@FlaviusBG2_Victory, 2;
}
else if( .Croix_Score < .Guillaume_Score )
{
mapannounce "bat_b02","The Guillaume army has won the Battle of Flavius!",1,0x0000FF;
set $@FlaviusBG2_Victory, 1;
}
else
{
mapannounce "bat_b02","The Battle of Flavius is over. The time is out, this is a Tie",1,0x808000;
set $@FlaviusBG2_Victory, 3;
}
OnMatchEnd:
set $@FlaviusBG2, 2;
stopnpctimer;
donpcevent "#gfl2_respawn::OnBGStop";
donpcevent "#cfl2_respawn::OnBGStop";
disablenpc "Therapist in battle#fl21";
disablenpc "Therapist in battle#fl22";
enablenpc "Guillaume Vintenar#fl2";
enablenpc "Croix Vintenar#fl2";
sleep 2000;
bg_warp $@FlaviusBG2_id1,"bat_b02",390,10;
bg_warp $@FlaviusBG2_id2,"bat_b02",10,290;
sleep 3000;
mapannounce "bat_b02","Battle of Flavius will close in 1 minute!",1,0x808000;
initnpctimer;
end;
OnTimer30000:
if( $@FlaviusBG2 == 2 )
mapannounce "bat_b02","Battle of Flavius will close in 30 seconds!",1,0x808000;
end;
OnTimer50000:
if( $@FlaviusBG2 == 2 )
mapannounce "bat_b02","Battle of Flavius will close in 10 seconds!",1,0x808000;
end;
OnTimer60000:
if( $@FlaviusBG2 != 2 )
end;
OnReset:
stopnpctimer;
donpcevent "Flavius_BG2::OnRoundStop";
set .Guillaume_Score, 0;
set .Guillaume_Crystal, 0;
set .Guillaume_Loss, 0;
set .Croix_Score, 0;
set .Croix_Crystal, 0;
set .Croix_Loss, 0;
set .Match, 0;
set $@FlaviusBG2_Victory, 0;
// NPC's
disablenpc "Guillaume Vintenar#fl2";
disablenpc "Croix Vintenar#fl2";
disablenpc "Therapist in battle#fl21";
disablenpc "Therapist in battle#fl22";
if( $@FlaviusBG2_id1 ) { bg_destroy $@FlaviusBG2_id1; set $@FlaviusBG2_id1, 0; }
if( $@FlaviusBG2_id2 ) { bg_destroy $@FlaviusBG2_id2; set $@FlaviusBG2_id2, 0; }
sleep 1000;
mapwarp "bat_b02","bat_room",155,150;
sleep 2000;
maprespawnguildid "bat_b02",0,3; // Just in case someone else
sleep 2000;
bg_updatescore "bat_b02",0,0;
set $@FlaviusBG2, 0;
donpcevent "Flavius_BG2::OnReadyCheck";
end;
}
// Battleground rewards
// *********************************************************************
bat_b02,390,13,5 script Guillaume Vintenar#fl2 4_M_KY_HEAD,{
if( $@FlaviusBG2_Victory )
{
if( $@FlaviusBG2_Victory == Bat_Team )
{ // Victory
mes "[Swandery]";
mes "Blessed Guillaume!!";
mes "Let's enjoy our glorious victory!";
mes "" + strcharinfo(0) + ", its a sign reflecting victory";
close2;
set .@Reward, 9;
}
else
{ //
mes "[Swandery]";
mes "You lost, but you're dedicated to this battle.";
mes "This is a reward for your great dedication by Guillaume Marollo!";
mes "Just take this defeat a lesson, and later you would definitely learn.";
close2;
set .@Reward, 3;
}
setquest 2070;
getitem 7829, .@Reward;
bg_leave;
warp "bat_room",155,150;
end;
}
end;
}
bat_b02,10,293,5 script Croix Vintenar#fl2 4_M_CRU_HEAD,{
if( $@FlaviusBG2_Victory )
{
if( $@FlaviusBG2_Victory == Bat_Team )
{ // Victory
mes "[Swandery]";
mes "Blessed Croax!!";
mes "Let's enjoy our glorious victory!";
mes "" + strcharinfo(0) + ", its a sign reflecting victory";
close2;
set .@Reward, 9;
}
else
{ //
mes "[Swandery]";
mes "Oh, " + strcharinfo(0) + ". Don't be sad.";
mes "Even though we didn't win, we did our best.";
mes "This is a Royal gift from Croix, and please don't forget this battle. We can win the next.";
close2;
set .@Reward, 3;
}
setquest 2070;
getitem 7829, .@Reward;
bg_leave;
warp "bat_room",155,150;
end;
}
end;
}
// Battleground Therapist
// *********************************************************************
bat_b02,390,13,5 script Therapist in battle#fl22 4_F_SISTER,{
mes "[Therapist in battle]";
mes "Just close your eyes, and take a deep breathe.";
mes "You can be free from pain.";
specialeffect2 312;
close;
}
bat_b02,10,293,5 script Therapist in battle#fl21 4_F_SISTER,{
mes "[Therapist in battle]";
mes "Just close your eyes, and take a deep breathe.";
mes "You can be free from pain.";
specialeffect2 312;
close;
}
// Battleground Respawn
// *********************************************************************
bat_b02,390,10,0 script #gfl2_respawn HIDDEN_WARP_NPC,{
end;
OnBGStart:
initnpctimer;
end;
OnBGStop:
stopnpctimer;
end;
OnTimer24000:
misceffect 83;
end;
OnTimer25000:
areapercentheal "bat_b02",382,2,397,17,100,100;
areawarp "bat_b02",382,2,397,17,"bat_b02",311,224;
initnpctimer;
end;
}
bat_b02,10,290,0 script #cfl2_respawn HIDDEN_WARP_NPC,{
end;
OnBGStart:
initnpctimer;
end;
OnBGStop:
stopnpctimer;
end;
OnTimer24000:
misceffect 83;
end;
OnTimer25000:
areapercentheal "bat_b02",2,282,17,297,100,100;
areawarp "bat_b02",2,282,17,297,"bat_b02",87,75;
initnpctimer;
end;
}
// Flags
// *********************************************************************
bat_b02,304,231,1 duplicate(Guillaume camp#bat) Guillaume camp#bat32 1_FLAG_LION
bat_b02,319,231,1 duplicate(Guillaume camp#bat) Guillaume camp#bat33 1_FLAG_LION
bat_b02,304,218,1 duplicate(Guillaume camp#bat) Guillaume camp#bat34 1_FLAG_LION
bat_b02,319,218,1 duplicate(Guillaume camp#bat) Guillaume camp#bat35 1_FLAG_LION
bat_b02,304,231,1 duplicate(Guillaume camp#bat) Guillaume camp#bat36 1_FLAG_LION
bat_b02,304,231,1 duplicate(Guillaume camp#bat) Guillaume camp#bat37 1_FLAG_LION
bat_b02,335,142,1 duplicate(Guillaume camp#bat) Guillaume camp#bat38 1_FLAG_LION
bat_b02,335,157,1 duplicate(Guillaume camp#bat) Guillaume camp#bat39 1_FLAG_LION
bat_b02,390,16,1 duplicate(Guillaume camp#bat) Guillaume camp#bat40 1_FLAG_LION
bat_b02,292,163,1 duplicate(Guillaume camp#bat) Guillaume camp#bat41 1_FLAG_LION
bat_b02,292,136,1 duplicate(Guillaume camp#bat) Guillaume camp#bat42 1_FLAG_LION
bat_b02,241,185,1 duplicate(Guillaume camp#bat) Guillaume camp#bat43 1_FLAG_LION
bat_b02,247,179,1 duplicate(Guillaume camp#bat) Guillaume camp#bat44 1_FLAG_LION
bat_b02,96,81,1 duplicate(Croix camp#bat) Croix camp#bat30 1_FLAG_EAGLE
bat_b02,96,68,1 duplicate(Croix camp#bat) Croix camp#bat31 1_FLAG_EAGLE
bat_b02,79,81,1 duplicate(Croix camp#bat) Croix camp#bat32 1_FLAG_EAGLE
bat_b02,79,68,1 duplicate(Croix camp#bat) Croix camp#bat33 1_FLAG_EAGLE
bat_b02,96,81,1 duplicate(Croix camp#bat) Croix camp#bat34 1_FLAG_EAGLE
bat_b02,96,81,1 duplicate(Croix camp#bat) Croix camp#bat35 1_FLAG_EAGLE
bat_b02,59,164,1 duplicate(Croix camp#bat) Croix camp#bat36 1_FLAG_EAGLE
bat_b02,59,137,1 duplicate(Croix camp#bat) Croix camp#bat37 1_FLAG_EAGLE
bat_b02,10,296,1 duplicate(Croix camp#bat) Croix camp#bat38 1_FLAG_EAGLE
bat_b02,110,162,1 duplicate(Croix camp#bat) Croix camp#bat39 1_FLAG_EAGLE
bat_b02,110,137,1 duplicate(Croix camp#bat) Croix camp#bat40 1_FLAG_EAGLE
bat_b02,152,120,1 duplicate(Croix camp#bat) Croix camp#bat41 1_FLAG_EAGLE
bat_b02,158,114,1 duplicate(Croix camp#bat) Croix camp#bat42 1_FLAG_EAGLE
|