-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcapture.sk
1123 lines (1087 loc) · 53.7 KB
/
capture.sk
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
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Capture The Point by LimeGlass
# Version 1.0
#
# Addons required:
# Skacket 1.0.13
# ProtocolLib
# Skellett
# SkQuery
# Skript (Tested on 2.6.3)
#
options:
prefix: &8[&a&lCTP&8] &f
# The world the game is played in
world: "Capture"
# Teams are the Skript colour type
team1: orange
team2: purple
on load:
# Game Manger
GameManager_Register_Game("capture", "Capture The Point", script)
if {capture::lobby} is not set:
set {capture::lobby} to spawn of world {@world}
if GameManager_Get_Game_Key() is "capture":
{game::status} is not "ending"
set {game::status} to "waiting"
if {game::status} is not set:
set {game::status} to "waiting"
on player world change:
# Reset the player when they get teleported to another world. Aka spectator or whatever.
if event-world was world {@world}:
set gamemode of player to survival
clear player's inventory
heal player
feed player
stop
the event-world will be world {@world}
GameManager_Get_Game_Key() is "capture"
if {game::status} is "playing":
set gamemode of player to spectator
teleport player to {capture::arena::%{capture::temp::arena}%::spectatorspawn}
message "{@prefix}&cThe game is currently being played, you've been put into spectator mode."
if {capture::temp::players::*} doesn't contain player:
add player to {capture::temp::players::*}
stop
on join:
if GameManager_Get_Game_Key() is "capture":
teleport player to {capture::lobby}
if {game::status} is "playing":
set gamemode of player to spectator
teleport player to {capture::arena::%{capture::temp::arena}%::spectatorspawn}
message "{@prefix}&cThe game is currently being played, you've been put into spectator mode."
add player to {capture::temp::players::*}
stop
clear inventory of player
on unload:
reveal all players to all players
loop all entities in world {@world}:
metadata "capture-inventory-reset" of loop-entity is true
delete loop-entity
if {capture::temp::arena} is not set:
delete {capture::temp::*}
else:
captureEndGame({capture::temp::arena})
function openCaptureVotingMenu(player: player):
set {_inventory} to a chest inventory with 1 row named " &8&l&nMap Vote"
set metadata "capture-inventory" of {_player} to {_inventory}
open {_inventory} to {_player}
while current inventory of {_player} is {_inventory}:
set {_index} to 0
loop indices of {capture::arenas::*}:
set slot {_index} of {_inventory} to paper named "&a&l%{capture::arenas::%loop-value%::name}%" with lore "&fVotes: &l%{capture::temp::voting::map::%loop-value%}%", "" and "&7Click to vote for %{capture::arenas::%loop-value%::name}%"
add 1 to {_index}
wait 5 ticks
on right click with nether star:
world of player is world {@world}
{game::status} is "starting"
openCaptureVotingMenu(player)
on inventory close:
clear metadata "capture-inventory" of player
on inventory click:
clicked inventory is metadata "capture-inventory" of player
cancel event
set {_clicked} to index of clicked slot
set {_index} to 0
set {_existing} to {capture::temp::voting::selection::%player%}
loop indices of {capture::arenas::*}:
if {_index} is {_clicked}:
set {capture::temp::voting::selection::%player%} to loop-value
if {_existing} is set:
subtract 1 from {capture::temp::voting::map::%{_existing}%}
add 1 to {capture::temp::voting::map::%loop-value%}
# New vote
{_existing} is not loop-value
message "{@prefix}&aYou have voted for map &l%{capture::arenas::%loop-value%::name}%"
play sound "ENTITY_EXPERIENCE_ORB_PICKUP" to player
exit loop
add 1 to {_index}
function captureResetPlayer(player: player, teleport: boolean = false):
set {_powerup} to slot 8 of {_player}
clear inventory of {_player}
set slot 8 of {_player} to {_powerup}
set gamemode of {_player} to survival
equip {_player} with leather helmet
equip {_player} with leather chestplate
equip {_player} with leather leggings
equip {_player} with leather boots
make {_player} stop flying
reveal {_player} to all players
if {capture::temp::{@team1}::*} contains {_player}:
dye {_player}'s helmet {@team1}
dye {_player}'s chestplate {@team1}
dye {_player}'s leggings {@team1}
dye {_player}'s boots {@team1}
set tablist name of {_player} to "<{@team1}>%{_player}%"
{_teleport} is true
if {capture::temp::player::%{_player}%::selectedSpawn} is set:
teleport {_player} to {capture::temp::player::%{_player}%::selectedSpawn}
else:
teleport {_player} to {capture::arenas::%{capture::temp::arena}%::{@team1}spawn}
else:
dye {_player}'s helmet {@team2}
dye {_player}'s chestplate {@team2}
dye {_player}'s leggings {@team2}
dye {_player}'s boots {@team2}
set tablist name of {_player} to "<{@team2}>%{_player}%"
{_teleport} is true
if {capture::temp::player::%{_player}%::selectedSpawn} is set:
teleport {_player} to {capture::temp::player::%{_player}%::selectedSpawn}
else:
teleport {_player} to {capture::arenas::%{capture::temp::arena}%::{@team2}spawn}
add an iron sword to {_player}
add a bow to {_player}
add 15 of arrows to {_player}
add 3 beetroot soup named "&c&lRegen Heal" to {_player}
{_teleport} is true
apply regeneration 4 to {_player} for 10 seconds
apply resistance 5 to {_player} for 10 seconds
on quit:
{capture::temp::players::*} contains player
remove player from {capture::temp::players::*}
message "{@prefix}&7%player% has left the game."
reset tablist name of player
on death of player:
event-world is world {@world}
if attacker is a player:
if {capture::temp::{@team1}::*} contains attacker:
add 50 to {capture::temp::points::{@team1}}
message "&f+50 <{@team2}>%victim% &fdied to <{@team1}>%attacker%" to {capture::temp::players::*}
set death message to ""
else if {capture::temp::{@team2}::*} contains attacker:
add 50 to {capture::temp::points::{@team2}}
message "&f+50 <{@team1}>%victim% &fdied to <{@team2}>%attacker%" to {capture::temp::players::*}
set death message to ""
else:
message "&7%death message%" to {capture::temp::players::*}
set death message to ""
clear drops
force victim to respawn
wait a tick
make victim start flying
teleport victim to {capture::arena::%{capture::temp::arena}%::spectatorspawn}
#set gamemode of victim to spectator
apply invisibility to victim for 10 seconds
hide victim from {capture::temp::players::*}
set {_team} to captureGetTeam(victim)
loop indices of {capture::arenas::%{capture::temp::arena}%::condspawn::%{_team}%::*}:
{capture::temp::captures::%{_team}%::*} contains loop-value
add paper named "&6Set spawn to point %loop-value%" with lore "&7%loop-value%" to victim
send title " " with subtitle "&4&lYou died" to victim for 2 seconds with fadein 0 ticks and fadeout 2 seconds
wait 2 seconds
if attacker is a player:
set spectator target of victim to attacker
loop integers between 8 and 1:
send title "&c&lRespawning in %loop-number% seconds" with subtitle " " to victim for 2 seconds with fadein 0 ticks and fadeout a second
wait a second
captureResetPlayer(victim, true)
send title " " with subtitle "&aRespawning now" to victim for 2 seconds with fadein 0 ticks and fadeout a second
on right click with paper:
event-world is world {@world}
{game::status} is "playing"
set {_capture} to line 1 of lore of event-item
set {_team} to captureGetTeam(player)
loop indices of {capture::arenas::%{capture::temp::arena}%::condspawn::%{_team}%::*}:
{_capture} contains loop-value
if {capture::temp::captures::%{_team}%::*} doesn't contain loop-value:
message "&c&lYour team doesn't own this capture point anymore!"
remove event-item from player
play sound "ENTITY_VILLAGER_NO" at pitch 0 to player
else:
set {capture::temp::player::%player%::selectedSpawn} to {capture::arenas::%{capture::temp::arena}%::condspawn::%{_team}%::%loop-value%}
play sound "BLOCK_LEVER_CLICK" at pitch 0 to player
message "&d&lYou have set your next spawning location to %loop-value%"
on place:
event-world is world {@world}
if GameManager_Is_Staff(player) is true:
{game::status} is not "playing"
stop
cancel event
on break:
event-world is world {@world}
if GameManager_Is_Staff(player) is true:
{game::status} is not "playing"
stop
cancel event
on hunger meter change:
event-world is world {@world}
set food level of player to 10
on right click with beetroot soup:
event-world is world {@world}
cancel event
play sound "ENTITY_GENERIC_EAT"
set slot player's current hotbar slot of player to air
apply regeneration 4 to player for 3 seconds
loop 30 times:
show beetroot soup item crack random vector location of player's eyes
chance of 5%:
wait a tick
function captureGetTeam(player: player) :: string:
if {capture::temp::{@team1}::*} contains {_player}:
return "{@team1}"
else if {capture::temp::{@team2}::*} contains {_player}:
return "{@team2}"
function captureStart(voting: boolean = false, tutorial: boolean = true):
{lobby::players::*} is set
{game::status} is "waiting"
GameManager_Set_Game_Status("starting")
if {_voting} is true:
set {_time} to 30 seconds
play sound "UI_BUTTON_CLICK" at pitch 0 to {lobby::players::*}
message "", "{@prefix}&fGame is starting! 30 seconds to vote for a map by clicking the nether star in your lobby inventory." and "" to {lobby::players::*}
loop {lobby::players::*}:
clear inventory of loop-value
set slot 4 of loop-value to nether star named "&6&lMap Vote" with lore "&7Click to vote on the map to play"
loop indices of {capture::arenas::*}:
set {capture::temp::voting::map::%loop-value%} to 0
while {_time} is greater than 0 seconds:
if {game::status} is not "starting":
stop
if {lobby::players::*} is not set:
stop
if {_time} is 1 second, 2 seconds, 3 seconds, 4 seconds, 5 seconds, 10 seconds or 15 seconds:
message "{@prefix}&7%{_time}% left in the voting!" to {lobby::players::*}
play sound "UI_BUTTON_CLICK" at pitch 2 to {lobby::players::*}
wait a second
subtract a second from {_time}
loop indices of {capture::arenas::*}:
if {_votes} is not set:
set {capture::temp::arena} to loop-value
set {_votes} to {capture::temp::voting::map::%loop-value%}
else if {capture::temp::voting::map::%loop-value%} is greater than {_votes}:
set {capture::temp::arena} to loop-value
set {_votes} to {capture::temp::voting::map::%loop-value%}
delete {capture::temp::voting::*}
close inventory to {lobby::players::*}
message "{@prefix}&6&lMap &f&l%{capture::arenas::%{capture::temp::arena}%::name}% &6&lhas won the voting with &f&l%{_votes}% &6&lvotes!" to {lobby::players::*}
play sound "BLOCK_NOTE_BLOCK_PLING" at pitch 1 to {lobby::players::*}
clear inventory of {lobby::players::*}
if {capture::temp::arena} is not set:
set {capture::temp::arena} to a random element out of all indices of {capture::arenas::*}
message "{@prefix}&6&lMap &f&l%{capture::arenas::%{capture::temp::arena}%::name}% &6&lhas been selected!" to {lobby::players::*}
set {_time} to 5 seconds
if {_tutorial} is false:
set {_time} to 0 seconds
while {_time} is greater than 0 seconds:
if {game::status} is not "starting":
stop
play sound "BLOCK_NOTE_BLOCK_HAT" to {lobby::players::*}
message "{@prefix}&b&lGame is starting in %{_time}%!" to {lobby::players::*}
wait a second
subtract a second from {_time}
loop indices of {capture::arenas::%{capture::temp::arena}%::captures::*}:
add {capture::arenas::%{capture::temp::arena}%::captures::%loop-value%::*} to {_captures::*}
set {capture::temp::players::*} to {lobby::players::*}
set {_tutorialTime} to 6 * 20
if {_tutorial} is false:
set {_tutorialTime} to 0
set gamemode of {capture::temp::players::*} to spectator
clear dropped items in world {@world}
teleport {capture::temp::players::*} to {capture::arena::%{capture::temp::arena}%::spectatorspawn}
loop "start", "capture", "points", "inventory" and "powerups":
teleport {capture::temp::players::*} to {capture::arenas::%{capture::temp::arena}%::tutorial::%loop-value-1%}
play sound "BLOCK_NOTE_BLOCK_PLING" at pitch 2 to {capture::temp::players::*}
loop 100 times:
message " " to {capture::temp::players::*}
make {capture::temp::players::*} start flying
if loop-value is "capture":
message "&fThis is a capture point. You capture it for your team by standing in the area", "&fThe more teammates that are on the point, the faster it'll capture." and "" to {capture::temp::players::*}
else if loop-value is "points":
message "&aThis is a point spawner. Collecting it will gain 300 points for your team." and "" to {capture::temp::players::*}
loop {capture::arenas::%{capture::temp::arena}%::pointspawns::*}:
drop emerald named "&a&lEarn Points" 0.5 above loop-value-2 without velocity
set metadata "capture-earn-points" of last dropped item to true
launch ball coloured lime at location 0.1 below loop-value-2 with duration 0
set block at loop-value-2 to emerald block
else if loop-value is "inventory":
message "&6This is an inventory restore point. Collecting it will restore your inventory." and "" to {capture::temp::players::*}
loop {capture::arenas::%{capture::temp::arena}%::inventoryresets::*}:
drop chest named "&6&lInventory Reset" 0.5 above loop-value-2 without velocity
set metadata "capture-inventory-reset" of last dropped item to true
launch ball coloured yellow at location 0.1 below loop-value-2 with duration 0
set block at loop-value-2 to gold block
else if loop-value is "powerups":
message "&bThis is a powerup spawner. Collecting it will give you a powerup to use." and "" to {capture::temp::players::*}
loop {capture::arenas::%{capture::temp::arena}%::powerups::*}:
drop diamond named "&b&lPowerup" 0.5 above loop-value-2 without velocity
set metadata "capture-powerup" of last dropped item to true
launch ball coloured light blue at location 0.1 below loop-value-2 with duration 0
set block at loop-value-2 to beacon
else:
message "", "&3&lWelcome To Capture The Point", "&7Goal of the game is to capture all 5 points", "&7with your team. You earn points every 2 seconds.", "&7The more captures you have, the points are given.", "The team that reachs 15,000 points first wins!", "&aGood luck and have fun!" and "" to {capture::temp::players::*}
{_tutorial} is true
wait 3 seconds
loop {_tutorialTime} times:
if {game::status} is not "starting":
stop
if loop-value-1 is not "start":
teleport {capture::temp::players::*} to {capture::arenas::%{capture::temp::arena}%::tutorial::%loop-value-1%}
wait a tick
# Start working on resetting arena during tutorial
set {_block} to a random element out of {_captures::*}
if block at {_block} is not white stained hardened clay:
set block at {_block} to white stained hardened clay
remove {_block} from {_captures::*}
loop {_captures::*}:
if loop-value is not white stained hardened clay:
set loop-value to white stained hardened clay
clear {_captures::*}
loop 100 times:
message " " to {capture::temp::players::*}
GameManager_Set_Game_Status("playing")
set gamemode of {capture::temp::players::*} to survival
setup skoreboard for {capture::temp::players::*}
make {capture::temp::players::*} stop flying
set {_players::*} to {lobby::players::*}
set {_toggle} to random element out of true and false
loop size of {_players::*} times:
set {_player} to random element out of {_players::*}
if {_toggle} is true:
add {_player} to {capture::temp::{@team1}::*}
message "{@prefix}<{@team1}>&lYou've been added to team {@team1}!" to {_player}
else:
add {_player} to {capture::temp::{@team2}::*}
message "{@prefix}<{@team2}>&lYou've been added to team {@team2}!" to {_player}
captureResetPlayer({_player}, true)
remove {_player} from {_players::*}
set {_toggle} to not {_toggle}
# Powerups load
clear {capture::temp::powerups::*} and {capture::temp::powerup::*}
add tnt block named "&c&lProximity Mine" with lore "&7Drop the tnt block to set" and "&7the proximity mine active" to {capture::temp::powerups::*}
add stone axe named "&2&lJump Slam" with lore "&7Right clicking on will launch", "&7you into the air you're facing, and" and "&7grand slam down creating an explosion on landing." to {capture::temp::powerups::*}
add string named "&f&lSmoke Bomb" with lore "&7Drop at a location to create a smoke bomb" to {capture::temp::powerups::*}
play sound "ENTITY_PLAYER_LEVELUP" at pitch 2 to {capture::temp::players::*}
message "&f&lGood luck and have fun!" and "" to {capture::temp::players::*}
set title of skoreboard {capture::temp::players::*} to "&6&lCapture The Point"
set slot 13, 11, and 6 of skoreboard {capture::temp::players::*} to " "
set slot 12 of skoreboard {capture::temp::players::*} to "&7First to 15,000"
set slot 10 of skoreboard {capture::temp::players::*} to "&6Team {@team1}"
set slot 8 of skoreboard {capture::temp::players::*} to "&5Team {@team2}"
loop indices of {capture::arenas::%{capture::temp::arena}%::captures::*}:
loop {capture::arenas::%{capture::temp::arena}%::captures::%loop-value%::*}:
add location of loop-value-2 to {_captures::%loop-value-1%::*}
set {_captureState::%loop-value%} to 0
while {game::status} is "playing":
if {capture::temp::players::*} is not set:
captureEndGame({capture::temp::arena})
stop
set slot 9 of skoreboard {capture::temp::players::*} to "&f&l%{capture::temp::points::{@team1}} otherwise 0%"
set slot 7 of skoreboard {capture::temp::players::*} to "&f&l%{capture::temp::points::{@team2}} otherwise 0%"
set {_index} to 5
set {_toggle} to true
loop indices of {capture::arenas::%{capture::temp::arena}%::captures::*}:
clear {_bold}, {_pullback}, {_update}, {_status}, {_yes}, {_add}, {_pull} and {_playersCapturing::*}
set {_colour} to white
if {capture::temp::captures::{@team1}::*} is set:
{capture::temp::captures::{@team1}::*} contains loop-value
set {_colour} to {@team1}
if {capture::temp::captures::{@team2}::*} is set:
{capture::temp::captures::{@team2}::*} contains loop-value
set {_colour} to {@team2}
# player standing on point
loop {capture::temp::players::*}:
clear {_yes}
if {_captures::%loop-value-1%::*} contains location of block below loop-value-2:
set {_yes} to true
else if {_captures::%loop-value-1%::*} contains location of block 2 below loop-value-2:
set {_yes} to true
{_yes} is true
set {_bold} to true
add loop-value-2 to {_playersCapturing::*}
if {capture::temp::{@team1}::*} contains loop-value-2:
subtract 1 from {_pull}
else if {capture::temp::{@team2}::*} contains loop-value-2:
add 1 to {_pull}
abs({_captureState::%loop-value-1%}) is less than or equal to 10
set {_status} to " %abs({_captureState::%loop-value-1%})%/10"
# Not full captured, fading
if {_status} is not set:
abs({_captureState::%loop-value%}) is not 0 or 10
set {_status} to " %abs({_captureState::%loop-value%})%/10"
# Contested
if {_pull} is 0:
set {_colour} to light blue
set {_add} to "<bold>" if {_bold} is set, otherwise ""
loop {capture::temp::players::*}:
if {_playersCapturing::*} is set:
if {_playersCapturing::*} contains loop-value-2:
set {_add} to "%{_add}%<underline>"
set line {_index} of skoreboard loop-value-2 to "<%{_colour}%>%{_add}%%loop-value-1%%{_status} otherwise ""%"
subtract 1 from {_index}
# Do update this loop
if {_toggle}:
# Not full captured, fading (Attempts to bring back to it's last known state)
if {_pull} is not set:
abs({_captureState::%loop-value%}) is between 1 and 9
if {_captureState::%loop-value%} is less than 0:
# A team still owns the capture if someone didn't reset it to 0
if {capture::temp::captures::{@team1}::*} contains loop-value:
subtract 1 from {_captureState::%loop-value%}
set {_pullback} to true
else:
add 1 to {_captureState::%loop-value%}
else:
if {capture::temp::captures::{@team2}::*} contains loop-value:
add 1 to {_captureState::%loop-value%}
set {_pullback} to true
else:
subtract 1 from {_captureState::%loop-value%}
set {_update} to true
else:
{_pull} is not 0
if abs({_captureState::%loop-value%}) is less than 10:
if {_captureState::%loop-value%} is 0:
remove loop-value from {capture::temp::captures::{@team1}::*} and {capture::temp::captures::{@team2}::*}
add {_pull} to {_captureState::%loop-value%}
set {_update} to true
else if {_captureState::%loop-value%} is less than or equal to -10:
if {capture::temp::captures::{@team1}::*} contains loop-value:
# Confirm that it's being captured by another team other than owner
{_pull} is greater than 0
add {_pull} to {_captureState::%loop-value%}
set {_update} to true
abs({_captureState::%loop-value%}) is 10
set blocks at {_captures::%loop-value%::*} to {@team1} stained hardened clay
else:
add loop-value to {capture::temp::captures::{@team1}::*}
set {_loc} to location of first element out of {_captures::%loop-value%::*}
play sound "ITEM_TOTEM_USE" at volume 0.4 at pitch 0 at {_loc}
set blocks at {_captures::%loop-value%::*} to {@team1} stained hardened clay
remove loop-value from {capture::temp::captures::{@team2}::*}
launch ball large coloured {@team1} at {_loc} with duration 0
send title " " with subtitle "<{@team1}>&l{@team1} just captured %loop-value%!" to {capture::temp::players::*} for 2 seconds with fadein 5 ticks and fadeout 5 ticks
else if {_captureState::%loop-value%} is greater than or equal to 10:
if {capture::temp::captures::{@team2}::*} contains loop-value:
# Confirm that it's being captured by another team other than owner
{_pull} is less than 0
add {_pull} to {_captureState::%loop-value%}
set {_update} to true
abs({_captureState::%loop-value%}) is 10
set blocks at {_captures::%loop-value%::*} to {@team2} stained hardened clay
else:
add loop-value to {capture::temp::captures::{@team2}::*}
set {_loc} to location of first element out of {_captures::%loop-value%::*}
play sound "ITEM_TOTEM_USE" at volume 0.4 at pitch 0 at {_loc}
set blocks at {_captures::%loop-value%::*} to {@team2} stained hardened clay
remove loop-value from {capture::temp::captures::{@team1}::*}
launch ball large coloured {@team2} at {_loc} with duration 0
send title " " with subtitle "<{@team2}>&l{@team2} just captured %loop-value%!" to {capture::temp::players::*} for 2 seconds with fadein 5 ticks and fadeout 5 ticks
if {_update} is true:
abs({_captureState::%loop-value%}) is between 1 and 10
set {_percentage} to (9 - (10 - abs({_captureState::%loop-value%}))) * 0.1
clear {_change}, {_changed::*} and {_unchanged::*}
loop {_captures::%loop-value%::*}:
if block at loop-value-2 is not white stained hardened clay:
add block at loop-value-2 to {_changed::*}
else:
add block at loop-value-2 to {_unchanged::*}
set {_target} to rounded {_percentage} * size of {_captures::%loop-value%::*}
# Reduce some blocks
if size of {_changed::*} is greater than {_target}:
play sound "BLOCK_WOOD_PLACE" at first element out of {_captures::%loop-value%::*}
while size of {_changed::*} is greater than {_target}:
set {_change} to a random element out of {_changed::*}
set block at {_change} to white stained hardened clay
remove {_change} from {_changed::*}
# Add some blocks
else:
play sound "BLOCK_STONE_PLACE" at first element out of {_captures::%loop-value%::*}
while size of {_changed::*} is less than {_target}:
set {_change} to a random element out of {_unchanged::*}
if {_pullback}:
if {capture::temp::captures::{@team2}::*} contains loop-value:
set block at {_change} to {@team2} stained hardened clay
abs({_captureState::%loop-value%}) is 10
set blocks at {_unchanged::*} to {@team2} stained hardened clay
else:
set block at {_change} to {@team1} stained hardened clay
abs({_captureState::%loop-value%}) is 10
set blocks at {_unchanged::*} to {@team1} stained hardened clay
else:
if {_pull} is less than 0:
set block at {_change} to {@team1} stained hardened clay
else:
set block at {_change} to {@team2} stained hardened clay
remove {_change} from {_unchanged::*}
add {_change} to {_changed::*}
set {_toggle} to not {_toggle}
wait a second
if {capture::temp::captures::{@team1}::*} is set:
add 2 * size of {capture::temp::captures::{@team1}::*} to {capture::temp::points::{@team1}}
if {capture::temp::captures::{@team2}::*} is set:
add 2 * size of {capture::temp::captures::{@team2}::*} to {capture::temp::points::{@team2}}
if {capture::temp::points::{@team2}} is greater or equal to 15000:
loop {capture::temp::{@team2}::*}:
GameManager_Add_Win(loop-value)
send title "<{@team2}>&lTeam {@team2} are the winners!" with subtitle "&fThanks for playing!" to {capture::temp::players::*} for 4 seconds with fadein 0 ticks and fadeout 2 seconds
captureEndGame({capture::temp::arena}, {@team2})
else if {capture::temp::points::{@team1}} is greater or equal to 15000:
loop {capture::temp::{@team1}::*}:
GameManager_Add_Win(loop-value)
send title "<{@team1}>&lTeam {@team1} are the winners!" with subtitle "&fThanks for playing!" to {capture::temp::players::*} for 4 seconds with fadein 0 ticks and fadeout 2 seconds
captureEndGame({capture::temp::arena}, {@team1})
loop {capture::temp::players::*}:
gamemode of loop-value is spectator
distance between {capture::arena::%{capture::temp::arena}%::spectatorspawn} and loop-value is greater than 1000:
teleport loop-value to {capture::arena::%{capture::temp::arena}%::spectatorspawn}
function captureEndGame(arena: string, colour: colour = white):
message " ", "&a&lThanks for playing Capture The Point by Lime!" and " " to {capture::temp::players::*}
set {game::status} to "ending"
# Spam add a bunch of random locations for fireworks
loop {capture::temp::players::*}:
gamemode of loop-value is not spectator
add location 3 above loop-value to {_locations::*}
loop 5 times:
add location of random element out of all blocks in radius 15 around loop-value-1 to {_locations::*}
loop 5 times:
add location 10 above random element out of all blocks in radius 15 around loop-value-1 to {_locations::*}
loop indices of {capture::arenas::%{capture::temp::arena}%::captures::*}:
add location of first element out of {capture::arenas::%{capture::temp::arena}%::captures::%loop-value%::*} to {_locations::*}
add location 10 above first element out of {capture::arenas::%{capture::temp::arena}%::captures::%loop-value%::*} to {_locations::*}
add location of random element out of all blocks in radius 15 around first element out of {capture::arenas::%{capture::temp::arena}%::captures::%loop-value%::*} to {_locations::*}
set {_time} to 10 seconds
if {capture::temp::players::*} is not empty:
while {_time} is greater than 0 seconds:
subtract 2 ticks from {_time}
wait 2 ticks
launch ball large coloured {_colour} at random element out of {_locations::*} with duration 2
loop all entities in world {@world}:
if metadata "capture-inventory-reset" of loop-entity is true:
delete loop-entity
else if metadata "capture-earn-points" of loop-entity is true:
delete loop-entity
else if metadata "capture-powerup" of loop-entity is true:
delete loop-entity
loop indices of {capture::arenas::%{capture::temp::arena}%::captures::*}:
add {capture::arenas::%{capture::temp::arena}%::captures::%loop-value%::*} to {_captures::*}
loop {_captures::*}:
set loop-value to white stained hardened clay
set blocks at {capture::arenas::%{capture::temp::arena}%::pointspawns::*} to emerald block
set blocks at {capture::arenas::%{capture::temp::arena}%::inventoryresets::*} to gold block
set blocks at {capture::arenas::%{capture::temp::arena}%::powerups::*} to beacon
clear inventory of {capture::temp::players::*}
reset tablist name of {capture::temp::players::*}
reset skoreboard of {capture::temp::players::*}
teleport {capture::temp::players::*} to {capture::lobby}
set gamemode of {capture::temp::players::*} to survival
delete {capture::temp::*}
set {game::status} to "waiting"
function capturePowerup(player: player, rigged: number = 0):
if {_rigged} is 0:
loop integers between 1 and 2:
loop 9 times:
set {_decimal} to "%loop-number-1%.%loop-number-2%" parsed as number
add a tick to {_time}
play sound "ENTITY_EXPERIENCE_ORB_PICKUP" at pitch {_decimal} to {_player}
set {_last} to random element out of {capture::temp::powerups::*} where [itemtype input is not {_last}]
set slot 8 of {_player} to {_last} named "&b&lSELECTING POWERUP..."
wait {_time}
else:
set slot 8 of {_player} to {capture::temp::powerups::%{_rigged}%}
play sound "ENTITY_EXPERIENCE_ORB_PICKUP" at pitch 2 to {_player}
play sound "BLOCK_SMITHING_TABLE_USE" at pitch 2 to {_player}
set slot 8 of {_player} to a random element out of {capture::temp::powerups::*}
set {_type} to type of slot 8 of {_player}
if {_type} is tnt block:
set {_description} to "&aDrop the tnt block to set the proximity mine active"
play sound "ENTITY_GENERIC_EXTINGUISH_FIRE" at volume 0.5 at pitch 2 to {_player}
play sound "BLOCK_NOTE_BLOCK_HARP" at pitch 0 to {_player}
play sound "ENTITY_GENERIC_EXPLODE" at volume 0.5 at pitch 1 to {_player}
wait 9 ticks
play sound "ENTITY_GENERIC_EXPLODE" at volume 0.5 at pitch 2 to {_player}
play sound "BLOCK_NOTE_BLOCK_HARP" at pitch 2 to {_player}
wait 9 ticks
play sound "ENTITY_GENERIC_EXPLODE" at volume 0.5 at pitch 2 to {_player}
play sound "BLOCK_NOTE_BLOCK_HARP" at pitch 2 to {_player}
else if {_type} is a stone axe:
set {_description} to "&aRight clicking on will launch you into the air you're facing, and grand slam down creating an explosion on landing."
else if {_type} is a string:
set {_description} to "&aDrop to place a smoke bomb at a location."
set {_team} to captureGetTeam({_player})
loop {capture::temp::players::*}:
captureGetTeam(loop-value) is {_team}
send loop-value toast notification "&b%{_player}% has powerup %name of slot 8 of {_player}%" with icon {_type} and frame task
loop 6 times:
send action bar {_description} to {_player}
wait 2 seconds
on left click with stone axe:
metadata "capture-grand-slam" of player is true
delete metadata "capture-grand-slam" of player
on right click:
event-world is world {@world}
{game::status} is "playing"
cancel event
player's current hotbar slot is 8
set {_item} to slot 8 of player
if {_item} is a tnt block named "&c&lProximity Mine":
message "{@prefix}&aDrop the tnt block to set the proximity mine active. You can left click in the air to target your direction."
else if {_item} is a stone axe named "&2&lJump Slam":
push player upwards at speed 1.4
wait a tick
#play sound "ENTITY_WARDEN_ROAR" at pitch 1 at player
loop all players:
loop-player is not player
add loop-player to {_sound::*}
play sound "ENTITY_WARDEN_ROAR" at pitch 0 at player for {_sound::*}
push player forwards at speed 1
set metadata "capture-grand-slam" of player to true
set {_time} to 1.6 seconds
set {_decimal} to 0.5
while {_time} is greater than 0 seconds:
wait 3 ticks
subtract 3 ticks from {_time}
add 0.1 to {_decimal}
if player is on the ground:
exit loop
play sound "BLOCK_NOTE_BLOCK_HAT" at pitch {_decimal} at player
metadata "capture-grand-slam" of player is not set
exit loop
if metadata "capture-grand-slam" of player is true:
push player downwards at speed 3
push player forwards at speed 0.5
else:
push player direction from player to target block at speed 5
while player is not on the ground:
wait a tick
set the fallen distance of player to 0
play sound "ENTITY_GENERIC_EXPLODE" at pitch 0 at player
play sound "ENTITY_GENERIC_EXPLODE" at player
play sound "ENTITY_GENERIC_EXPLODE" at player
set slot 8 of player to air
loop 30 times:
show cloud random vector location of player
set {_team} to captureGetTeam(player)
loop all entities in radius 5 around player:
loop-entity is not player
captureGetTeam(loop-entity) is not {_team}
push loop-entity upwards at speed 0.8
damage loop-entity by 4
add loop-entity to {_continue::*}
wait a tick
loop {_continue::*}:
push loop-value direction from player to loop-value at speed 1
else if {_item} is string named "&f&lSmoke Bomb":
message "{@prefix}&aDrop to place a smoke bomb at a location."
on drop:
event-world is world {@world}
if player's current hotbar slot is 8:
#{game::status} is "playing"
if event-item is a tnt block named "&c&lProximity Mine":
set {_team} to captureGetTeam(player)
set metadata "capture-mine" of event-dropped item to {_team}
add velocity of event-dropped item to velocity of event-dropped item
while event-dropped item is not on the ground:
show electric spark at location of event-dropped item
wait a tick
show sonic boom at event-dropped item
wait 4 ticks
loop 40 times:
show warped spore random vector location of event-dropped item
wait 4 ticks
play sound "BLOCK_RESPAWN_ANCHOR_DEPLETE" at pitch 2 at event-dropped item
show soul at location above event-dropped item
while event-dropped item is alive:
wait 5 ticks
set {_players::*} to all players in radius 4 around event-dropped item
if {_players::*} is not set:
reset display name of event-dropped item
continue
loop {_players::*}:
if captureGetTeam(loop-value) is {_team}:
if {_team} is "{@team1}":
set display name of event-dropped item to "<{@team1}>%player%'s mine"
else:
set display name of event-dropped item to "<{@team2}>%player%'s mine"
{game::status} is not "playing"
delete event-dropped item
exit loop
stop
else if event-item is a string named "&f&lSmoke Bomb":
add velocity of event-dropped item to velocity of event-dropped item
while event-dropped item is not on the ground:
show ash at event-dropped item
wait a tick
set {_location} to location of event-dropped item
delete event-dropped item
loop 40 times:
loop all blocks in radius 6 around {_location}:
play large explosion at location of loop-block
wait 5 ticks
play sound "ENTITY_GENERIC_EXTINGUISH_FIRE" at volume 0.5 at {_location}
stop
if GameManager_Is_Staff(player) is true:
{game::status} is not "playing"
stop
cancel event
on item despawn:
event-itemtype is a chest, emerald or a diamond
if metadata "capture-inventory-reset" of event-dropped item is true:
cancel event
else if metadata "capture-earn-points" of event-dropped item is true:
cancel event
else if metadata "capture-powerup" of event-dropped item is true:
cancel event
on pickup of tnt block:
event-world is world {@world}
cancel event
metadata "capture-mine" of event-dropped item is not captureGetTeam(player)
{game::status} is "playing"
delete event-dropped item
loop 5 times:
show large explosion random vector event-dropped item
create a safe explosion with power 3 at event-dropped item
on pickup of chest:
metadata "capture-inventory-reset" of event-dropped item is true
cancel event
{game::status} is "playing"
set {_location} to location of event-dropped item
delete event-dropped item
play sound "ENTITY_ITEM_PICKUP"
launch ball coloured yellow at location 0.1 below {_location} with duration 0
captureResetPlayer(player)
message "&6&lYour inventory has been restored!" to player
set block below {_location} to iron block
set {_arena} to {capture::temp::arena}
wait 1.5 minutes
{_arena} is {capture::temp::arena}
{game::status} is "playing"
play sound "ITEM_ARMOR_EQUIP_LEATHER" at {_location}
drop event-item at {_location} without velocity
set block below {_location} to gold block
set metadata "capture-inventory-reset" of last dropped item to true
on pickup of emerald:
metadata "capture-earn-points" of event-dropped item is true
cancel event
{game::status} is "playing"
set {_location} to location of event-dropped item
delete event-dropped item
play sound "ENTITY_ITEM_PICKUP"
launch ball coloured lime at location 0.1 below {_location} with duration 0
if {capture::temp::{@team1}::*} contains player:
add 300 to {capture::temp::points::{@team1}}
send {capture::temp::{@team1}::*} toast notification "&a%player% collected 300 points for the team!" with icon emerald and frame goal
else if {capture::temp::{@team2}::*} contains player:
add 300 to {capture::temp::points::{@team2}}
send {capture::temp::{@team2}::*} toast notification "&a%player% collected 300 points for the team!" with icon emerald and frame goal
message "&a&lYou collected 300 points for your team!" to player
set block below {_location} to iron block
set {_arena} to {capture::temp::arena}
wait 1.5 minutes
{_arena} is {capture::temp::arena}
{game::status} is "playing"
play sound "ENTITY_EXPERIENCE_ORB_PICKUP" at pitch 2 at {_location}
drop event-item at {_location} without velocity
set block below {_location} to emerald block
set metadata "capture-earn-points" of last dropped item to true
on pickup of diamond:
metadata "capture-powerup" of event-dropped item is true
cancel event
{game::status} is "playing"
set {_location} to location of event-dropped item
delete event-dropped item
play sound "ENTITY_ITEM_PICKUP"
launch ball coloured light blue at location 0.1 below {_location} with duration 0
message "&b&lYou have picked up a powerup!" to player
capturePowerup(player)
set block below {_location} to iron block
set {_arena} to {capture::temp::arena}
wait 1.5 minutes
{_arena} is {capture::temp::arena}
{game::status} is "playing"
play sound "BLOCK_BEACON_ACTIVATE" at {_location}
drop event-item at {_location} without velocity
set block below {_location} to beacon
set metadata "capture-powerup" of last dropped item to true
on inventory click:
world of player is world {@world}
if {game::status} is "playing":
if index of clicked slot is 8:
cancel event
stop
if clicked slot is a nether star:
if name of clicked slot is "&6&lMap Vote":
openCaptureVotingMenu(player)
cancel event
GameManager_Is_Staff(player) is false
cancel event
on damage of player:
world of victim is world {@world}
if {game::status} is not "playing":
cancel event
if damage cause was void:
teleport victim to {capture::lobby}
stop
if damage cause was void:
kill victim
stop
attacker is a player
captureGetTeam(attacker) is captureGetTeam(victim)
cancel event
function getConnectedBlocks(itemtype: itemtype, location: location, blocks: blocks) :: blocks:
loop blocks in radius 2.1 around {_location}:
loop-block is {_itemtype}
if {_blocks::*} is not empty:
if {_blocks::*} contains loop-block:
continue
add loop-block to {_blocks::*}
return getConnectedBlocks({_itemtype}, loop-block, {_blocks::*})
return {_blocks::*}
on weather change to raining or thunder:
event-world is world {@world}
cancel event
command /capture [<text>] [<text>] [<text>]:
aliases: /cap, /ctp, /capturethepoint
trigger:
if {game::status} is "playing":
argument 1 is not "end", "a" or "admin"
message "{@prefix}&cA game is currently being played. Only &l/cap end &ccommand is allowed."
stop
if GameManager_Is_Staff(player) is false:
message "{@prefix}&cYou don't have permission to do that."
stop
if GameManager_Get_Game_Key() is not "capture":
message "{@prefix}&cGame is not set to capture. Command disabled."
stop
if argument 1 is not set:
message " " and "[] = optional <> = required"
message "/cap setlobby &7- set lobby spawn to your current location, otherwise world spawn"
message "/cap lobby [player] &7- teleport yourself or a player to the game lobby"
message "/cap s/start &7- starts the game with random arena"
message "/cap cancel &7- cancel starting"
message "/cap e/end &7- force the game to end"
message "/cap startvote/vote &7- starts the game with arena voting phase"
message "/cap setarena <arena> &7- set the arena to play on."
message "/cap l/list &7- list all of the arenas"
message "/cap delete [arena/mapindex] &7- delete an arena"
message "/cap a/admin &7- admin/dev tools"
message "/cap setup &7- setup a new arena" and " "
else if argument 1 is "admin" or "a":
if argument 2 is "notutstart", "notutorialstart", "startskiptutorial" or "dev":
if {game::status} is "ending":
message "{@prefix}&cPrevious game is ending, please wait..."
stop
captureStart(false, false)
else if argument 2 is "s", "switchteam" or "switchteams":
set {_player} to player
if argument 3 is set:
if argument 3 parsed as player is not set:
message "{@prefix}&cNo player found with the name %argument 3%."
stop
set {_player} to argument 3 parsed as player
if {capture::temp::{@team1}::*} contains {_player}:
remove {_player} from {capture::temp::{@team1}::*}
add {_player} to {capture::temp::{@team2}::*}
message " ", "&c&lYou have been forced to switch teams", "<{@team2}>&lYour new team is {@team2}!" and " " to {_player}
else if {capture::temp::{@team2}::*} contains {_player}:
remove {_player} from {capture::temp::{@team2}::*}
add {_player} to {capture::temp::{@team1}::*}
message " ", "&c&lYou have been forced to switch teams", "<{@team1}>&lYour new team is {@team1}!" and " " to {_player}
else:
message "{@prefix}&c%{_player}% isn't on a team."
stop
captureResetPlayer({_player}, true)
play sound "ENTITY_VILLAGER_NO" at pitch 2 to {_player}
else if argument 2 is "speed":
if argument 3 is not set:
reset flying speed of player
message "{@prefix}reset flying speed"
else:
set flying speed of player to argument 3 parsed as number
message "{@prefix}set flying speed to %argument 3%"
else:
message "&c/cap a notutstart/dev/startskiptutorial &7- fast start"
message "&c/cap a switchteams/s [player] &7- force team switch"
message "&c/cap a speed [number] &7- Set your flying speed, or no arg for reset" and " "
else if argument 1 is "s" or "start":
if {game::status} is "ending":
message "{@prefix}&cPrevious game is ending, please wait..."
stop
captureStart()
else if argument 1 is "sv", "vote", "startvote" or "startandvote":
if {game::status} is "ending":
message "{@prefix}&cPrevious game is ending, please wait..."
stop
captureStart(true)
else if argument 1 is "e" or "end":
message "{@prefix}&6Ending current game..."
captureEndGame({capture::temp::arena})
else if argument 1 is "cancel":
GameManager_Set_Game_Status("waiting")
clear inventory of {lobby::players::*}
set gamemode of {lobby::players::*} to survival
teleport {lobby::players::*} to {capture::lobby}
message "{@prefix}&cThe game has been stopped." to {lobby::players::*}
else if argument 1 is "setarena":
if argument 2 is not set:
message "{@prefix}&cYou need to state an arena to set the game to."
execute player command "/cap"
stop
loop indices of {capture::arenas::*}:
if loop-value is argument 2:
set {capture::temp::arena} to loop-value
message "{@prefix}&cSet the arena to &l%loop-value%&c."
stop
message "{@prefix}&cThere was no arena with the name &l%argument 2%&c."
else if argument 1 is "l" or "list":
message "{@prefix}&aAll current arenas:"
loop indices of {capture::arenas::*}:
add 1 to {_index}
message "%{_index}% - %{capture::arenas::%loop-value%::name}%"
else if argument 1 is "setlobby":
set {capture::lobby} to player's location
message "{@prefix}You set the current lobby location to %{capture::lobby}%"
else if argument 1 is "lobby":
if argument 2 is not set:
teleport player to {capture::lobby}
else:
teleport argument 2 parsed as player to {capture::lobby}
message "{@prefix}You teleported %argument 2% to the game lobby."
message "{@prefix}You've been teleported game lobby." to argument 2 parsed as player
else if argument 1 is "delete":
if argument 2 is not set:
message "{@prefix}&cNo arena name was provided to delete."
execute player command "/capture"
stop
set {_find} to argument 2 parsed as number
if {_find} is set:
loop indices of {capture::arenas::*}:
add 1 to {_index}
if {_index} is {_find}:
delete {capture::arenas::%loop-value%::*}
# Because Skript is scuffed
delete {capture::arenas::%loop-value%::spectatorspawn}
message "{@prefix}Deleted arena %loop-value%"
stop
message "{@prefix}&cThe indices are between 1 and %size of indices of {capture::arenas::*}% not %{_index}%"
execute player command "/cap"
stop
if indices of {capture::arenas::*} doesn't contain argument 2:
message "{@prefix}&cThere was no arena with the name &l%argument 2%"
stop
delete {capture::arenas::%argument 2%::*}
message "{@prefix}Deleted arena %argument 2%"
else if argument 1 is "condspawn", "conditionalspawn" or "cspawn":
if argument 2 is not set:
message "{@prefix}&cYou need to specify a team for the conditional spawn zone. /cap setup condspawn <{@team1}/{@team2}> <capturePointName>"