summaryrefslogtreecommitdiff
path: root/npc/battleground/bg_tierra_02.txt
blob: 9cc78a4cc10f57f2357aec6b78b92186a81d5a4e (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
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
// ==============================================================================
// BattleGround System - Tierra Valley 2
// ==============================================================================

// Registration NPC's
// *********************************************************************

bat_room,85,97,4	script	Registration::TV2R_Guillaume	418,{
	end;
OnInit:
	waitingroom "Battle Station 10 Players",10,"Tierra_BG2::OnGuillaumeJoin",1;
	end;
OnEnterBG:
	set $@TierraBG2_id1, waitingroom2bg("bat_a02",50,374,"Tierra_BG2::OnGuillaumeQuit","");
	end;
}

bat_room,85,74,0	script	Registration::TV2R_Croix	414,{
	end;
OnInit:
	waitingroom "Battle Station 10 Players",10,"Tierra_BG2::OnCroixJoin",1;
	end;
OnEnterBG:
	set $@TierraBG2_id2, waitingroom2bg("bat_a02",42,16,"Tierra_BG2::OnCroixQuit","");
	end;
}

// Battleground Engine
// *********************************************************************

-	script	Tierra_BG2	-1,{
	end;

OnInit:
	disablenpc "Croix Vintenar#tv2";
	disablenpc "Guillaume Vintenar#tv2";
	disablenpc "Therapist in battle#tv21";
	disablenpc "Therapist in battle#tv22";
	end;

OnGuillaumeQuit:
OnCroixQuit:
	set BG_Delay_Tick, gettimetick(2) + 1200;
	end;

OnGuillaumeJoin:
OnCroixJoin:
	if( $@TierraBG2 == 0 )
		donpcevent "Tierra_BG2::OnReadyCheck";
	end;

OnReadyCheck:
	if( $@TierraBG2 )
		end;
	set .@Guillaume, getwaitingroomstate(0,"TV2R_Guillaume");
	set .@Croix, getwaitingroomstate(0,"TV2R_Croix");

	if( .@Guillaume < 10 || .@Croix < 10 )
	{
		mapannounce "bat_room","Battleground -- Tierra Valley [80-99] G: " + .@Guillaume + "/10, C: " + .@Croix + "/10",1,0xF4A460;
		end;
	}

	set $@TierraBG2, 1;
	donpcevent "TV2R_Croix::OnEnterBG";
	donpcevent "TV2R_Guillaume::OnEnterBG";
	donpcevent "Guillaume_TV2B::OnBuild";
	donpcevent "Croix_TV2B::OnBuild";
	bg_monster $@TierraBG2_id1,"bat_a02",176,345,"Food Depot",1909,"Tierra_BG2::OnGuillaumeBreak";
	bg_monster $@TierraBG2_id2,"bat_a02",167,50,"Food Storage",1910,"Tierra_BG2::OnCroixBreak";
	bg_monster 0,"bat_a02",273,204,"Neutrality Flag",1911,"Tierra_BG2::OnNeutralBreak";
	
	set .Neutral_Base, 0;
	set $@TierraBG2_Victory, 0;

	set .Guardian_1, 0;
	set .Guardian_2, 0;
	set .Guardian_3, 0;

	enablenpc "Therapist in battle#tv21";
	enablenpc "Therapist in battle#tv22";
	disablenpc "Croix Vintenar#tv2";
	disablenpc "Guillaume Vintenar#tv2";
	// Respawner
	donpcevent "#gtv2_respawn::OnBGStart";
	donpcevent "#ctv2_respawn::OnBGStart";
	donpcevent "#ntv2_respawn::OnBGStart";
	// Warp Teams
	announce "Battleground -- Tierra Valley [80-99] has started!",0,0xF4A460;
	bg_warp $@TierraBG2_id1,"bat_a02",353,344;
	bg_warp $@TierraBG2_id2,"bat_a02",353,52;
	// Final Messages
	sleep 6000;
	mapannounce "bat_a02","Guillaume Vintenar Axl Rose : Let's attack to burn down Croix's food storage",1,0x0000FF;
	sleep 2000;
	mapannounce "bat_a02","Croix Vintenar Swandery : Master of Valhalla! Let us be gifted with unfailing faith and courage",1,0xFF0000;
	
	initnpctimer;
	end;

OnNeutralBreak:
	if( getcharid(4) == $@TierraBG2_id1 )
	{
		mapannounce "bat_a02","Guillaume obtained a neurality banner, so they have an advantage.",1,0x0000FF;
		bg_team_setxy $@TierraBG2_id2,42,16;
		areawarp "bat_a02",52,208,61,217,"bat_a02",42,16;
	}
	else if( getcharid(4) == $@TierraBG2_id2 )
	{
		mapannounce "bat_a02","Croix obtained a neutrality banner, so they have an advantage.",1,0xFF0000;
		bg_team_setxy $@TierraBG2_id1,50,374;
		areawarp "bat_a02",52,208,61,217,"bat_a02",50,374;
	}
	else end;

	set .Neutral_Base, getcharid(4);
	bg_team_setxy .Neutral_Base,56,212;

	if( .Guardian_1 == 0 )
		set .Guardian_1, bg_monster(.Neutral_Base,"bat_a02",280,233,"Guardian",1949,"Tierra_BG2::OnGuardian1");
	else
		bg_monster_set_team .Guardian_1, .Neutral_Base;
	
	if( .Guardian_2 == 0 )
		set .Guardian_2, bg_monster(.Neutral_Base,"bat_a02",287,203,"Guardian",1950,"Tierra_BG2::OnGuardian2");
	else
		bg_monster_set_team .Guardian_2, .Neutral_Base;

	if( .Guardian_3 == 0 )
		set .Guardian_3, bg_monster(.Neutral_Base,"bat_a02",268,204,"Guardian",1949,"Tierra_BG2::OnGuardian3");
	else
		bg_monster_set_team .Guardian_3, .Neutral_Base;

	sleep 10000;
	if( $@TierraBG2 != 1 ) end;

	if( .Neutral_Base == $@TierraBG2_id1 )
		bg_monster .Neutral_Base,"bat_a02",273,204,"Guillaume Flag",1912,"Tierra_BG2::OnNeutralBreak";
	else if( .Neutral_Base == $@TierraBG2_id2 )
		bg_monster .Neutral_Base,"bat_a02",273,204,"Croix Flag",1913,"Tierra_BG2::OnNeutralBreak";
	end;

OnGuardian1: set .Guardian_1, 0; end;
OnGuardian2: set .Guardian_2, 0; end;
OnGuardian3: set .Guardian_3, 0; end;

OnGuillaumeBreak:
	set $@TierraBG2_Victory, 2;
	mapannounce "bat_a02","Croix Vintenar Swandery: We destroyed Guillaume's food storehause. We won that! Wow!",1,0xFF0000;
	donpcevent "Tierra_BG2::OnStop";
	end;

OnCroixBreak:
	set $@TierraBG2_Victory, 1;
	mapannounce "bat_a02","Guillaume Vintenar Axl Rose: We destroyed Croix's food storehause. We won that! Wow!",1,0x0000FF;
	donpcevent "Tierra_BG2::OnStop";
	end;

OnTimer2400000:
	mapannounce "bat_a02","Battle of Tierra Gorge will ends in 5 minutes",1,0xF4A460;
	end;
OnTimer2640000:
	mapannounce "bat_a02","Battle of Tierra Gorge will ends in 1 minute",1,0xF4A460;
	end;

OnTimer2700000:
	set $@TierraBG2_Victory, 3; // Draw Game
	mapannounce "bat_a02","Battle of Tierra Gorge is over. The time is out, this is a Tie",1,0xF4A460;
	donpcevent "Tierra_BG2::OnStop";
	end;

OnStop:
	set $@TierraBG2, 2;
	disablenpc "Therapist in battle#tv21";
	disablenpc "Therapist in battle#tv22";
	donpcevent "#gtv2_respawn::OnBGStop";
	donpcevent "#ctv2_respawn::OnBGStop";
	donpcevent "#ntv2_respawn::OnBGStop";
	enablenpc "Croix Vintenar#tv2";
	enablenpc "Guillaume Vintenar#tv2";
	killmonster "bat_a02","Tierra_BG2::OnGuillaumeBreak";
	killmonster "bat_a02","Tierra_BG2::OnCroixBreak";
	killmonster "bat_a02","Tierra_BG2::OnNeutralBreak";
	killmonster "bat_a02","Tierra_BG2::OnGuardian1";
	killmonster "bat_a02","Tierra_BG2::OnGuardian2";
	killmonster "bat_a02","Tierra_BG2::OnGuardian3";
	stopnpctimer;
	sleep 3000;
	bg_warp $@TierraBG2_id1,"bat_a02",50,374;
	bg_warp $@TierraBG2_id2,"bat_a02",42,16;
	sleep 3000;
	mapannounce "bat_a02","Battle of Tierra Gorge will close in 1 minute!",1,0xF4A460;
	initnpctimer;
	end;

OnTimer30000:
	if( $@TierraBG2 == 2 )
		mapannounce "bat_a02","Battle of Tierra Valley will close in 30 seconds!",1,0xF4A460;
	end;
OnTimer50000:
	if( $@TierraBG2 == 2 )
		mapannounce "bat_a02","Battle of Tierra Valley will close in 10 seconds!",1,0xF4A460;
	end;

OnTimer60000:
	if( $@TierraBG2 != 2 )
		end;
OnReset:
	stopnpctimer;
	set .Neutral_Base, 0;
	disablenpc "Croix Vintenar#tv2";
	disablenpc "Guillaume Vintenar#tv2";
	disablenpc "Therapist in battle#tv21";
	disablenpc "Therapist in battle#tv22";
	donpcevent "#gtv2_respawn::OnBGStop";
	donpcevent "#gtv2_respawn::OnBGStop";
	donpcevent "#ctv2_respawn::OnBGStop";

	killmonster "bat_a02","Tierra_BG2::OnGuillaumeBreak";
	killmonster "bat_a02","Tierra_BG2::OnCroixBreak";
	killmonster "bat_a02","Tierra_BG2::OnNeutralBreak";
	killmonster "bat_a02","Tierra_BG2::OnGuardian1";
	killmonster "bat_a02","Tierra_BG2::OnGuardian2";
	killmonster "bat_a02","Tierra_BG2::OnGuardian3";
	donpcevent "Guillaume_TV2B::OnDestroy";
	donpcevent "Croix_TV2B::OnDestroy";

	set $@TierraBG2_Victory, 0;
	if( $@TierraBG2_id1 ) { bg_destroy $@TierraBG2_id1; set $@TierraBG2_id1, 0; }
	if( $@TierraBG2_id2 ) { bg_destroy $@TierraBG2_id2; set $@TierraBG2_id2, 0; }
	sleep 1000;
	mapwarp "bat_a02","bat_room",155,150;
	sleep 2000;
	maprespawnguildid "bat_a02",0,3; // Just in case someone else
	sleep 2000;
	set $@TierraBG2, 0;
	donpcevent "Tierra_BG2::OnReadyCheck"; // Maybe a game is ready to start
	end;
}

// MapFlags
// *********************************************************************

bat_a02	mapflag	battleground
bat_a02	mapflag	nomemo
bat_a02	mapflag	nosave	SavePoint
bat_a02	mapflag	noteleport
bat_a02	mapflag	nowarp
bat_a02	mapflag	nowarpto
bat_a02	mapflag	noreturn
bat_a02	mapflag	nobranch
bat_a02	mapflag	nopenalty

// Other Flags
// *********************************************************************

bat_a02,148,85,1	duplicate(Croix camp#bat)	Croix camp#bat22	974
bat_a02,155,85,1	duplicate(Croix camp#bat)	Croix camp#bat23	974
bat_a02,357,75,1	duplicate(Croix camp#bat)	Croix camp#bat24	974
bat_a02,348,74,1	duplicate(Croix camp#bat)	Croix camp#bat25	974
bat_a02,199,49,1	duplicate(Croix camp#bat)	Croix camp#bat26	974
bat_a02,168,16,1	duplicate(Croix camp#bat)	Croix camp#bat27	974
bat_a02,138,12,1	duplicate(Croix camp#bat)	Croix camp#bat28	974
bat_a02,108,35,1	duplicate(Croix camp#bat)	Croix camp#bat29	974
bat_a02,164,308,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat23	973
bat_a02,157,308,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat24	973
bat_a02,359,327,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat25	973
bat_a02,350,326,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat26	973
bat_a02,209,344,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat27	973
bat_a02,173,380,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat28	973
bat_a02,150,380,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat29	973
bat_a02,118,357,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat30	973
bat_a02,119,336,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat31	973

// Barricades
// *********************************************************************

-	script	Guillaume_TV2B	-1,{
	end;

OnBuild:
	for( set .@i, 0; .@i < 16; set .@i, .@i + 1 )
		bg_monster 0,"bat_a02",170+.@i,130,"Barricade",1906,"Guillaume_TV2B::OnWall";

	setwall "bat_a02",170,130,16,6,1,"bat_a02_g1";
	set .MyMobCount,16;
	end;

OnDestroy:
	killmonster "bat_a02","Guillaume_TV2B::OnWall";
	delwall "bat_a02_g1";
	set .MyMobCount,0;
	end;

OnWall:
	if( set(.MyMobCount,.MyMobCount - 1) < 1 )
	{
		delwall "bat_a02_g1";
		mapannounce "bat_a02","South Gate : The Gate has been Destroy!!",1,0xF4A460;
	}
	end;
}

-	script	Croix_TV2B	-1,{
	end;

OnBuild:
	for( set .@i, 0; .@i < 16; set .@i, .@i + 1 )
		bg_monster 0,"bat_a02",186+.@i,266,"Barricade",1906,"Croix_TV2B::OnWall";
	
	setwall "bat_a02",186,266,16,6,1,"bat_a02_c1";
	set .MyMobCount,16;
	end;

OnDestroy:
	killmonster "bat_a02","Croix_TV2B::OnWall";
	delwall "bat_a02_c1";
	set .MyMobCount,0;
	end;

OnWall:
	if( set(.MyMobCount,.MyMobCount - 1) < 1 )
	{
		delwall "bat_a02_c1";
		mapannounce "bat_a02","North Gate : A Gate has been Destroy!!",1,0xF4A460;
	}
	end;
}

// Battleground rewards
// *********************************************************************

bat_a02,45,19,3	script	Croix Vintenar#tv2	415,{
	if( $@TierraBG2_Victory )
	{
		if( $@TierraBG2_Victory == Bat_Team )
		{ // Victory
			set .@Reward, 3;
			mes "[Swandery]";
			mes "Blessed Croax!!";
			mes "Let's enjoy our glorious victory!";
			mes "" + strcharinfo(0) + ", its a sign reflecting victory";
			close2;
		}
		else
		{ // 
			set .@Reward, 1;
			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 Tierra_BG_Tick, gettimetick(2) + 300;
		getitem 7828, .@Reward;
		bg_leave;
		warp "bat_room",155,150;
		end;
	}
	end;
}

bat_a02,53,377,3	script	Guillaume Vintenar#tv2	419,{
	if( $@TierraBG2_Victory )
	{
		if( $@TierraBG2_Victory == Bat_Team )
		{ // Victory
			set .@Reward, 3;
			mes "[Swandery]";
			mes "Blessed Guillaume!!";
			mes "Let's enjoy our glorious victory!";
			mes "" + strcharinfo(0) + ", its a sign reflecting victory";
			close2;
		}
		else
		{ // 
			set .@Reward, 1;
			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 Tierra_BG_Tick, gettimetick(2) + 300;
		getitem 7828, .@Reward;
		bg_leave;
		warp "bat_room",155,150;
		end;
	}
	end;
}

// Battleground Therapist
// *********************************************************************

bat_a02,60,216,3	script	Ghost#tv23	950,{
	mes "[Ghost in valley]";
	mes "Boo...Boo...";
	specialeffect2 312;
	close;
}

bat_a02,53,377,3	script	Therapist in battle#tv22	95,{
	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_a02,45,18,3	script	Therapist in battle#tv21	95,{
	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_a02,57,213,0	script	#ntv2_respawn	139,{
	end;

OnBGStart:
	initnpctimer;
	end;

OnBGStop:
	stopnpctimer;
	end;

OnTimer19000:
	misceffect 83;
	end;

OnTimer20000:
	areapercentheal "bat_a02",52,208,61,217,100,100;
	areawarp "bat_a02",52,208,61,217,"bat_a02",301,208;
	initnpctimer;
	end;
}

bat_a02,50,374,0	script	#gtv2_respawn	139,{
	end;

OnBGStart:
	initnpctimer;
	end;

OnBGStop:
	stopnpctimer;
	end;

OnTimer24000:
	misceffect 83;
	end;

OnTimer25000:
	areapercentheal "bat_a02",46,370,54,378,100,100;
	areawarp "bat_a02",46,370,54,378,"bat_a02",354,340;
	initnpctimer;
	end;
}

bat_a02,42,16,0	script	#ctv2_respawn	139,{
	end;

OnBGStart:
	initnpctimer;
	end;

OnBGStop:
	stopnpctimer;
	end;

OnTimer24000:
	misceffect 83;
	end;

OnTimer25000:
	areapercentheal "bat_a02",38,12,47,21,100,100;
	areawarp "bat_a02",38,12,47,21,"bat_a02",354,57;
	initnpctimer;
	end;
}