-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCTF.txt
885 lines (843 loc) · 25.1 KB
/
CTF.txt
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
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
function script CTF_GAMERESET {
for(set .@i,0; .@i < getarraysize($@ctf_team_1); set .@i,.@i+1) {
attachrid $@ctf_team_1[.@i];
set @number_death,4;
set @ctf_kill,0;
set @x,rand(80,83);
set @y,rand(140,159);
warp "bat_b01",@x,@y;
set @flag_takeback,0;
set @flag_taken,0;
detachrid;
}
for(set .@i,0; .@i < getarraysize($@ctf_team_2); set .@i,.@i+1) {
attachrid $@ctf_team_2[.@i];
set @number_death,4;
set @ctf_kill,0;
set @x,rand(313,316);
set @y,rand(141,158);
warp "bat_b01",@x,@y;
set @flag_takeback,0;
set @flag_taken,0;
detachrid;
}
setcell "bat_b01",59,121,66,121,cell_walkable,0;
setcell "bat_b01",333,182,340,182,cell_walkable,0;
setcell "bat_b01",94,140,94,159,cell_walkable,0;
setcell "bat_b01",305,159,305,140,cell_walkable,0;
movenpc "Red Flag",57,150;
movenpc "Blue Flag",334,150;
return;
}
function script CTF_RESET {
for(set .@i,0; .@i < getarraysize($@ctf_team_1); set .@i,.@i+1) {
attachrid $@ctf_team_1[.@i];
set @ctf_kill,0;
set @number_death,0;
set @ctf_1,0;
set @flag_takeback,0;
set @flag_taken,0;
set @ctf_member,0;
detachrid;
}
for(set .@i,0; .@i < getarraysize($@ctf_team_2); set .@i,.@i+1) {
attachrid $@ctf_team_2[.@i];
set @ctf_kill,0;
set @number_death,0;
set @ctf_2,0;
set @flag_takeback,0;
set @flag_taken,0;
set @ctf_member,0;
detachrid;
}
deletearray $@ctf_team_1[0],getarraysize($@ctf_team_1);
deletearray $@ctf_team_2[0],getarraysize($@ctf_team_2);
set $@ctf_closed,0;
set $@ctf_rnd2,0;
donpcevent "ctf_game::OnInit";
movenpc "Red Flag",57,150;
movenpc "Blue Flag",332,150;
setcell "bat_b01",59,121,66,121,cell_walkable,1;
setcell "bat_b01",333,182,340,182,cell_walkable,1;
setcell "bat_b01",94,140,94,159,cell_walkable,1;
setcell "bat_b01",305,159,305,140,cell_walkable,1;
return;
}
- script ctf_game -1,{
OnNewRound:
if(.team[1] == .ctf_rnd || .team[2] == .ctf_rnd) goto L_GameOver;
for(set .@i,0; .@i < getarraysize($@ctf_team_1); set .@i,.@i+1) {
attachrid $@ctf_team_1[.@i];
dispbottom "************************************************************";
dispbottom "Score Board:";
dispbottom "Red Team - "+.team[1]+" round "+(.team[1] > 1?"wins":"win");
dispbottom "Blue -Team - "+.team[2]+" round "+(.team[2] > 1?"wins":"win");
dispbottom "************************************************************";
detachrid;
}
for(set .@i,0; .@i < getarraysize($@ctf_team_2); set .@i,.@i+1) {
attachrid $@ctf_team_2[.@i];
dispbottom "************************************************************";
dispbottom "Score Board:";
dispbottom "Red Team - "+.team[1]+" round "+(.team[1] > 1?"wins":"win");
dispbottom "Blue -Team - "+.team[2]+" round "+(.team[2] > 1?"wins":"win");
dispbottom "************************************************************";
detachrid;
}
set .ctf_blood,0;
sleep 10000;
soundeffectall "NewRound.wav",0,"bat_b01";
mapannounce "bat_b01","[Round "+($@ctf_rnd2+1)+"] Starting in...",0;
sleep 1500;
soundeffectall "5.wav",0,"bat_b01";
mapannounce "bat_b01","5...",0;
sleep 1000;
soundeffectall "4.wav",0,"bat_b01";
mapannounce "bat_b01","4...",0;
sleep 1000;
soundeffectall "3.wav",0,"bat_b01";
mapannounce "bat_b01","3...",0;
sleep 1000;
soundeffectall "2.wav",0,"bat_b01";
mapannounce "bat_b01","2...",0;
sleep 1000;
soundeffectall "1.wav",0,"bat_b01";
mapannounce "bat_b01","1...",0;
sleep 1000;
soundeffectall "Play.wav",0,"bat_b01";
mapannounce "bat_b01","Play!",0;
for(set .@i,0; .@i < getarraysize($@ctf_team_1); set .@i,.@i+1) {
attachrid $@ctf_team_1[.@i];
dispbottom "Objective: Steal the opposing team's flag back to your base and protect your own flag.";
detachrid;
}
for(set .@i,0; .@i < getarraysize($@ctf_team_2); set .@i,.@i+1) {
attachrid $@ctf_team_2[.@i];
dispbottom "Objective: Steal the opposing team's flag back to your base and protect your own flag.";
detachrid;
}
setcell "bat_b01",59,121,66,121,cell_walkable,1;
setcell "bat_b01",333,182,340,182,cell_walkable,1;
setcell "bat_b01",94,140,94,159,cell_walkable,1;
setcell "bat_b01",305,159,305,140,cell_walkable,1;
end;
OnRedScore:
set $@ctf_rnd2,$@ctf_rnd2+1;
sleep 3000;
if(.team[1] == .team[2])
soundeffectall "RedTeamTakesTheLead.wav",0,"bat_b01";
else if(.team[1] > .team[2])
soundeffectall "RedTeamIncreases.wav",0,"bat_b01";
else
soundeffectall "RedTeamScores.wav",0,"bat_b01";
mapannounce "bat_b01","Red Team has won Round "+$@ctf_rnd2+"!",0;
set .team[1],.team[1]+1;
goto OnNewRound;
OnBlueScore:
set $@ctf_rnd2,$@ctf_rnd2+1;
sleep 3000;
if(.team[1] == .team[2])
soundeffectall "BlueTeamLead.wav",0,"bat_b01";
else if(.team[1] < .team[2])
soundeffectall "BlueTeamIncreases.wav",0,"bat_b01";
else
soundeffectall "BlueTeamScores.wav",0,"bat_b01";
mapannounce "bat_b01","Blue Team has won Round "+$@ctf_rnd2+"!",bc_map,0xFFFF00;
set .team[2],.team[2]+1;
goto OnNewRound;
L_GameOver:
sleep 3000;
for(set .@i,0; .@i < getarraysize($@ctf_team_1); set .@i,.@i+1) {
attachrid $@ctf_team_1[.@i];
dispbottom "************************************************************";
dispbottom "Score Board:";
dispbottom "Red Team - "+.team[1]+" round "+(.team[1] > 1?"wins":"win");
dispbottom "Blue -Team - "+.team[2]+" round "+(.team[2] > 1?"wins":"win");
dispbottom "************************************************************";
detachrid;
}
for(set .@i,0; .@i < getarraysize($@ctf_team_2); set .@i,.@i+1) {
attachrid $@ctf_team_2[.@i];
dispbottom "************************************************************";
dispbottom "Score Board:";
dispbottom "Red Team - "+.team[1]+" round "+(.team[1] > 1?"wins":"win");
dispbottom "Blue -Team - "+.team[2]+" round "+(.team[2] > 1?"wins":"win");
dispbottom "************************************************************";
detachrid;
}
if(.team[1] > .team[2]) {
soundeffectall "RedTeamIsTheWinner.wav",0,"bat_b01";
for(set .@i,0; .@i < getarraysize($@ctf_team_1); set .@i,.@i+1) {
attachrid $@ctf_team_1[.@i];
set ctf_win,ctf_win+1;
detachrid;
}
}
else if(.team[1] < .team[2]) {
soundeffectall "BlueTeamIsTheWinner.wav",0,"bat_b01";
for(set .@i,0; .@i < getarraysize($@ctf_team_2); set .@i,.@i+1) {
attachrid $@ctf_team_2[.@i];
set ctf_win,ctf_win+1;
detachrid;
}
}
mapannounce "bat_b01","Game Match! "+(.team[1] > .team[2]?"Red":"Blue")+" Team has conquered over the "+(.team[1] > .team[2]?"Blue":"Red")+" Team!",0;
sleep 7000;
for(set .@i,0; .@i < getarraysize($@ctf_team_1); set .@i,.@i+1) {
attachrid $@ctf_team_1[.@i];
warp "prontera",120,90;
detachrid;
}
for(set .@i,0; .@i < getarraysize($@ctf_team_2); set .@i,.@i+1) {
attachrid $@ctf_team_2[.@i];
warp "prontera",120,90;
detachrid;
}
callfunc "CTF_RESET";
end;
OnPCKillEvent:
getmapxy(@map$,@x,@y,0);
if(@map$ != "bat_b01") end;
if(!$@ctf_closed) warp "prontera",120,90;
if(!.ctf_blood) {
set .ctf_blood,1;
mapannounce "bat_b01",strcharinfo(0)+" drew the first blood !!",0;
soundeffectall "FirstBlood.wav",0,"bat_b01";
}
switch(@ctf_kill) {
case 0:
break;
case 1:
announce "Double kill !!",bc_self;
soundeffect "DoubleKill.wav",0;
break;
case 2:
announce "Triple kill !!",bc_self;
soundeffect "TripleKill.wav",0;
break;
case 3:
announce "Multi kill !!",bc_self;
soundeffect "MultiKill.wav",0;
break;
case 4:
announce "M-m-m-monster kill !!",bc_self;
soundeffect "MonsterKill.wav",0;
break;
case 5:
announce "Unstoppable !!",bc_self;
soundeffect "Unstoppable.wav",0;
break;
case 6:
default:
announce "Godlike !!",bc_self;
soundeffect "Godlike.wav",0;
}
if(@ctf_kill > 2) dispbottom "You are on a "+@ctf_kill+" kill streak !!";
set @ctf_kill,@ctf_kill+1;
end;
OnPCDieEvent:
getmapxy(@map$,@x,@y,0);
if(@map$ != "bat_b01") end;
if(!$@ctf_closed) warp "prontera",120,90;
set @ctf_kill,0;
if(@ctf_1) {
if(@flag_taken) {
mapannounce "bat_b01","Blue Flag has been dropped!",bc_map,0xFFFF00;
soundeffectall "BlueFlagDropped.wav",0,"bat_b01";
set @flag_taken,0;
movenpc "Blue Flag",@x,@y;
}
else if(@flag_takeback) {
mapannounce "bat_b01","Red Flag has been dropped!",0;
soundeffectall "RedFlagDropped.wav",0,"bat_b01";
set @flag_takeback,0;
movenpc "Red Flag",@x,@y;
}
}
else if(@ctf_2) {
if(@flag_taken) {
mapannounce "bat_b01","Red Flag has been dropped!",0;
soundeffectall "RedFlagDropped.wav",0,"bat_b01";
set @flag_taken,0;
movenpc "Red Flag",@x,@y;
}
else if(@flag_takeback) {
mapannounce "bat_b01","Blue Flag has been dropped!",bc_map,0xFFFF00;
soundeffectall "BlueFlagDropped.wav",0,"bat_b01";
set @flag_takeback,0;
movenpc "Blue Flag",@x,@y;
}
}
dispbottom "You will be resurrected in "+@number_death+" seconds...";
set @loop,0;
while(!getmapxy(@map$,@x,@y,0)) {
if(Hp == 0) {
if(@loop == @number_death) break;
if(@map$ != "bat_b01") {
set @ctf_kill,0;
set @number_death,0;
set @flag_takeback,0;
set @flag_taken,0;
set @ctf_member,0;
for(set @i,0; @i < getarraysize($@ctf_team_1); set @i,@i+1) {
if($@ctf_team_1[@i] == playerattached()) {
deletearray $@ctf_team_1[@i],1;
set @ctf_1,0;
break;
}
}
for(set @i,0; @i < getarraysize($@ctf_team_2); set @i,@i+1) {
if($@ctf_team_2[@i] == playerattached()) {
deletearray $@ctf_team_2[@i],1;
set @ctf_2,0;
break;
}
}
}
}
if(@loop >= @number_death) end;
sleep2 1000;
set @loop,@loop+1;
}
if(@ctf_1)
warp "bat_b01",63,135;
else if(@ctf_2)
warp "bat_b01",336,161;
set @number_death,@number_death+1;
atcommand "@alive";
end;
OnPCLogoutEvent:
getmapxy(@map$,@x,@y,0);
if(@map$ != "bat_b01") end;
if(@ctf_1) {
if(@flag_taken) {
mapannounce "bat_b01","Blue Flag has been dropped!",bc_map,0xFFFF00;
soundeffectall "BlueFlagDropped.wav",0,"bat_b01";
set @flag_taken,0;
movenpc "Blue Flag",@x,@y;
}
else if(@flag_takeback) {
mapannounce "bat_b01","Red Flag has been dropped!",0;
soundeffectall "RedFlagDropped.wav",0,"bat_b01";
set @flag_takeback,0;
movenpc "Red Flag",@x,@y;
}
}
else if(@ctf_2) {
if(@flag_taken) {
mapannounce "bat_b01","Red Flag has been dropped!",0;
soundeffectall "RedFlagDropped.wav",0,"bat_b01";
set @flag_taken,0;
movenpc "Red Flag",@x,@y;
}
else if(@flag_takeback) {
mapannounce "bat_b01","Blue Flag has been dropped!",bc_map,0xFFFF00;
soundeffectall "BlueFlagDropped.wav",0,"bat_b01";
set @flag_takeback,0;
movenpc "Blue Flag",@x,@y;
}
}
if(@ctf_1) {
for(set @i,0; @i < getarraysize($@ctf_team_1); set @i,@i+1) {
if($@ctf_team_1[@i] == playerattached()) {
deletearray $@ctf_team_1[@i],1;
break;
}
}
}
else if(@ctf_2) {
for(set @i,0; @i < getarraysize($@ctf_team_2); set @i,@i+1) {
if($@ctf_team_2[@i] == playerattached()) {
deletearray $@ctf_team_2[@i],1;
break;
}
}
}
end;
OnInit:
// Amount of rounds needed to win \
set .ctf_rnd,3;
set .team[1],0;
set .team[2],0;
set .ctf_blood,0;
}
bat_b01,57,150,6 script Red Flag 722,{
if(!$@ctf_closed) warp "prontera",120,90;
getmapxy(.@map$,.@x,.@y,1);
getmapxy(.@map2$,.@x2,.@y2,0);
if(distance(.@x,.@y,.@x2,.@y2) > 2) end;
if(checkoption(0x6)) end;
if(@ctf_2) {
if(.@x == 334 && .@y == 138) end;
if(@flag_takeback) {
dispbottom "You can only carry one flag at a time.";
}
else {
set @flag_taken,1;
mapannounce "bat_b01","Red Flag has been stolen!",0;
soundeffectall "RedFlagTaken.wav",0,"bat_b01";
dispbottom "You've stolen the Red Team's flag. Take it back to your base!";
movenpc "Red Flag",390,11;
set .@taken,playerattached();
while(!getmapxy(.@map$,.@x,.@y,0)) {
if(!@flag_taken) break;
for(set .@i,0; .@i < getarraysize($@ctf_team_1); set .@i,.@i+1) {
attachrid $@ctf_team_1[.@i];
viewpoint 2,.@x,.@y,1,0xFF0000;
viewpoint 1,.@x,.@y,1,0xFF0000;
detachrid;
}
for(set .@i,0; .@i < getarraysize($@ctf_team_2); set .@i,.@i+1) {
attachrid $@ctf_team_2[.@i];
viewpoint 2,.@x,.@y,1,0xFF0000;
viewpoint 1,.@x,.@y,1,0xFF0000;
detachrid;
}
sleep2 10;
if(!isloggedin(.@taken)) break;
attachrid .@taken;
}
for(set .@i,0; .@i < getarraysize($@ctf_team_1); set .@i,.@i+1) {
attachrid $@ctf_team_1[.@i];
viewpoint 2,.@x,.@y,1,0xFF0000;
detachrid;
}
for(set .@i,0; .@i < getarraysize($@ctf_team_2); set .@i,.@i+1) {
attachrid $@ctf_team_2[.@i];
viewpoint 2,.@x,.@y,1,0xFF0000;
detachrid;
}
}
end;
}
else if(@ctf_1) {
if(.@x == 57 && .@y == 150) end;
if(@flag_taken) {
dispbottom "You can only carry one flag at a time.";
}
else {
set @flag_takeback,1;
dispbottom "Return the flag to your base before anyone tries to steal it!";
movenpc "Red Flag",390,11;
set .@taken,playerattached();
while(!getmapxy(.@map$,.@x,.@y,0)) {
if(!@flag_takeback) break;
for(set .@i,0; .@i < getarraysize($@ctf_team_1); set .@i,.@i+1) {
attachrid $@ctf_team_1[.@i];
viewpoint 2,.@x,.@y,3,0xFF0000;
viewpoint 1,.@x,.@y,3,0xFF0000;
detachrid;
}
for(set .@i,0; .@i < getarraysize($@ctf_team_2); set .@i,.@i+1) {
attachrid $@ctf_team_2[.@i];
viewpoint 2,.@x,.@y,3,0xFF0000;
viewpoint 1,.@x,.@y,3,0xFF0000;
detachrid;
}
sleep2 10;
if(!isloggedin(.@taken)) break;
attachrid .@taken;
}
for(set .@i,0; .@i < getarraysize($@ctf_team_1); set .@i,.@i+1) {
attachrid $@ctf_team_1[.@i];
viewpoint 2,.@x,.@y,3,0xFF0000;
detachrid;
}
for(set .@i,0; .@i < getarraysize($@ctf_team_2); set .@i,.@i+1) {
attachrid $@ctf_team_2[.@i];
viewpoint 2,.@x,.@y,3,0xFF0000;
detachrid;
}
}
}
end;
}
bat_b01,62,149,0 script redbase#1 -1,4,4,{
OnTouch:
if(@ctf_2) end;
if(@flag_takeback) {
soundeffectall "RedFlagReturned.wav",0,"bat_b01";
mapannounce "bat_b01","Red Flag has been returned!",0;
set @flag_takeback,0;
movenpc "Red Flag",57,150;
getmapxy(.@map$,.@x,.@y,1,"Red Flag");
getmapxy(.@map2$,.@x2,.@y2,1,"Blue Flag");
if(.@x == 57 && .@y == 150 && .@x2 == 62 && .@y2 == 162) {
callfunc "CTF_GAMERESET";
donpcevent "ctf_game::OnRedScore";
}
}
end;
}
- script redbasewin -1,{
OnTouch:
if(@ctf_2) end;
if(@flag_taken) {
set @flag_taken,0;
movenpc "Blue Flag",62,162;
getmapxy(.@map$,.@x,.@y,1,"Red Flag");
getmapxy(.@map2$,.@x2,.@y2,1,"Blue Flag");
if(.@x == 57 && .@y == 150 && .@x2 == 62 && .@y2 == 162) {
callfunc "CTF_GAMERESET";
donpcevent "ctf_game::OnRedScore";
}
}
}
bat_b01,61,140,0 duplicate(redbasewin) redbase#2 -1,9,0
bat_b01,70,149,0 duplicate(redbasewin) redbase#3 -1,0,10
bat_b01,61,159,0 duplicate(redbasewin) redbase#4 -1,9,0
bat_b01,334,150,2 script Blue Flag 722,{
if(!$@ctf_closed) warp "prontera",120,90;
getmapxy(.@map$,.@x,.@y,1);
getmapxy(.@map2$,.@x2,.@y2,0);
if(distance(.@x,.@y,.@x2,.@y2) > 2) end;
if(checkoption(0x6)) end;
if(@ctf_1) {
if(.@x == 62 && .@y == 162) end;
if(@flag_takeback) {
dispbottom "You can only carry one flag at a time.";
}
else {
set @flag_taken,1;
mapannounce "bat_b01","Blue Flag has been stolen!",bc_map,0xFFFF00;
soundeffectall "BlueFlagTaken.wav",0,"bat_b01";
dispbottom "You've stolen the Blue Team's flag. Take it back to your base!";
movenpc "Blue Flag",391,11;
set .@taken,playerattached();
while(!getmapxy(.@map$,.@x,.@y,0)) {
if(!@flag_taken) break;
for(set .@i,0; .@i < getarraysize($@ctf_team_1); set .@i,.@i+1) {
attachrid $@ctf_team_1[.@i];
viewpoint 2,.@x,.@y,2,0x0000FF;
viewpoint 1,.@x,.@y,2,0x0000FF;
detachrid;
}
for(set .@i,0; .@i < getarraysize($@ctf_team_2); set .@i,.@i+1) {
attachrid $@ctf_team_2[.@i];
viewpoint 2,.@x,.@y,2,0x0000FF;
viewpoint 1,.@x,.@y,2,0x0000FF;
detachrid;
}
sleep2 10;
if(!isloggedin(.@taken)) break;
attachrid .@taken;
}
for(set .@i,0; .@i < getarraysize($@ctf_team_1); set .@i,.@i+1) {
attachrid $@ctf_team_1[.@i];
viewpoint 2,.@x,.@y,2,0x0000FF;
detachrid;
}
for(set .@i,0; .@i < getarraysize($@ctf_team_2); set .@i,.@i+1) {
attachrid $@ctf_team_2[.@i];
viewpoint 2,.@x,.@y,2,0x0000FF;
detachrid;
}
}
end;
}
else if(@ctf_2) {
if(.@x == 334 && .@y == 150) end;
if(@flag_taken) {
dispbottom "You can only carry one flag at a time.";
}
else {
set @flag_takeback,1;
dispbottom "Return the flag to your base before anyone tries to steal it!";
movenpc "Blue Flag",391,11;
set .@taken,playerattached();
while(!getmapxy(.@map$,.@x,.@y,0)) {
if(!@flag_takeback) break;
for(set .@i,0; .@i < getarraysize($@ctf_team_1); set .@i,.@i+1) {
attachrid $@ctf_team_1[.@i];
viewpoint 2,.@x,.@y,4,0x0000FF;
viewpoint 1,.@x,.@y,4,0x0000FF;
detachrid;
}
for(set .@i,0; .@i < getarraysize($@ctf_team_2); set .@i,.@i+1) {
attachrid $@ctf_team_2[.@i];
viewpoint 2,.@x,.@y,4,0x0000FF;
viewpoint 1,.@x,.@y,4,0x0000FF;
detachrid;
}
sleep2 10;
if(!isloggedin(.@taken)) break;
attachrid .@taken;
}
for(set .@i,0; .@i < getarraysize($@ctf_team_1); set .@i,.@i+1) {
attachrid $@ctf_team_1[.@i];
viewpoint 2,.@x,.@y,4,0x0000FF;
detachrid;
}
for(set .@i,0; .@i < getarraysize($@ctf_team_2); set .@i,.@i+1) {
attachrid $@ctf_team_2[.@i];
viewpoint 2,.@x,.@y,4,0x0000FF;
detachrid;
}
}
}
end;
}
bat_b01,327,150,0 script bluebase#1 -1,4,4,{
OnTouch:
if(@ctf_1) end;
if(@flag_takeback) {
soundeffectall "BlueFlagReturned.wav",0,"bat_b01";
set @flag_takeback,0;
movenpc "Blue Flag",334,150;
getmapxy(.@map$,.@x,.@y,1,"Red Flag");
getmapxy(.@map2$,.@x2,.@y2,1,"Blue Flag");
if(.@x == 334 && .@y == 138 && .@x2 == 334 && .@y2 == 150) {
callfunc "CTF_GAMERESET";
donpcevent "ctf_game::OnBlueScore";
}
}
end;
}
bat_b01,322,150,0 script bluebasewin -1,1,27,{
OnTouch:
if(@ctf_1) end;
if(@flag_taken) {
set @flag_taken,0;
movenpc "Red Flag",334,138;
getmapxy(.@map$,.@x,.@y,1,"Red Flag");
getmapxy(.@map2$,.@x2,.@y2,1,"Blue Flag");
if(.@x == 334 && .@y == 138 && .@x2 == 334 && .@y2 == 150) {
callfunc "CTF_GAMERESET";
donpcevent "ctf_game::OnBlueScore";
}
}
}
bat_b01,331,157,0 duplicate(bluebasewin) bluebase#2 -1,11,0
bat_b01,320,150,0 duplicate(bluebasewin) bluebase#3 -1,0,8
bat_b01,331,142,0 duplicate(bluebasewin) bluebase#4 -1,11,0
- script ctf_npc -1,{
mes "Current teams:";
mes "^FF0000Red Team^000000 [ "+getarraysize($@ctf_team_1)+" / "+.ctf_min_req+" ]";
mes "^0000FFBlue Team^000000 [ "+getarraysize($@ctf_team_2)+" / "+.ctf_min_req+" ]";
mes " ";
mes (@ctf_1?"You are currently registered as ^FF0000Red Team^000000.":"");
mes (@ctf_2?"You are currently registered as ^0000FFBlue Team^000000.":"");
next;
switch(select(($@ctf_closed?"Join Current Game":(!@ctf_member?"Register":"Unregister")),"View Team Members","Information","Cancel")) {
case 1:
if(Zeny < .ctf_fee) {
mes "You must pay a fee of "+.ctf_fee+"z in order to participate.";
close;
}
if(!@ctf_member) {
if(getarraysize($@ctf_team_1) >= .ctf_min_req && getarraysize($@ctf_team_2) >= .ctf_min_req) {
mes "I'm sorry, registration is full at the moment.";
mes "Please try again later.";
close;
}
else if(getarraysize($@ctf_team_1) > getarraysize($@ctf_team_2)) {
setarray $@ctf_team_2[getarraysize($@ctf_team_2)],playerattached();
set @ctf_2,1;
}
else {
setarray $@ctf_team_1[getarraysize($@ctf_team_1)],playerattached();
set @ctf_1,1;
}
set @ctf_member,1;
mes "You are registered as "+(@ctf_1?"^FF0000Red":"^0000FFBlue")+" Team^000000.";
mes " ";
mes " ";
mes "Notice: When registration is completed, you will have paid the "+.ctf_fee+"z fee.";
close2;
if($@ctf_closed) {
if(@ctf_1) {
sc_end SC_ALL;
warp "bat_b01",63,135;
set @number_death,.ctf_num_die;
}
else if(@ctf_2) {
sc_end SC_ALL;
warp "bat_b01",336,161;
set @number_death,.ctf_num_die;
}
set Zeny,Zeny-5000;
end;
}
else if(getarraysize($@ctf_team_1) >= .ctf_min_req && getarraysize($@ctf_team_1) == getarraysize($@ctf_team_2)) {
for(set .@i,0; .@i < getarraysize($@ctf_team_1); set .@i,.@i+1) {
attachrid $@ctf_team_1[.@i];
if(Zeny < .ctf_fee) {
set .@ctf_pay_fail,.@ctf_pay_fail+1;
set @ctf_1,0;
set @ctf_member,0;
deletearray $@ctf_team_1[.@i],1;
dispbottom "CTF_ERROR: You have failed to pay registration fee.";
}
}
for(set .@i,0; .@i < getarraysize($@ctf_team_2); set .@i,.@i+1) {
attachrid $@ctf_team_2[.@i];
if(Zeny < .ctf_fee) {
set .@ctf_pay_fail,.@ctf_pay_fail+1;
set @ctf_2,0;
set @ctf_member,0;
deletearray $@ctf_team_2[.@i],1;
dispbottom "CTF_ERROR: You must pay a fee of"+.ctf_fee+"z in order to participate.";
}
}
if(.@ctf_pay_fail) {
mapannounce "prontera","Capture the Flag is delayed due to a "+(.@ctf_pay_fail > 1?"few members":"member")+" unable to pay the registration fee.",0;
end;
}
else {
set $@ctf_closed,1;
announce "Capture the Flag is now in session.",0;
for(set .@i,0; .@i < getarraysize($@ctf_team_1); set .@i,.@i+1) {
attachrid $@ctf_team_1[.@i];
set Zeny,Zeny-.ctf_fee;
sc_end SC_ALL;
set @number_death,.ctf_num_die;
detachrid;
}
for(set .@i,0; .@i < getarraysize($@ctf_team_2); set .@i,.@i+1) {
attachrid $@ctf_team_2[.@i];
set Zeny,Zeny-.ctf_fee;
sc_end SC_ALL;
set @number_death,.ctf_num_die;
detachrid;
}
callfunc "CTF_GAMERESET";
sleep 10000;
soundeffectall "NewRound.wav",0,"bat_b01";
mapannounce "bat_b01","[Round "+($@ctf_rnd2+1)+"] Starting in...",0;
sleep 1500;
soundeffectall "5.wav",0,"bat_b01";
mapannounce "bat_b01","5...",0;
sleep 1000;
soundeffectall "4.wav",0,"bat_b01";
mapannounce "bat_b01","4...",0;
sleep 1000;
soundeffectall "3.wav",0,"bat_b01";
mapannounce "bat_b01","3...",0;
sleep 1000;
soundeffectall "2.wav",0,"bat_b01";
mapannounce "bat_b01","2...",0;
sleep 1000;
soundeffectall "1.wav",0,"bat_b01";
mapannounce "bat_b01","1...",0;
sleep 1000;
soundeffectall "Play.wav",0,"bat_b01";
mapannounce "bat_b01","Play!",0;
setcell "bat_b01",59,121,66,121,cell_walkable,1;
setcell "bat_b01",333,182,340,182,cell_walkable,1;
setcell "bat_b01",94,140,94,159,cell_walkable,1;
setcell "bat_b01",305,159,305,140,cell_walkable,1;
for(set .@i,0; .@i < getarraysize($@ctf_team_1); set .@i,.@i+1) {
attachrid $@ctf_team_1[.@i];
dispbottom "Objective: Steal the opposing team's flag back to your base and protect your own flag.";
detachrid;
}
for(set .@i,0; .@i < getarraysize($@ctf_team_2); set .@i,.@i+1) {
attachrid $@ctf_team_2[.@i];
dispbottom "Objective: Steal the opposing team's flag back to your base and protect your own flag.";
detachrid;
}
}
}
end;
}
else {
if(@ctf_1) {
for(set @i,0; @i < getarraysize($@ctf_team_1); set @i,@i+1) {
if($@ctf_team_1[@i] == playerattached()) {
deletearray $@ctf_team_1[@i],1;
set @ctf_1,0;
break;
}
}
}
else if(@ctf_2) {
for(set @i,0; @i < getarraysize($@ctf_team_2); set @i,@i+1) {
if($@ctf_team_2[@i] == playerattached()) {
deletearray $@ctf_team_2[@i],1;
set @ctf_2,0;
break;
}
}
}
set @ctf_member,0;
mes "You are now unregistered for Capture the Flag.";
}
close;
case 2:
mes "^FF0000Red Team^000000:";
for(set @i,0; @i < getarraysize($@ctf_team_1); set @i,@i+1) {
mes rid2name($@ctf_team_1[@i]);
}
if(!@i) mes "No members currently registered for ^FF0000Red Team^000000.";
next;
mes "^0000FFBlue Team^000000:";
for(set @i,0; @i < getarraysize($@ctf_team_2); set @i,@i+1) {
mes rid2name($@ctf_team_2[@i]);
}
if(!@i) mes "No members currently registered for ^0000FFBlue Team^000000.";
close;
case 3:
mes "The main objective is to steal the opposing team's flag. You may register as ^FF0000Red^000000 or ^0000FFBlue^000000 Team.";
next;
mes "The winning team will be decided with the most wins. When you die, you will be ressurected back to your base.";
next;
mes "You must pay a fee of "+.ctf_fee+"z in order to participate in Capture the Flag.";
next;
mes "This is definitely not a one-man mission. You must work together with your team to win!";
case 4:
default:
close;
}
OnPCLogOutEvent:
if(!$@ctf_closed) {
if(@ctf_1) {
for(set @i,0; @i < getarraysize($@ctf_team_1); set @i,@i+1) {
if($@ctf_team_1[@i] == playerattached()) {
deletearray $@ctf_team_1[@i],1;
break;
}
}
}
else if(@ctf_2) {
for(set @i,0; @i < getarraysize($@ctf_team_2); set @i,@i+1) {
if($@ctf_team_2[@i] == playerattached()) {
deletearray $@ctf_team_2[@i],1;
break;
}
}
}
}
end;
OnInit:
callfunc "CTF_RESET";
// Required amount of team members on each team to start \
set .ctf_min_req,5;
// Ressurection time (Will increase by one second each death per round) \
set .ctf_num_die,4;
// Registration fee \
set .ctf_fee,0;
}
prontera,152,232,5 duplicate(ctf_npc) CTF Soldier#1 825
prontera,159,232,5 script CTF Prize NPC 103,{
if(!ctf_win) {
mes .name$;
mes "Win a game of Capture the Flag to earn prizes from me.";
}
else {
mes .name$;
mes "Would you like to claim your "+(ctf_win > 1?"prizes":"prize")+"?";
next;
if(select("Yes:No") == 2) close;
while(ctf_win) {
set .@item,rand(getarraysize(.prize_id));
getitem .prize_id[.@item],.prize_count[.@item];
set ctf_win,ctf_win-1;
}
mes .name$;
mes "Here are you prizes. Have a nice day.";
}
close;
OnInit:
set .name$,"[CTF Prize NPC]";
// Prizes
}