on load:
set {green.tp} to location at 30, 30, 30 in world "eggwars"
set {red.tp} to location at 10, 10, 10 in world "eggwars"
set {yellow.tp} to location at 20, 20, 20 in world "eggwars"
set {blue.tp} to location at 40, 40, 40 in world "eggwars"
set {game} to false
clear {green::*}
clear {yellow::*}
clear {red::*}
clear {blue::*}
clear {joined::*}
add {green.tp}, {red.tp}, {yellow.tp} and {blue.tp} to {locs::*}
command /join eggwars:
trigger:
if {joined::*} does not contain player:
if {game} is false:
teleport player to location(0, 0, 0, world "eggwars")
send "&aYou've joined the eggwars!" to player
add player to {joined::*}
if size of {joined::*} is more than 1:
loop 30 times:
if size of {joined::*} is more than 1:
broadcast "&aStart in %31 - loop-number%"
wait 1 second
else:
send "&cToo many players left during countdown!" to {joined::*}
stop
if size of {joined::*} is more than 1:
set {game} to true
if size of {joined::*} is 2:
loop 2 times:
set {_p} to random element out of {joined::*}
set {_l} to random element out of {locs::*}
teleport {_p} to {_l}
if location of {_p} is {red.tp}:
if size of {red::*} is 0:
add {_p} to {red::*}
else if size of {green::*} is 0:
add {_p} to {green::*}
else if size of {yellow::*} is 0:
add {_p} to {yellow::*}
else if size of {blue::*} is 0:
add {_p} to {blue::*}
else if location of {_p} is {green.tp}:
if size of {green::*} is 0:
add {_p} to {green::*}
else if size of {red::*} is 0:
add {_p} to {red::*}
else if size of {yellow::*} is 0:
add {_p} to {yellow::*}
else if size of {blue::*} is 0:
add {_p} to {blue::*}
else if location of {_p} is {yellow.tp}:
if size of {yellow::*} is 0:
add {_p} to {yellow::*}
else if size of {red::*} is 0:
add {_p} to {red::*}
else if size of {green::*} is 0:
add {_p} to {green::*}
else if size of {blue::*} is 0:
add {_p} to {blue::*}
else if location of {_p} is {blue.tp}:
if size of {blue::*} is 0:
add {_p} to {blue::*}
else if size of {red::*} is 0:
add {_p} to {red::*}
else if size of {yellow::*} is 0:
add {_p} to {yellow::*}
else if size of {green::*} is 0:
add {_p} to {green::*}
remove {_p} from {joined::*}
set block at location 0, -10, 0 in world "eggwars" to dragon egg
else if size of {joined::*} is 3:
loop 3 times:
set {_p} to random element out of {joined::*}
set {_l} to random element out of {locs::*}
teleport {_p} to {_l}
if location of {_p} is {red.tp}:
if size of {red::*} is 0:
add {_p} to {red::*}
else if size of {green::*} is 0:
add {_p} to {green::*}
else if size of {yellow::*} is 0:
add {_p} to {yellow::*}
else if size of {blue::*} is 0:
add {_p} to {blue::*}
else if location of {_p} is {green.tp}:
if size of {green::*} is 0:
add {_p} to {green::*}
else if size of {red::*} is 0:
add {_p} to {red::*}
else if size of {yellow::*} is 0:
add {_p} to {yellow::*}
else if size of {blue::*} is 0:
add {_p} to {blue::*}
else if location of {_p} is {yellow.tp}:
if size of {yellow::*} is 0:
add {_p} to {yellow::*}
else if size of {red::*} is 0:
add {_p} to {red::*}
else if size of {green::*} is 0:
add {_p} to {green::*}
else if size of {blue::*} is 0:
add {_p} to {blue::*}
else if location of {_p} is {blue.tp}:
if size of {blue::*} is 0:
add {_p} to {blue::*}
else if size of {red::*} is 0:
add {_p} to {red::*}
else if size of {yellow::*} is 0:
add {_p} to {yellow::*}
else if size of {green::*} is 0:
add {_p} to {green::*}
remove {_p} from {joined::*}
set block at location 0, -10, 0 in world "eggwars" to dragon egg
else if size of {joined::*} is more than 3:
loop 100 times:
set {_p} to random element out of {joined::*}
set {_l} to random element out of {locs::*}
teleport {_p} to {_l}
if location of {_p} is {red.tp}:
add {_p} to {red::*}
else if location of {_p} is {green.tp}:
add {_p} to {green::*}
else if location of {_p} is {yellow.tp}:
add {_p} to {yellow::*}
else if location of {_p} is {blue.tp}:
add {_p} to {blue::*}
remove {_p} from {joined::*}
set block at location 0, -10, 0 in world "eggwars" to dragon egg
on quit:
if {joined::*} contains player:
remove player from {joined::*}