Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Scatter Skript by Fleft. This is an advanced Skript. Use at your own risk. I am not responsible for any damage caused to servers because of this Skript.
- # To disable/enable and of these features below, change them to simply "true" or "false".
- # This was meant to be used in UHC games on www.reddit.com/r/ultrahardcore.
- # Version: v1.3
- options:
- #--------------------------------------------------
- # Options
- #--------------------------------------------------
- Prefix: &8[&Scatter&8]&7
- # Prefix for scatter messages
- ScatterSound: note.bass
- # Sound when person is scattered
- ScatterPitch: 2
- # Pitch when person is scattered
- HC: &3
- # Chat color when there's **x** seconds, **player**, misc
- CC: &7
- # Main chat color
- DisableChat: true
- # Disables chat while people are being scattered
- Tries: 901
- # Limit to how many times the Skript will attempt to load a given location
- ChunkLoadTicks: 7
- # Time in between each chunk being loaded in ***TICKS***
- ScatterTicks: 1
- # Time in between each player being teleported in ***TICKS***
- BroadcastLoadedChunks: false
- # Broadcast when the command sender automatically loads each chunk
- BroadcastScatteredPlayers: true
- # Broadcast when each individual is scattered
- LoadGeneratedChunks: true
- # Load the generated chunks? Takes longer, but less lag. You absolutely should use this with 30+ players.
- #--------------------------------------------------
- # Command
- #--------------------------------------------------
- command /fleftscatter [<world>] [<integer>] [<text>]:
- aliases: /fleftscatter, /fscatter, /fsca, /sca
- permission: skript.fleftscatter
- trigger:
- #--------------------------------------------------
- # Arguments
- #--------------------------------------------------
- if arg-1 is not set:
- message "{@Prefix}{@CC} /sca <world> <radius> <*/teams/player>"
- command "/playsound random.break %command sender% ~ ~ ~ 1 1 1"
- stop trigger
- else if arg-2 is not set:
- message "{@Prefix}{@CC} /sca <world> <radius> <*/teams/player>"
- command "/playsound random.break %command sender% ~ ~ ~ 1 1 1"
- stop trigger
- else if arg-3 is not set:
- message "{@Prefix}{@CC} /sca <world> <radius> <*/teams/player>"
- command "/playsound random.break %command sender% ~ ~ ~ 1 1 1"
- stop trigger
- #--------------------------------------------------
- # FFA Scatter
- #--------------------------------------------------
- if arg-3 is "all" or "*":
- set {_Scatter.ListOfAllPlayers::*} to all players
- set {_Scatter.AmountOfPlayers} to (size of {_Scatter.ListOfAllPlayers::*})
- if (size of ({_Scatter.ListOfAllPlayers::*})) is equal to 0:
- message "{@Prefix}{@CC} No one can be scattered!"
- stop trigger
- set {Scatter.DisableChunkUnload} to true
- set {Scatter.DisableChat} to true
- set {_Scatter.world} to arg-1
- set {_Scatter.radius} to arg-2
- set {_Scatter.mindist} to (({_Scatter.radius}/{_Scatter.AmountOfPlayers})*3.5)
- broadcast "{@Prefix}{@CC} Attempting to scatter {@HC}%{_Scatter.AmountOfPlayers}%{@CC} players!"
- loop {_Scatter.AmountOfPlayers} times:
- loop {@Tries} times:
- if loop-number-2 is equal to {@Tries}:
- broadcast "{@Prefix}{@CC} Could not scatter %loop-number-1%/%{_Scatter.AmountOfPlayers}%"
- broadcast "{@Prefix}{@CC} Some players may have been scattered!"
- broadcast "{@Prefix}{@CC} You may want to /tpall!"
- command "/fleftscattersound random.break 1"
- stop trigger
- set {_Scatter.Location.Good} to true
- set {_Scatter.SkyLocation} to (the location at ((random integer between (0-{_Scatter.radius}) and ({_Scatter.radius}-1))+0.5), 255, ((random integer between (0-{_Scatter.radius}) and ({_Scatter.radius}-1))+0.5) of the world {_Scatter.world})
- loop ((loop-number-1)-1) times:
- if {_Scatter.Location.Good} is true:
- distance between {_Scatter.SkyLocation} and {_Scatter.FinalLocations.Sky::%loop-number-3%} is less than {_Scatter.mindist}:
- delete {_Scatter.Location.Good}
- if {_Scatter.Location.Good} is true:
- set {_Scatter.GroundLocation} to {_Scatter.SkyLocation}
- while (block at {_Scatter.GroundLocation}) is air:
- if y-coordinate of {_Scatter.GroundLocation} is less than 5:
- delete {_Scatter.Location.Good}
- stop loop
- set {_Scatter.GroundLocation} to location 1 below {_Scatter.GroundLocation}
- if {_Scatter.Location.Good} is true:
- if (block at {_Scatter.GroundLocation}) is cactus, water, or lava:
- delete {_Scatter.Location.Good}
- if {_Scatter.Location.Good} is true:
- set {_Scatter.GroundLocation} to (location 1 above {_Scatter.GroundLocation})
- add 1 to {_Scatter.GeneratedLocations}
- add 1 to {_Scatter.GenerationTime}
- add {_Scatter.SkyLocation} to {_Scatter.FinalLocations.Sky::*}
- add {_Scatter.GroundLocation} to {_Scatter.FinalLocations.Ground::*}
- add {_Scatter.GroundLocation} to {_Scatter.ChunkLoading::*}
- wait 1 tick
- stop loop
- broadcast "{@Prefix}{@CC} All locations found!"
- broadcast ""
- if {@LoadGeneratedChunks} is true:
- broadcast "{@Prefix}{@CC} Loading chunks at each location!"
- loop {_Scatter.AmountOfPlayers} times:
- command sender is not online:
- broadcast "{@Prefix}{@CC} Scatter failed, command sender logged out."
- loop all players:
- execute console command "/playsound random.break %loop-player % ~ ~ ~ 1 1 1"
- stop trigger
- else:
- add 1 to {_Scatter.LoadedChunks}
- set {_Scatter.ChunkLoaderLocation} to a random element out of {_Scatter.ChunkLoading::*}
- remove {_Scatter.ChunkLoaderLocation} from {_Scatter.ChunkLoading::*}
- teleport (command sender) to {_Scatter.ChunkLoaderLocation}
- if {@BroadcastLoadedChunks} is true:
- broadcast "{@Prefix}{@CC} Loaded {@HC}%{_Scatter.LoadedChunks}%{@CC}/{@HC}%{_Scatter.AmountOfPlayers}%"
- wait {@ChunkLoadTicks} ticks
- broadcast "{@Prefix}{@CC} Loading of chunks completed!"
- broadcast ""
- wait 1 second
- loop {_Scatter.ListOfAllPlayers::*}:
- add 1 to {_Scatter.Scattered}
- add 1 to {_Scatter.ScatteredTime}
- set {_Scatter.FFAPlayer} to loop-value
- remove {_Scatter.FFAPlayer} from {_Scatter.ListOfAllPlayers::*}
- set {_Scatter.FinalLocation} to a random element out of {_Scatter.FinalLocations.Ground::*}
- remove {_Scatter.FinalLocation} from {_Scatter.FinalLocations.Ground::*}
- execute console command "/fleftscattersound {@ScatterSound} {@ScatterPitch}"
- if {_Scatter.FFAPlayer} is not online:
- set {Scatter.schedule::%{_Scatter.FFAPlayer}%} to {_Scatter.FinalLocation}
- broadcast "{@Prefix}{@CC} %{_Scatter.FFAPlayer}% - Scheduled Scatter"
- else:
- if {@BroadcastScatteredPlayers} is true:
- broadcast "{@Prefix}{@CC} - {@HC}%{_Scatter.Scattered}%{@CC}/{@HC}%{_Scatter.AmountOfPlayers}% - &7 %{_Scatter.FFAPlayer}%"
- teleport {_Scatter.FFAPlayer} to {_Scatter.FinalLocation}
- wait {@ScatterTicks} tick
- broadcast ""
- broadcast "{@Prefix}{@CC} All players scattered!"
- broadcast "{@Prefix}{@CC} Lowest mindist: {@HC}~%{_Scatter.mindist}%{@CC} with radius {@HC}%{_Scatter.radius}%!"
- delete {Scatter.DisableChunkUnload}
- delete {Scatter.DisableChat}
- loop 7 times:
- command "/aps fireworks.largeBlast_far 0.5"
- wait 3 ticks
- #--------------------------------------------------
- # Team + Solo Scatter
- #--------------------------------------------------
- else if arg-3 is "team" or "teams":
- set {_Scatter.TeamCount} to 0
- loop {Teams::*}:
- {Team.%loop-value%::*} is set:
- increase {_Scatter.TeamCount} by 1
- add {_Scatter.TeamCount} to {_Scatter.Teams::*}
- set {_Scatter.Team.%{_Scatter.TeamCount}%::*} to {Team.%loop-value%::*}
- set {_Scatter.MainPlayer} to a random element out of {Team.%loop-value%::*}
- set {_Scatter.MainPlayer} to {_Scatter.MainPlayer} parsed as offlineplayer
- add {_Scatter.MainPlayer} to {_Scatter.ListOfAllPlayers::*}
- loop all players:
- {Teams.InTeam::%loop-player%} is not set:
- add (name of loop-player) to {_Scatter.Solos::*}
- add (name of loop-player) to {_Scatter.ListOfAllPlayers::*}
- set {_Scatter.AmountOfPlayers} to ((size of {_Scatter.Teams::*})+(size of {_Scatter.Solos::*}))
- if (size of ({_Scatter.ListOfAllPlayers::*})) is equal to 0:
- message "{@Prefix}{@CC} No one can be scattered!"
- stop trigger
- set {Scatter.DisableChunkUnload} to true
- set {Scatter.DisableChat} to true
- set {_Scatter.world} to arg-1
- set {_Scatter.radius} to arg-2
- set {_Scatter.mindist} to (({_Scatter.radius}/{_Scatter.AmountOfPlayers})*5)
- broadcast "{@Prefix}{@CC} Attempting to scatter {@HC}%(size of ({_Scatter.Teams::*}))%{@CC} teams and {@HC}%(size of ({_Scatter.Solos::*}))%{@CC} solos!"
- loop {_Scatter.AmountOfPlayers} times:
- loop {@Tries} times:
- if loop-number-2 is equal to {@Tries}:
- broadcast "{@Prefix}{@CC} Could not scatter %loop-number-1%/%{_Scatter.AmountOfPlayers}%"
- broadcast "{@Prefix}{@CC} Some players may have been scattered!"
- broadcast "{@Prefix}{@CC} You may want to /tpall!"
- command "/fleftscattersound random.break 1"
- delete {Scatter.DisableChunkLoading}
- delete {Scatter.DisableChat}
- stop trigger
- set {_Scatter.Location.Good} to true
- set {_Scatter.SkyLocation} to (the location at ((random integer between (0-{_Scatter.radius}) and ({_Scatter.radius}-1))+0.5), 255, ((random integer between (0-{_Scatter.radius}) and ({_Scatter.radius}-1))+0.5) of the world {_Scatter.world})
- loop ((loop-number-1)-1) times:
- if {_Scatter.Location.Good} is true:
- distance between {_Scatter.SkyLocation} and {_Scatter.FinalLocations.Sky::%loop-number-3%} is less than {_Scatter.mindist}:
- delete {_Scatter.Location.Good}
- if {_Scatter.Location.Good} is true:
- set {_Scatter.GroundLocation} to {_Scatter.SkyLocation}
- while (block at {_Scatter.GroundLocation}) is air:
- if y-coordinate of {_Scatter.GroundLocation} is less than 5:
- delete {_Scatter.Location.Good}
- stop loop
- set {_Scatter.GroundLocation} to location 1 below {_Scatter.GroundLocation}
- if {_Scatter.Location.Good} is true:
- if (block at {_Scatter.GroundLocation}) is cactus, water, or lava:
- delete {_Scatter.Location.Good}
- if {_Scatter.Location.Good} is true:
- set {_Scatter.GroundLocation} to (location 1 above {_Scatter.GroundLocation})
- add 1 to {_Scatter.GeneratedLocations}
- add 1 to {_Scatter.GenerationTime}
- add {_Scatter.SkyLocation} to {_Scatter.FinalLocations.Sky::*}
- add {_Scatter.GroundLocation} to {_Scatter.FinalLocations.Ground::*}
- add {_Scatter.GroundLocation} to {_Scatter.ChunkLoading::*}
- wait 1 tick
- stop loop
- broadcast "{@Prefix}{@CC} All locations found!"
- broadcast ""
- broadcast "{@Prefix}{@CC} Loading chunks at each location!"
- loop {_Scatter.AmountOfPlayers} times:
- command sender is not online:
- broadcast "{@Prefix}{@CC} Scatter failed, command sender logged out."
- execute console command "/fleftscattersound random.break 1"
- stop trigger
- else:
- add 1 to {_Scatter.LoadedChunks}
- set {_Scatter.ChunkLoaderLocation} to a random element out of {_Scatter.ChunkLoading::*}
- remove {_Scatter.ChunkLoaderLocation} from {_Scatter.ChunkLoading::*}
- teleport (command sender) to {_Scatter.ChunkLoaderLocation}
- if {@BroadcastLoadedChunks} is true:
- broadcast "{@Prefix}{@CC} Loaded {@HC}%{_Scatter.LoadedChunks}%{@CC}/{@HC}%{_Scatter.AmountOfPlayers}%"
- wait {@ChunkLoadTicks} ticks
- broadcast "{@Prefix}{@CC} Loading of chunks completed!"
- broadcast ""
- wait 1 second
- loop {_Scatter.Teams::*}:
- broadcast "{@Prefix}{@CC} Scattering {@HC}Team %loop-value%{@CC}/{@HC}%(size of ({_Scatter.Teams::*}))%!"
- set {_Scatter.FinalLocation.Team} to a random element out of {_Scatter.FinalLocations.Ground::*}
- remove {_Scatter.FinalLocation.Team} from {_Scatter.FinalLocations.Ground::*}
- loop {Team.%loop-value%::*}:
- set {_Scatter.TeamPlayer} to loop-value-2 parsed as offlineplayer
- add 1 to {_Scatter.Scattered}
- add 1 to {_Scatter.ScatteredTime}
- if {_Scatter.TeamPlayer} is not online:
- set {Scatter.schedule::%{_Scatter.TeamPlayer}%} to {_Scatter.FinalLocation.Team}
- broadcast "{@Prefix}{@HC} - {@CC}%{_Scatter.TeamPlayer}%: Scheduled Scatter"
- else:
- if {@BroadcastScatteredPlayers} is true:
- broadcast "{@Prefix}{@HC} - {@CC}%{_Scatter.TeamPlayer}%"
- teleport {_Scatter.TeamPlayer} to {_Scatter.FinalLocation.Team}
- wait {@ScatterTicks} tick
- if {_Scatter.Solos::*} is set:
- broadcast ""
- broadcast "{@Prefix}{@CC} Scattering solos!"
- loop {_Scatter.Solos::*}:
- add 1 to {_Scatter.Scattered}
- add 1 to {_Scatter.ScatteredTime}
- set {_Scatter.FinalLocation.Solo} to a random element out of {_Scatter.FinalLocations.Ground::*}
- remove {_Scatter.FinalLocation.Solo} from {_Scatter.FinalLocations.Ground::*}
- set {_Scatter.NewSolo} to loop-value parsed as offlineplayer
- if {_Scatter.NewSolo} is not online:
- broadcast "{@Prefix}{@CC} Scheduled late scatter of {@HC}%{_Scatter.NewSolo}%!"
- set {Scatter.schedule::%{_Scatter.NewSolo}%} to {_Scatter.FinalLocation.Solo}
- else:
- teleport {_Scatter.NewSolo} to {_Scatter.FinalLocation.Solo}
- if {@BroadcastScatteredPlayers} is true:
- broadcast "{@Prefix}{@HC} SOLO: {@CC}%{_Scatter.NewSolo}%"
- wait {@ScatterTicks} tick
- broadcast ""
- broadcast "{@Prefix}{@CC} All teams scattered!"
- #broadcast "{@Prefix}{@CC} Lowest mindist: {@HC}~%{_Scatter.mindist}%{@CC} with radius {@HC}%{_Scatter.radius}%"
- delete {Scatter.DisableChunkUnload}
- delete {Scatter.DisableChat}
- loop 7 times:
- command "/fleftscattersound fireworks.largeBlast_far 0.5"
- wait 2 ticks
- #--------------------------------------------------
- # Single Player Scatter
- #--------------------------------------------------
- else:
- set {_Scatter.AllPlayers::*} to all players
- if {_Scatter.AllPlayers::*} does not contain arg-3:
- broadcast "{@Prefix}{@HC} %arg-3%{@CC} is not online!"
- command "/fleftscattersound random.break 1"
- stop trigger
- else:
- set {_Scatter.SinglePlayer} to arg-3 parsed as offlineplayer
- add {_Scatter.SinglePlayer} to {_Scatter.ListOfAllPlayers::*}
- set {_Scatter.AmountOfPlayers} to 1
- set {_Scatter.world} to arg-1
- set {_Scatter.radius} to arg-2
- broadcast "{@Prefix}{@CC} Attempting to scatter {@HC}%arg-3%!"
- loop {_Scatter.AmountOfPlayers} times:
- loop {@Tries} times:
- if loop-number-2 is equal to {@Tries}:
- broadcast "{@Prefix}{@CC} Could not scatter {@HC}%arg-3%{@CC}. Try again!"
- command "/fleftscattersound random.break 1"
- stop trigger
- set {_Scatter.Location.Good} to true
- set {_Scatter.SkyLocation} to (the location at ((random integer between (0-{_Scatter.radius}) and ({_Scatter.radius}-1))+0.5), 255, ((random integer between (0-{_Scatter.radius}) and ({_Scatter.radius}-1))+0.5) of the world {_Scatter.world})
- loop ((loop-number-1)-1) times:
- if {_Scatter.Location.Good} is true:
- distance between {_Scatter.SkyLocation} and {_Scatter.FinalLocations.Sky::%loop-number-3%} is less than {_Scatter.mindist}:
- delete {_Scatter.Location.Good}
- if {_Scatter.Location.Good} is true:
- set {_Scatter.GroundLocation} to {_Scatter.SkyLocation}
- while (block at {_Scatter.GroundLocation}) is air:
- if y-coordinate of {_Scatter.GroundLocation} is less than 5:
- delete {_Scatter.Location.Good}
- stop loop
- set {_Scatter.GroundLocation} to location 1 below {_Scatter.GroundLocation}
- if {_Scatter.Location.Good} is true:
- if (block at {_Scatter.GroundLocation}) is cactus, water, or lava:
- delete {_Scatter.Location.Good}
- if {_Scatter.Location.Good} is true:
- set {_Scatter.GroundLocation} to (location 1 above {_Scatter.GroundLocation})
- add 1 to {_Scatter.GeneratedLocations}
- add 1 to {_Scatter.GenerationTime}
- wait 1 tick
- stop loop
- broadcast "{@Prefix}{@CC} Location found!"
- broadcast ""
- wait 1 second
- add 1 to {_Scatter.Scattered}
- add 1 to {_Scatter.ScatteredTime}
- execute console command "/fleftscattersound {@ScatterSound} {@ScatterPitch}"
- wait 1 tick
- if {_Scatter.SinglePlayer} is not online:
- set {Scatter.schedule::%{_Scatter.SinglePlayer}%} to {_Scatter.GroundLocation}
- broadcast "{@Prefix}{@CC} %{_Scatter.SinglePlayer}% - Scheduled Scatter"
- else:
- if {@BroadcastScatteredPlayers} is true:
- broadcast "{@Prefix} {@HC}%{_Scatter.Scattered}%{@CC}/{@HC}%{_Scatter.AmountOfPlayers}% {@CC}- &7 %{_Scatter.SinglePlayer}%"
- teleport {_Scatter.SinglePlayer} to {_Scatter.GroundLocation}
- wait {@ScatterTicks} tick
- broadcast ""
- broadcast "{@Prefix}{@HC} %arg-3%{@CC} scattered!"
- broadcast "{@Prefix}{@CC} Radius: {@HC}%{_Scatter.radius}%!"
- #--------------------------------------------------
- # End of Scatter - Event section (and sound command)
- #--------------------------------------------------
- on chunk unload:
- {Scatter.DisableChunkUnload} is true:
- cancel the event
- on skript start:
- delete {Scatter.DisableChunkUnloading}
- on chat:
- {Scatter.DisableChat} is true:
- {@DisableChat} is true:
- cancel the event
- on login:
- {Scatter.schedule::%player%} is set:
- wait 1 tick
- teleport player to {Scatter.schedule::%player%}
- broadcast "{@Prefix}{@HC} %player%{@CC} - scheduled late scatter!"
- delete {Scatter.schedule::%player%}
- command /fleftscattersound [<text>] [<number>]:
- permission: skript.fleftscatter
- trigger:
- if arg-2 is not set:
- set {_pitch} to 1
- if arg-2 is set:
- set {_pitch} to arg-2
- loop all players:
- execute console command "/playsound %arg-1% %loop-player% ~ ~ ~ 1 %{_pitch}% 1"
Add Comment
Please, Sign In to add comment