Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- options:
- Prefix: &f[&7Scatter&f]&r
- MaxTries: 1001
- ChunkWaitTicks: 10
- ScatterWaitTicks: 1
- command /scatterall <world> <integer> <integer>:
- description: Scatter command
- usage: /scatterall <world> <radius> <mindist>
- permission: skript.scatter
- trigger:
- if (size of (all players)) is equal to 0:
- message "{@Prefix} Nobody online. Insert Sadface!"
- stop
- broadcast "{@Prefix} Attempt with radius &6%arg 2% &rand mindist. &6%arg 3%&r..."
- command "/scatter-playsound note.harp"
- set {_Players::*} to all players
- set {_Size} to (size of {_Players::*})
- loop {_Size} times:
- loop {@MaxTries} times:
- if loop-number-2 is equal to {@MaxTries}:
- message "{@Prefix} Could not get position &7[&f%loop-number-1%&9/&f%{_Size}%&7]"
- command "/scatter-playsound random.break"
- stop trigger
- set {_ThisLocation.Okay} to true
- set {_ThisLocation.Sky} to (the location at ((random integer between (0-(arg 2)) and ((arg 2)-1))+0.5), 255, ((random integer between (0-(arg 2)) and ((arg 2)-1))+0.5) of the world (arg 1))
- loop ((loop-number-1)-1) times:
- {_ThisLocation.Okay} is true
- distance between {_ThisLocation.Sky} and {_FinalLocation.Sky::%loop-number-3%} is less than (arg 3)
- delete {_ThisLocation.Okay}
- if {_ThisLocation.Okay} is true:
- set {_ThisLocation.Ground} to {_ThisLocation.Sky}
- while (block at {_ThisLocation.Ground}) is air:
- if y-coordinate of {_ThisLocation.Ground} is less than 4:
- delete {_ThisLocation.Okay}
- stop loop
- set {_ThisLocation.Ground} to location 1 below {_ThisLocation.Ground}
- if {_ThisLocation.Okay} is true:
- if (block at {_ThisLocation.Ground}) is lava, water or cactus:
- delete {_ThisLocation.Okay}
- if {_ThisLocation.Okay} is true:
- set {_FinalLocation.Sky::%loop-number-1%} to {_ThisLocation.Sky}
- set {_FinalLocation.Ground::%loop-number-1%} to (location 1 above {_ThisLocation.Ground})
- stop loop
- set {Scatter.DisableChunkUnloading} to true
- set {_ApproxTime} to {_Size}*{@ChunkWaitTicks}/20
- broadcast "{@Prefix} Positions found, pre-loading chunksets&r!"
- broadcast "{@Prefix} Operation will take approx. &4%{_ApproxTime}% seconds&r!"
- command "/scatter-playsound fireworks.launch"
- loop {_Size} times:
- if command sender is not online:
- broadcast "{@Prefix} Operation failed, chunkloading player logged out."
- command "/scatter-playsound random.break"
- stop trigger
- teleport (command sender) to {_FinalLocation.Ground::%loop-number%}
- message "{@Prefix} Loading Chunkset &7[&f%loop-number%&9/&f%{_Size}%&7]" to command sender
- wait {@ChunkWaitTicks} ticks
- broadcast "{@Prefix} &4All locations loaded."
- command "/scatter-playsound random.explode"
- wait 40 ticks
- set {_Count} to 0
- loop {_Players::*}:
- increase {_Count} by 1
- if (loop-value) is not online:
- broadcast "{@Prefix} &cNot online: &7[&f%{_Count}%&9/&f%{_Size}%&7]&4 : &6%loop-value% &r- scheduling."
- set {ScatterScheduler::%loop-value%} to {_FinalLocation.Ground::%{_Count}%}
- else:
- teleport (loop-value) to {_FinalLocation.Ground::%{_Count}%}
- broadcast "{@Prefix} &aScattered &7[&f%{_Count}%&9/&f%{_Size}%&7]&4 : &6%loop-value%"
- command "/scatter-playsound note.bass"
- wait {@ScatterWaitTicks} tick
- broadcast "{@Prefix} &aAll players scattered."
- command "/scatter-playsound fireworks.twinkle"
- delete {Scatter.DisableChunkUnloading}
- # variables
- # {Teams::*} - list of integer - all team numbers currently active
- # {Team.%integer%.Set} - true/null - Team created?
- # {Team.%integer%::*} - list of "text" - player names in that team (TEXT!)
- # {Teams.InTeam::%player%} - integer/null - what team is player in?
- command /scatterteams <world> <integer> <integer>:
- usage: /scatterteams <world> <radius> <mindist>
- permission: skript.teams
- trigger:
- set {_Count} to 0
- loop {Teams::*}:
- {Team.%loop-value%::*} is set
- increase {_Count} by 1
- add {_Count} to {_Scatter.Teams::*}
- set {_Scatter.Team.%{_Count}%::*} to {Team.%loop-value%::*}
- loop all players:
- {Teams.InTeam::%loop-player%} is not set
- add (name of loop-player) to {_Solos::*}
- broadcast "{@Prefix} Attempt with radius &6%arg 2% &rand mindist. &6%arg 3%&r..."
- command "/scatter-playsound note.harp"
- set {_Size} to ((size of {_Scatter.Teams::*})+(size of {_Solos::*}))
- # this is copied from the above scatter
- loop {_Size} times:
- loop {@MaxTries} times:
- if loop-number-2 is equal to {@MaxTries}:
- message "{@Prefix} Could not get position &7[&f%loop-number-1%&9/&f%{_Size}%&7]"
- command "/scatter-playsound random.break"
- stop trigger
- set {_ThisLocation.Okay} to true
- set {_ThisLocation.Sky} to (the location at ((random integer between (0-(arg 2)) and ((arg 2)-1))+0.5), 255, ((random integer between (0-(arg 2)) and ((arg 2)-1))+0.5) of the world (arg 1))
- loop ((loop-number-1)-1) times:
- {_ThisLocation.Okay} is true
- distance between {_ThisLocation.Sky} and {_FinalLocation.Sky::%loop-number-3%} is less than (arg 3)
- delete {_ThisLocation.Okay}
- if {_ThisLocation.Okay} is true:
- set {_ThisLocation.Ground} to {_ThisLocation.Sky}
- while (block at {_ThisLocation.Ground}) is air:
- if y-coordinate of {_ThisLocation.Ground} is less than 4:
- delete {_ThisLocation.Okay}
- stop loop
- set {_ThisLocation.Ground} to location 1 below {_ThisLocation.Ground}
- if {_ThisLocation.Okay} is true:
- if (block at {_ThisLocation.Ground}) is lava, water or cactus:
- delete {_ThisLocation.Okay}
- if {_ThisLocation.Okay} is true:
- set {_FinalLocation.Sky::%loop-number-1%} to {_ThisLocation.Sky}
- set {_FinalLocation.Ground::%loop-number-1%} to (location 1 above {_ThisLocation.Ground})
- stop loop
- set {Scatter.DisableChunkUnloading} to true
- set {_ApproxTime} to {_Size}*{@ChunkWaitTicks}/20
- broadcast "{@Prefix} Positions found, pre-loading chunksets&r!"
- broadcast "{@Prefix} Operation will take approx. &4%{_ApproxTime}% seconds&r!"
- command "/scatter-playsound fireworks.launch"
- loop {_Size} times:
- if command sender is not online:
- broadcast "{@Prefix} Operation failed, chunkloading player logged out."
- command "/scatter-playsound random.break"
- stop trigger
- teleport (command sender) to {_FinalLocation.Ground::%loop-number%}
- message "{@Prefix} Loading Chunkset &7[&f%loop-number%&9/&f%{_Size}%&7]" to command sender
- wait {@ChunkWaitTicks} ticks
- broadcast "{@Prefix} &4All locations loaded."
- command "/scatter-playsound random.explode"
- wait 40 ticks
- 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
- loop {_Scatter.Teams::*}:
- increase {_PositionCount} by 1
- increase {_TeamCount} by 1
- broadcast "{@Prefix} &rScattering &4Team %{_TeamCount}%&r:"
- loop {_Scatter.Team.%loop-value%::*}:
- set {_Player} to ("%loop-value-2%" parsed as offlineplayer)
- if {_Player} is not online:
- broadcast "{@Prefix} &b- &6&l%{_Player}%&r: §4Not online &b- §rscheduling."
- set {ScatterScheduler::%{_Player}%} to {_FinalLocation.Ground::%{_PositionCount}%}
- else:
- teleport {_Player} to {_FinalLocation.Ground::%{_PositionCount}%}
- broadcast "{@Prefix} &b- &6&l%{_Player}%&r: §aScattered!"
- command "/scatter-playsound note.bass"
- wait {@ScatterWaitTicks} ticks
- broadcast "{@Prefix} &rScattering &5Solos&r!"
- loop {_Solos::*}:
- increase {_PositionCount} by 1
- increase {_SoloCount} by 1
- set {_Player} to ("%loop-value%" parsed as offlineplayer)
- if {_Player} is not online:
- broadcast "{@Prefix} &b- &6&l%{_Player}%&r: §4Not online &b- §rscheduling."
- set {ScatterScheduler::%{_Player}%} to {_FinalLocation.Ground::%{_PositionCount}%}
- else:
- teleport {_Player} to {_FinalLocation.Ground::%{_PositionCount}%}
- broadcast "{@Prefix} &b- &6&l%{_Player}%&r: §aScattered!"
- command "/scatter-playsound note.bass"
- wait {@ScatterWaitTicks} ticks
- broadcast "{@Prefix} &aAll players scattered."
- command "/scatter-playsound fireworks.twinkle"
- delete {Scatter.DisableChunkUnloading}
- command /scatter-playsound <text>:
- permission: skript.scatter.playsound
- trigger:
- loop all players:
- command "/playsound %arg 1% %loop-player%"
- on chunk unload:
- {Scatter.DisableChunkUnloading} is true
- cancel the event
- on skript start:
- delete {Scatter.DisableChunkUnloading}
- on join:
- {ScatterScheduler::%player%} is set
- teleport player to {ScatterScheduler::%player%}
- delete {ScatterScheduler::%player%}
- broadcast "{@Prefix} &aScheduled late-scatter of %player%."
Add Comment
Please, Sign In to add comment