options: C: &7 H: &a Error: &c[Error]&6 BroadcastScatters: true #Broadcast each time someone gets scattered? LoadChunks: true #Teleport the command sender to each chunk before scattering MaxTries: 1001 #How many times do you want to try to scatter before stopping? ChunkLoadTicks: 20 #How long to wait in between loading each chunk (ticks) ScatterTicks: 2 #How long inbetween teleporting each player to their scatter location DontLoadUnder: -1 #Set to a number if you dont want to load chunks UNDER this amount of players -1 or 0 for none Sounds: true ScatterSound: note.pling SoundVolume: 0.3 SoundPitch: 0.5 function barSquare(l: object): set {_l} to the location 2 below {_l} set block at {_l} to a barrier set (block at (the location 1 right {_l})) to a barrier set (block at (the location 1 left {_l})) to a barrier set (block at (the location 1 in front {_l})) to a barrier set (block at (the location 1 behind {_l})) to a barrier set (block at (the location 1 right and 1 above {_l})) to a barrier set (block at (the location 1 left and 1 above {_l})) to a barrier set (block at (the location 1 in front and 1 above {_l})) to a barrier set (block at (the location 1 behind and 1 above {_l})) to a barrier loop blocks in radius 2 around {_l}: loop-block is a barrier add loop-block to {barriersremove::*} command /sca [] [] []: aliases: /scatterall, /scatter permission: scatter.scatter trigger: if arg-1 is not set: send "{@Error} /sca [-load]" stop trigger else if arg-2 is not set: send "{@Error} /sca [-load]" stop trigger #------------------------- # Solos #------------------------- if arg-2 is "*" or "**" or "all" or "s" or "solo" or "solos": if size of {spec::*} is 0: if arg-3 is "-load": set {_fail} to false {_fail} is not set send "&7Scatter failed. No spectators to load chunks found. Use -load in the scatter to override this." to all ops stop trigger set {_ToScatter::*} to (all players) loop all players: {spec::%loop-player%} is true remove loop-player from {_ToScatter::*} set {_Size} to (size of {_ToScatter::*}) set {_Mindist} to (arg-1/{_Size})*3.5 hide all players from all players broadcast "{@C}Scattering {@H}%{_Size}%{@C} players with radius {@H}%arg-1%{@C} and mindist {@H}%{_Mindist}%" loop ({_Size}) times: loop {@MaxTries} times: if (loop-number-2) is {@MaxTries}: broadcast "{@C}Couldn't find locations for {@H}%({_Size})-(loop-number-1)%&0/{@H}%{_Size}%{@C} players!" stop trigger set {_Location.Good} to true set {_Location.Good} to true set {_XR} to random integer between {midx} + arg-1 and {midx} - arg-1 set {_YR} to 250 set {_ZR} to random integer between {midz} + arg-1 and {midz} - arg-1 evaluate "set {_Location.Sky} to location at {_XR}, {_YR}, {_ZR} of the world ""uhc""" loop ((loop-number-1)-1) times: (distance between {_Location.Sky} and {_GoodLocation.Sky::%loop-number-3%}) is less than ({_Mindist}) delete {_Location.Good} if {_Location.Good} is true: set {_GoodLocation.Sky::%loop-number-1%} to ({_Location.Sky}) stop loop set {Scatter.DontUnloadChunks} to true if {@LoadChunks} is true: ({_Size}) is more than {@DontLoadUnder} set {_ExpectedTime} to ({_Size})*({@ChunkLoadTicks}/20) broadcast "{@C}Locations found, loading chunks!" broadcast "{@C}Loading chunks should take {@H}~%{_ExpectedTime}/size of {spec::*}%{@C} seconds." set {_LeftToLoad} to {_Size} while {_LeftToLoad} is greater than 0: loop {spec::*}: teleport ("%loop-index%" parsed as player) to location at {_GoodLocation.Sky::%{_LeftToLoad}%} remove 1 from {_LeftToLoad} wait {@ChunkLoadTicks} ticks wait "%(size of {spec::*} - 1)*7% ticks" parsed as timespan broadcast "{@H}Locations loaded. {@C}Now scattering." loop {ToScatter::*}: set {Scatter.Scattering::%loop-value%} to true wait 1 second set {_time} to now set {_Scattered} to 0 loop {_ToScatter::*}: set {_Player} to "%loop-value%" parsed as offlineplayer add 1 to {_Scattered} if {_Player} is not online: broadcast " &7- {@H}%loop-value% &c-{@C} Scheduled Scatter" set {SchedueldScatter::%loop-value%} to location 1 above ({_GoodLocation.Sky::%{_Scattered}%}) else: teleport (loop-value) to location 1 above ({_GoodLocation.Sky::%{_Scattered}%}) barSquare({_GoodLocation.Sky::%{_Scattered}%}) if {@BroadcastScatters} is true: broadcast " &7- {@H}%loop-value%{@C} scattered." command "/scattersound" wait {@ScatterTicks} ticks broadcast "{@C}Scatter has now {@H}finished! &c({@C}took {@H}%difference between now and {_time}%&c)" delete {Scatter.Scattering::*} delete {Scatter.DontUnloadChunks} reveal all players to all players #------------------------- # Teams #------------------------- else if arg-2 is "teams" or "t" or "team": if size of {spec::*} is 0: if arg-3 is "-load": set {_fail} to false {_fail} is not set send "&7Scatter failed. No spectators to load chunks found. Use -load in the scatter to override this." to all ops stop trigger set {_Count} to 0 loop {Teams::*}: team loop-value is set increase {_Count} by 1 set {_TeamScatter.%{_Count}%::*} to (team loop-value) loop all players: {Teams.InTeam::%loop-player%} is not set {spec::%loop-player%} is not set set {_Solos::%loop-player%} to loop-player set {_Size} to ({_Count}+(size of {_Solos::*})) set {_Mindist} to (arg-1/{_Size})*3.5 hide all players from all players broadcast "{@C}Scattering {@H}%{_Count}%{@C} teams and {@H}%size of {_Solos::*}%{@C} solos with {@H}%{_Mindist}%{@C} mindist!" loop ({_Size}) times: loop {@MaxTries} times: if (loop-number-2) is {@MaxTries}: broadcast "{@C}Couldn't find locations for {@H}%({_Size})-(loop-number-1)%&0/{@H}%{_Size}%{@C} teams/solos!" stop trigger set {_Location.Good} to true set {_Location.Good} to true set {_XR} to random integer between {midx} + arg-1 and {midx} - arg-1 set {_YR} to 250 set {_ZR} to random integer between {midz} + arg-1 and {midz} - arg-1 evaluate "set {_Location.Sky} to location at {_XR}, {_YR}, {_ZR} of the world ""uhc""" loop ((loop-number-1)-1) times: (distance between {_Location.Sky} and {_GoodLocation.Sky::%loop-number-3%}) is less than ({_Mindist}) delete {_Location.Good} if {_Location.Good} is true: set {_GoodLocation.Sky::%loop-number-1%} to ({_Location.Sky}) stop loop set {Scatter.DontUnloadChunks} to true if {@LoadChunks} is true: ({_Size}) is more than {@DontLoadUnder} set {_ExpectedTime} to ({_Size})*({@ChunkLoadTicks}/20) broadcast "{@C}Locations found, starting to load chunks!" broadcast "{@C}Loading chunks should take {@H}~%{_ExpectedTime}/size of {spec::*}%{@C} seconds." set {_LeftToLoad} to {_Size} while {_LeftToLoad} is greater than 0: loop {spec::*}: teleport ("%loop-index%" parsed as player) to location at {_GoodLocation.Sky::%{_LeftToLoad}%} remove 1 from {_LeftToLoad} wait {@ChunkLoadTicks} ticks wait "%(size of {spec::*} - 1)*7% ticks" parsed as timespan broadcast "{@H}Locations loaded. {@C}Now scattering." loop all players: set {Scatter.Scattering::%loop-player%} to true wait 1 second set {_TeamSize} to (size of {_Scatter.Teams::*}) set {_SoloSize} to (size of {_Solos::*}) set {_PositionCount} to 0 set {_TeamCount} to 0 set {_SoloCount} to 0 set {_time} to now loop {_Count} times: increase {_PositionCount} by 1 increase {_TeamCount} by 1 if {@BroadcastScatters} is true: broadcast "{@C}Scattering Team {@H}%{_TeamCount}%{@C}:" loop {_TeamScatter.%{_TeamCount}%::*}: set {_Player} to ("%loop-value-2%" parsed as offlineplayer) if {_Player} is not online: broadcast " &7- {@H}%{_Player}% &c-{@C} Scheduled Scatter." set {SchedueldScatter::%{_Player}%} to location 1 above ({_GoodLocation.Sky::%{_PositionCount}%}) command "/scattersound" wait {@ScatterTicks} ticks else: teleport {_Player} to location 1 above ({_GoodLocation.Sky::%{_PositionCount}%}) barSquare({_GoodLocation.Sky::%{_PositionCount}%}) if {@BroadcastScatters} is true: broadcast " &7- {@H}%{_Player}%{@C} scattered." command "/scattersound" wait {@ScatterTicks} ticks loop {_Solos::*}: increase {_PositionCount} by 1 increase {_SoloCount} by 1 if loop-value is not online: broadcast " &7- {@H}%loop-value% &c-{@C} Scheduled Scatter. &a&l(SOLO)" set {SchedueldScatter::%loop-value%} to location 1 above ({_GoodLocation.Sky::%{_PositionCount}%}) command "/scattersound" else: teleport loop-value to location 1 above ({_GoodLocation.Sky::%{_PositionCount}%}) barSquare({_GoodLocation.Sky::%{_PositionCount}%}) if {@BroadcastScatters} is true: broadcast " &7- {@H}%loop-value%{@C} scattered. &a&l(SOLO)" command "/scattersound" wait {@ScatterTicks} ticks broadcast "{@C}Scatter has now {@H}finished! &c({@C}took {@H}%difference between now and {_time}%&c)" delete {Scatter.Scattering::*} delete {Scatter.DontUnloadChunks} reveal all players to all players #------------------------- # Soul Brothers #------------------------- else if arg-2 is "soul" or "brothers" or "soulbrothers" or "sb": if size of {spec::*} is 0: if arg-3 is "-load": set {_fail} to false {_fail} is not set send "&7Scatter failed. No spectators to load chunks found. Use -load in the scatter to override this." to all ops stop trigger set {_Count} to 0 loop {Teams::*}: team loop-value is set increase {_Count} by 1 set {_TeamScatter.%{_Count}%::*} to (team loop-value) loop all players: {Teams.InTeam::%loop-player%} is not set {spec::%loop-player%} is not set set {_Solos::%loop-player%} to loop-player hide all players to all players set {_Size} to ({_Count}+(size of {_Solos::*})) set {_Mindist} to (arg-1/{_Size})*3.5 broadcast "{@C}Scattering {@H}%{_Count}%{@C} teams and {@H}%size of {_Solos::*}%{@C} solos with {@H}%{_Mindist}%{@C} mindist!" loop ({_Size}) times: loop {@MaxTries} times: if (loop-number-2) is {@MaxTries}: broadcast "{@C}Couldn't find locations for {@H}%({_Size})-(loop-number-1)%&0/{@H}%{_Size}%{@C} teams/solos!" stop trigger set {_Location.Good} to true set {_Location.Good} to true set {_XR} to random integer between 0 + arg-1 and 0 - arg-1 set {_YR} to 250 set {_ZR} to random integer between 0 + arg-1 and 0 - arg-1 evaluate "set {_Location.Sky} to location at {_XR}, {_YR}, {_ZR} of the world ""uhc3""" loop ((loop-number-1)-1) times: (distance between {_Location.Sky} and {_GoodLocation.Sky::%loop-number-3%}) is less than ({_Mindist}) delete {_Location.Good} if {_Location.Good} is true: set {_GoodLocation.Sky::%loop-number-1%} to ({_Location.Sky}) stop loop set {Scatter.DontUnloadChunks} to true if {@LoadChunks} is true: ({_Size}) is more than {@DontLoadUnder} set {_ExpectedTime} to ({_Size})*({@ChunkLoadTicks}/20) broadcast "{@C}Locations found, starting to load chunks!" broadcast "{@C}Loading chunks should take {@H}~%{_ExpectedTime}/size of {spec::*}%{@C} seconds." set {_LeftToLoad} to {_Size} while {_LeftToLoad} is greater than 0: loop {spec::*}: teleport ("%loop-index%" parsed as player) to location at {_GoodLocation.Sky::%{_LeftToLoad}%} remove 1 from {_LeftToLoad} wait {@ChunkLoadTicks} ticks wait "%(size of {spec::*} - 1)*7% ticks" parsed as timespan broadcast "{@H}Locations loaded. {@C}Now scattering." loop all players: set {Scatter.Scattering::%loop-player%} to true wait 1 second set {_TeamSize} to (size of {_Scatter.Teams::*}) set {_SoloSize} to (size of {_Solos::*}) set {_PositionCount} to 0 set {_TeamCount} to 0 set {_SoloCount} to 0 set {_time} to now loop {_Count} times: increase {_PositionCount} by 1 increase {_TeamCount} by 1 if {@BroadcastScatters} is true: broadcast "{@C}Scattering Team {@H}%{_TeamCount}%{@C}:" loop {_TeamScatter.%{_TeamCount}%::*}: set {_Player} to ("%loop-value-2%" parsed as offlineplayer) add 1 to {_Team::%{_TeamCount}%} if {_Team::%{_TeamCount}%} is 1: if {_Player} is not online: broadcast " &7- {@H}%{_Player}% &c-{@C} Scheduled Scatter." set {SchedueldScatter::%{_Player}%} to location 1 above ({_GoodLocation.Sky::%{_PositionCount}%}) barSquare(({_GoodLocation.Sky::%{_PositionCount}%})) command "/scattersound" wait {@ScatterTicks} ticks else: teleport {_Player} to location 1 above ({_GoodLocation.Sky::%{_PositionCount}%}) barSquare({_GoodLocation.Sky::%{_PositionCount}%}) if {@BroadcastScatters} is true: broadcast " &7- {@H}%{_Player}%{@C} scattered." command "/scattersound" wait {@ScatterTicks} ticks else: set {_x} to x-coordinate of {_GoodLocation.Sky::%{_PositionCount}%} set {_y} to y-coordinate of {_GoodLocation.Sky::%{_PositionCount}%} + 1 set {_z} to z-coordinate of {_GoodLocation.Sky::%{_PositionCount}%} evaluate "set {_loc} to location at {_x}, {_y}, {_z} of the world ""uhc2""" if {_Player} is not online: broadcast " &7- {@H}%{_Player}% &c-{@C} Scheduled Scatter." set {SchedueldScatter::%{_Player}%} to {_loc} barSquare(location 1 below {_loc}) command "/scattersound" wait {@ScatterTicks} ticks else: teleport {_Player} to {_loc} barSquare(location 1 below {_loc}) if {@BroadcastScatters} is true: broadcast " &7- {@H}%{_Player}%{@C} scattered." command "/scattersound" wait {@ScatterTicks} ticks loop {_Solos::*}: increase {_PositionCount} by 1 increase {_SoloCount} by 1 if loop-value is not online: broadcast " &7- {@H}%loop-value% &c-{@C} Scheduled Scatter. &a&l(SOLO)" set {SchedueldScatter::%loop-value%} to location 1 above ({_GoodLocation.Sky::%{_PositionCount}%}) command "/scattersound" else: teleport loop-value to location 1 above ({_GoodLocation.Sky::%{_PositionCount}%}) barSquare({_GoodLocation.Sky::%{_PositionCount}%}) if {@BroadcastScatters} is true: broadcast " &7- {@H}%loop-value%{@C} scattered. &a&l(SOLO)" command "/scattersound" wait {@ScatterTicks} ticks broadcast "{@C}Scatter has now {@H}finished! &c({@C}took {@H}%difference between now and {_time}%&c)" delete {Scatter.Scattering::*} delete {Scatter.DontUnloadChunks} reveal all players to all players else if arg-2 is "soul2" or "brothers2" or "soulbrothers2" or "sb2": if size of {spec::*} is 0: if arg-3 is "-load": set {_fail} to false {_fail} is not set send "&7Scatter failed. No spectators to load chunks found. Use -load in the scatter to override this." to all ops stop trigger set {_Count} to 0 loop {Teams::*}: team loop-value is set increase {_Count} by 1 set {_TeamScatter.%{_Count}%::*} to (team loop-value) loop all players: {Teams.InTeam::%loop-player%} is not set {spec::%loop-player%} is not set set {_Solos::%loop-player%} to loop-player hide all players from all players set {_Size} to ({_Count}+(size of {_Solos::*})) set {_Mindist} to (arg-1/{_Size})*3.5 broadcast "{@C}Scattering {@H}%{_Count}%{@C} teams and {@H}%size of {_Solos::*}%{@C} solos with {@H}%{_Mindist}%{@C} mindist!" loop ({_Size}) times: loop {@MaxTries} times: if (loop-number-2) is {@MaxTries}: broadcast "{@C}Couldn't find locations for {@H}%({_Size})-(loop-number-1)%&0/{@H}%{_Size}%{@C} teams/solos!" stop trigger set {_Location.Good} to true set {_Location.Good} to true set {_XR} to random integer between {midx} + arg-1 and {midx} - arg-1 set {_YR} to 250 set {_ZR} to random integer between {midz} + arg-1 and {midz} - arg-1 evaluate "set {_Location.Sky} to location at {_XR}, {_YR}, {_ZR} of the world ""uhc""" loop ((loop-number-1)-1) times: (distance between {_Location.Sky} and {_GoodLocation.Sky::%loop-number-3%}) is less than ({_Mindist}) delete {_Location.Good} if {_Location.Good} is true: set {_GoodLocation.Sky::%loop-number-1%} to ({_Location.Sky}) stop loop set {Scatter.DontUnloadChunks} to true if {@LoadChunks} is true: ({_Size}) is more than {@DontLoadUnder} set {_ExpectedTime} to ({_Size})*({@ChunkLoadTicks}/20) broadcast "{@C}Locations found, starting to load chunks!" broadcast "{@C}Loading chunks should take {@H}~%{_ExpectedTime}/size of {spec::*}%{@C} seconds." set {_LeftToLoad} to {_Size} while {_LeftToLoad} is greater than 0: loop {spec::*}: teleport ("%loop-index%" parsed as player) to location at {_GoodLocation.Sky::%{_LeftToLoad}%} remove 1 from {_LeftToLoad} wait {@ChunkLoadTicks} ticks wait "%(size of {spec::*} - 1)*7% ticks" parsed as timespan broadcast "{@H}Locations loaded. {@C}Now scattering." loop all players: set {Scatter.Scattering::%loop-player%} to true wait 1 second set {_TeamSize} to (size of {_Scatter.Teams::*}) set {_SoloSize} to (size of {_Solos::*}) set {_PositionCount} to 0 set {_TeamCount} to 0 set {_SoloCount} to 0 set {_time} to now loop {_Count} times: increase {_PositionCount} by 1 increase {_TeamCount} by 1 if {@BroadcastScatters} is true: broadcast "{@C}Scattering Team {@H}%{_TeamCount}%{@C}:" loop {_TeamScatter.%{_TeamCount}%::*}: set {_Player} to ("%loop-value-2%" parsed as offlineplayer) add 1 to {_Team::%{_TeamCount}%} set {nofall::%loop-value-2%} to true if {_Player} is not online: broadcast " &7- {@H}%{_Player}% &c-{@C} Scheduled Scatter." set {SchedueldScatter::%{_Player}%} to location 1 above ({_GoodLocation.Sky::%{_PositionCount}%}) else: teleport {_Player} to location 1 above ({_GoodLocation.Sky::%{_PositionCount}%}) if {@BroadcastScatters} is true: broadcast " &7- {@H}%{_Player}%{@C} scattered." command "/scattersound" wait {@ScatterTicks} ticks loop {_Solos::*}: increase {_PositionCount} by 1 increase {_SoloCount} by 1 set {nofall::%loop-value%} to true if loop-value is not online: broadcast " &7- {@H}%loop-value% &c-{@C} Scheduled Scatter. &a&l(SOLO)" set {SchedueldScatter::%loop-value%} to location 1 above ({_GoodLocation.Sky::%{_PositionCount}%}) command "/scattersound" else: teleport loop-value to location 1 above ({_GoodLocation.Sky::%{_PositionCount}%}) if {@BroadcastScatters} is true: broadcast " &7- {@H}%loop-value%{@C} scattered. &a&l(SOLO)" command "/scattersound" wait {@ScatterTicks} ticks broadcast "{@C}Scatter has now {@H}finished! &c({@C}took {@H}%difference between now and {_time}%&c)" delete {Scatter.Scattering::*} delete {Scatter.DontUnloadChunks} reveal all players to all players #------------------------- # 1 person #------------------------- else if ("%arg-2%" parsed as offlineplayer) is online: broadcast "{@C}Scattering {@H}%arg-2%{@C} with radius {@H}%arg-1%" loop {@MaxTries} times: if (loop-number-2) is {@MaxTries}: broadcast "{@C}Couldn't find a location for {@H}%arg-2%" stop trigger set {_Location.Good} to true set {_XR} to random integer between {midx} + arg-1 and {midx} - arg-1 set {_YR} to 250 set {_ZR} to random integer between {midz} + arg-1 and {midz} - arg-1 evaluate "set {_Location.Sky} to location at {_XR}, {_YR}, {_ZR} of the world ""uhc""" if {_Location.Good} is true: set {_GoodLocation.Sky} to ({_Location.Sky}) stop loop set {nodamage::%arg-2%} to true teleport ("%arg-2%" parsed as offlineplayer) to ({_GoodLocation.Sky}) if {@BroadcastScatters} is true: broadcast " &7- {@H}%arg-2%{@C} scattered." command "/scattersound" wait 30 seconds wait 30 seconds delete {nodamage::%arg-2%} else: send "{@Error} Couldnt get {@H}&0&l""{@C}%arg-2%&0&l""{@H}" send "{@Error} /sca [-load]" on skript load: delete {Scatter.DontUnloadChunks} delete {Scatter.Scattering::*} delete {nodamage::*} delete {nofall::*} command /scattersound: permission: scatter.sound trigger: {@Sounds} is true loop all players: command "/playsound {@ScatterSound} %loop-player% ~ ~ ~ {@SoundVolume} {@SoundPitch} {@SoundVolume}" on chat: {Scatter.Scattering::*} is set set {nochat::%player%} to true on damage of a player: if {nodamage::%victim%} is true: cancel the event if damage cause is fall: {nofall::%victim%} is true cancel the event delete {nofall::%victim%} on login: if {SchedueldScatter::%player%} is set: teleport (player) to ({SchedueldScatter::%player%}) set {nodamage::%player%} to true delete {SchedueldScatter::%player%} broadcast "{@H}%player%{@C} has been scheduled a late scatter!" command "/scattersound" wait 30 seconds delete {nodamage::%player%} else if {SafeFromDeath::%player%} is true: set {nodamage::%player%} to true wait 30 seconds delete {nodamage::%player%} on join: if {Scatter.Scattering::*} is set: hide player from all players else if {Scatter.DontUnloadChunks} is true: hide player from all players on quit: if {Scatter.Scattering::*} is set: set {SafeFromDeath::%player%} to true reveal player to all players else if {Scatter.DontUnloadChunks} is true: set {SafeFromDeath::%player%} to true reveal player to all players delete {Scatter.Scattering::%player%} on chunk unload: {Scatter.DontUnloadChunks} is true cancel the event on damage of a player: {Scatter.Scattering::%victim%} is true cancel the event