summaryrefslogtreecommitdiff
path: root/npc/battleground/bg_tierra_01.txt
blob: 884f15e17fdae6a81e76b182413ecc216b017d25 (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 1
// ==============================================================================

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

bat_room,85,227,4	script	Registration::TV1R_Guillaume	418,{
	end;
OnInit:
	waitingroom "Battle Station 10 Players",10,"Tierra_BG1::OnGuillaumeJoin",1;
	end;
OnEnterBG:
	set $@TierraBG1_id1, waitingroom2bg("bat_a01",50,374,0,"Tierra_BG1::OnGuillaumeQuit","");
	end;
}

bat_room,85,204,0	script	Registration::TV1R_Croix	414,{
	end;
OnInit:
	waitingroom "Battle Station 10 Players",10,"Tierra_BG1::OnCroixJoin",1;
	end;
OnEnterBG:
	set $@TierraBG1_id2, waitingroom2bg("bat_a01",42,16,1,"Tierra_BG1::OnCroixQuit","");
	end;
}

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

-	script	Tierra_BG1	-1,{
	end;

OnInit:
	disablenpc "Croix Vintenar#tv1";
	disablenpc "Guillaume Vintenar#tv1";
	disablenpc "Therapist in battle#tv11";
	disablenpc "Therapist in battle#tv12";
	end;

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

OnGuillaumeJoin:
OnCroixJoin:
	if( $@TierraBG1 == 0 )
		donpcevent "Tierra_BG1::OnReadyCheck";
	end;

OnReadyCheck:
	if( $@TierraBG1 )
		end;
	set .@Guillaume, getwaitingroomstate(0,"TV1R_Guillaume");
	set .@Croix, getwaitingroomstate(0,"TV1R_Croix");

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

	set $@TierraBG1, 1;
	donpcevent "TV1R_Croix::OnEnterBG";
	donpcevent "TV1R_Guillaume::OnEnterBG";
	donpcevent "Guillaume_TV1B::OnBuild";
	donpcevent "Croix_TV1B::OnBuild";
	bg_monster $@TierraBG1_id1,"bat_a01",176,345,"Food Depot",1909,"Tierra_BG1::OnGuillaumeBreak";
	bg_monster $@TierraBG1_id2,"bat_a01",167,50,"Food Storage",1910,"Tierra_BG1::OnCroixBreak";
	bg_monster 0,"bat_a01",273,204,"Neutrality Flag",1911,"Tierra_BG1::OnNeutralBreak";
	
	set .Neutral_Base, 0;
	set $@TierraBG1_Victory, 0;

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

	enablenpc "Therapist in battle#tv11";
	enablenpc "Therapist in battle#tv12";
	disablenpc "Croix Vintenar#tv1";
	disablenpc "Guillaume Vintenar#tv1";
	// Respawner
	donpcevent "#gtv1_respawn::OnBGStart";
	donpcevent "#ctv1_respawn::OnBGStart";
	donpcevent "#ntv1_respawn::OnBGStart";
	// Warp Teams
	announce "Battleground -- Tierra Valley [80-99] has started!",0,0xFFA500;
	bg_warp $@TierraBG1_id1,"bat_a01",353,344;
	bg_warp $@TierraBG1_id2,"bat_a01",353,52;
	// Final Messages
	sleep 6000;
	mapannounce "bat_a01","Guillaume Vintenar Axl Rose : Let's attack to burn down Croix's food storage",1,0x0000FF;
	sleep 2000;
	mapannounce "bat_a01","Croix Vintenar Swandery : Master of Valhalla! Let us be gifted with unfailing faith and courage",1,0xFF0000;
	
	initnpctimer;
	end;

OnNeutralBreak:
	if( getcharid(4) == $@TierraBG1_id1 )
	{
		mapannounce "bat_a01","Guillaume obtained a neurality banner, so they have an advantage.",1,0x0000FF;
		bg_team_setxy $@TierraBG1_id2,42,16;
		areawarp "bat_a01",52,208,61,217,"bat_a01",42,16;
	}
	else if( getcharid(4) == $@TierraBG1_id2 )
	{
		mapannounce "bat_a01","Croix obtained a neutrality banner, so they have an advantage.",1,0xFF0000;
		bg_team_setxy $@TierraBG1_id1,50,374;
		areawarp "bat_a01",52,208,61,217,"bat_a01",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_a01",280,233,"Guardian",1949,"Tierra_BG1::OnGuardian1");
	else
		bg_monster_set_team .Guardian_1, .Neutral_Base;
	
	if( .Guardian_2 == 0 )
		set .Guardian_2, bg_monster(.Neutral_Base,"bat_a01",287,203,"Guardian",1950,"Tierra_BG1::OnGuardian2");
	else
		bg_monster_set_team .Guardian_2, .Neutral_Base;

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

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

	if( .Neutral_Base == $@TierraBG1_id1 )
		bg_monster .Neutral_Base,"bat_a01",273,204,"Guillaume Flag",1912,"Tierra_BG1::OnNeutralBreak";
	else if( .Neutral_Base == $@TierraBG1_id2 )
		bg_monster .Neutral_Base,"bat_a01",273,204,"Croix Flag",1913,"Tierra_BG1::OnNeutralBreak";
	end;

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

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

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

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

OnTimer2700000:
	set $@TierraBG1_Victory, 3; // Draw Game
	mapannounce "bat_a01","Battle of Tierra Gorge is over. The time is out, this is a Tie",1,0xFFA500;
	donpcevent "Tierra_BG1::OnStop";
	end;

OnStop:
	set $@TierraBG1, 2;
	disablenpc "Therapist in battle#tv11";
	disablenpc "Therapist in battle#tv12";
	donpcevent "#gtv1_respawn::OnBGStop";
	donpcevent "#ctv1_respawn::OnBGStop";
	donpcevent "#ntv1_respawn::OnBGStop";
	enablenpc "Croix Vintenar#tv1";
	enablenpc "Guillaume Vintenar#tv1";
	killmonster "bat_a01","Tierra_BG1::OnGuillaumeBreak";
	killmonster "bat_a01","Tierra_BG1::OnCroixBreak";
	killmonster "bat_a01","Tierra_BG1::OnNeutralBreak";
	killmonster "bat_a01","Tierra_BG1::OnGuardian1";
	killmonster "bat_a01","Tierra_BG1::OnGuardian2";
	killmonster "bat_a01","Tierra_BG1::OnGuardian3";
	stopnpctimer;
	sleep 3000;
	bg_warp $@TierraBG1_id1,"bat_a01",50,374;
	bg_warp $@TierraBG1_id2,"bat_a01",42,16;
	sleep 3000;
	mapannounce "bat_a01","Battle of Tierra Gorge will close in 1 minute!",1,0xFFA500;
	initnpctimer;
	end;

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

OnTimer60000:
	if( $@TierraBG1 != 2 )
		end;
OnReset:
	stopnpctimer;
	set .Neutral_Base, 0;
	disablenpc "Croix Vintenar#tv1";
	disablenpc "Guillaume Vintenar#tv1";
	disablenpc "Therapist in battle#tv11";
	disablenpc "Therapist in battle#tv12";
	donpcevent "#gtv1_respawn::OnBGStop";
	donpcevent "#ctv1_respawn::OnBGStop";
	donpcevent "#ntv1_respawn::OnBGStop";

	killmonster "bat_a01","Tierra_BG1::OnGuillaumeBreak";
	killmonster "bat_a01","Tierra_BG1::OnCroixBreak";
	killmonster "bat_a01","Tierra_BG1::OnNeutralBreak";
	killmonster "bat_a01","Tierra_BG1::OnGuardian1";
	killmonster "bat_a01","Tierra_BG1::OnGuardian2";
	killmonster "bat_a01","Tierra_BG1::OnGuardian3";
	donpcevent "Guillaume_TV1B::OnDestroy";
	donpcevent "Croix_TV1B::OnDestroy";

	set $@TierraBG1_Victory, 0;
	if( $@TierraBG1_id1 ) { bg_destroy $@TierraBG1_id1; set $@TierraBG1_id1, 0; }
	if( $@TierraBG1_id2 ) { bg_destroy $@TierraBG1_id2; set $@TierraBG1_id2, 0; }
	sleep 1000;
	mapwarp "bat_a01","bat_room",155,150;
	sleep 2000;
	maprespawnguildid "bat_a01",0,3; // Just in case someone else
	sleep 2000;
	set $@TierraBG1, 0;
	donpcevent "Tierra_BG1::OnReadyCheck"; // Maybe a game is ready to start
	end;
}

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

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

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

bat_a01,148,85,1	duplicate(Croix camp#bat)	Croix camp#bat10	974
bat_a01,155,85,1	duplicate(Croix camp#bat)	Croix camp#bat11	974
bat_a01,357,75,1	duplicate(Croix camp#bat)	Croix camp#bat12	974
bat_a01,348,74,1	duplicate(Croix camp#bat)	Croix camp#bat13	974
bat_a01,199,49,1	duplicate(Croix camp#bat)	Croix camp#bat14	974
bat_a01,168,16,1	duplicate(Croix camp#bat)	Croix camp#bat15	974
bat_a01,138,12,1	duplicate(Croix camp#bat)	Croix camp#bat16	974
bat_a01,108,35,1	duplicate(Croix camp#bat)	Croix camp#bat17	974
bat_a01,164,308,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat10	973
bat_a01,157,308,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat11	973
bat_a01,359,327,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat12	973
bat_a01,350,326,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat13	973
bat_a01,209,344,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat14	973
bat_a01,173,380,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat15	973
bat_a01,150,380,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat16	973
bat_a01,118,357,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat17	973
bat_a01,119,336,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat18	973

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

-	script	Guillaume_TV1B	-1,{
	end;

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

	setwall "bat_a01",170,130,16,6,1,"bat_a01_g1";
	set .MyMobCount,16;
	end;

OnDestroy:
	killmonster "bat_a01","Guillaume_TV1B::OnWall";
	delwall "bat_a01_g1";
	set .MyMobCount,0;
	end;

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

-	script	Croix_TV1B	-1,{
	end;

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

OnDestroy:
	killmonster "bat_a01","Croix_TV1B::OnWall";
	delwall "bat_a01_c1";
	set .MyMobCount,0;
	end;

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

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

bat_a01,45,19,3	script	Croix Vintenar#tv1	415,{
	if( $@TierraBG1_Victory )
	{
		if( $@TierraBG1_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_a01,53,377,3	script	Guillaume Vintenar#tv1	419,{
	if( $@TierraBG1_Victory )
	{
		if( $@TierraBG1_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_a01,60,216,3	script	Ghost#tv13	950,{
	mes "[Ghost in valley]";
	mes "Boo...Boo...";
	specialeffect2 312;
	close;
}

bat_a01,53,377,3	script	Therapist in battle#tv12	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_a01,45,18,3	script	Therapist in battle#tv11	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_a01,57,213,0	script	#ntv1_respawn	139,{
	end;

OnBGStart:
	initnpctimer;
	end;

OnBGStop:
	stopnpctimer;
	end;

OnTimer19000:
	misceffect 83;
	end;

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

bat_a01,50,374,0	script	#gtv1_respawn	139,{
	end;

OnBGStart:
	initnpctimer;
	end;

OnBGStop:
	stopnpctimer;
	end;

OnTimer24000:
	misceffect 83;
	end;

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

bat_a01,42,16,0	script	#ctv1_respawn	139,{
	end;

OnBGStart:
	initnpctimer;
	end;

OnBGStop:
	stopnpctimer;
	end;

OnTimer24000:
	misceffect 83;
	end;

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