Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- options:
- Prefix: &7[&fScatter&7]&r
- MaxTries: 1001
- ChunkWaitTicks: 10
- ScatterWaitTicks: 1
- # 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} Attempting scatter with &3%arg 2% &eradius"
- 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} Scatter will take &3%{_ApproxTime}% &eseconds!"
- 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."
- 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
- 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}%}
- wait {@ScatterWaitTicks} ticks
- 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}%}
- wait {@ScatterWaitTicks} ticks
- broadcast "{@Prefix} &aAll players scattered."
- wait 1 second
- delete {Scatter.DisableChunkUnloading}
- 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%."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement