Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- options:
- ScaTicks: 3
- BC: &8
- P: &3[&bSoul Brothers&3]
- C: &7
- H: &a
- command /soulbrothers <world> <world> <integer>:
- permission: skript.op
- aliases: /sb, /sbs
- trigger:
- if {Teams::*} is set:
- loop {Teams::*}:
- if size of {Team.%loop-value%::*} is not 2:
- message "{@P}{@C} Team {@H}%loop-value%{@C} does not have two players!"
- stop trigger
- else:
- message "{@P}{@C} There are no teams set!"
- stop trigger
- if arg-3 is less than 1:
- message "{@P}{@C} Use a valid radius!"
- stop
- broadcast "{@P}{@C} Starting Soul Brothers..."
- loop {Teams::*}:
- set {_Temp.%loop-value%::*} to {Team.%loop-value%::*}
- set {_Sb1} to a random element of {_Temp.%loop-value%::*}
- remove "%{_Sb1}%" from {_Temp.%loop-value%::*}
- add "%{_Sb1}%" to {_Sb1::*}
- set {_Sb2} to a random element of {_Temp.%loop-value%::*}
- remove "%{_Sb2}%" from {_Temp.%loop-value%::*}
- add "%{_Sb2}%" to {_Sb2::*}
- set {_Size} to size of {_Sb1::*}
- set {_Mindist} to (arg-3/{_Size})*3.5
- broadcast "{@P}{@C} Preparing to scatter soul brothers!"
- loop ({_Size}) times:
- loop 1000 times:
- if (loop-number-2) is 1000:
- message "{@P}{@C} Couldn't find position {@H}%({_Size})-(loop-number-1)%{@BC}/{@H}%{_Size}%{@C}. Try again!"
- delete {_Sb1::*}
- delete {_Sb2::*}
- stop
- set {_Location.Good} to true
- set {_Location.Sky} to (the location at (random integer between (0-arg-3) and (0+arg-3)), 255, (random integer between (0-arg-3) and (0+arg-3)) of the world (arg-1))
- 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 {_Location.GroundLevel} to {_Location.Sky}
- while (block at {_Location.GroundLevel}) is air:
- if (y-coordinate of ({_Location.GroundLevel})) is less than 4:
- delete {_Location.Good}
- stop loop
- set {_Location.GroundLevel} to (location 1 below ({_Location.GroundLevel}))
- if {_Location.Good} is true:
- if (block at {_Location.GroundLevel}) is lava, water source or cactus:
- delete {_Location.Good}
- else:
- set {_GoodLocation.Sky::%loop-number-1%} to ({_Location.Sky})
- set {_GoodLocation.GroundLevel::%loop-number-1%} to (location 3 above {_Location.GroundLevel})
- stop loop
- broadcast "{@P}{@C} First half of chunks are being loaded..."
- set {chunkloading::%command sender%} to true
- wait 1 seconds
- set {Scatter.DontUnloadChunks} to true
- loop {_Size} times:
- if command sender is not online:
- broadcast "{@P}{@H} Stopping {@C}operation! Chunloading player logged out."
- delete {_Sb1::*}
- delete {_Sb2::*}
- stop
- teleport command sender to {_GoodLocation.GroundLevel::%loop-number%}
- message "{@P}{@C} Loading chunk{@BC}: [{@H}%loop-number%{@BC}/{@H}%{_Size}%{@BC}]"
- wait 10 tick
- delete {chunkloading::%command sender%}
- broadcast "{@P}{@C} First half of soul brothers are being scattered..."
- loop {_Sb1::*}:
- add 1 to {_PositionCount}
- add 1 to {_SoloCount}
- set {_Player} to ("%loop-value%" parsed as offlineplayer)
- if {_Player} is not online:
- set {SchedueldScatter::%{_Player}%} to ({_GoodLocation.GroundLevel::%{_PositionCount}%})
- else:
- teleport {_Player} to ({_GoodLocation.GroundLevel::%{_PositionCount}%})
- if {_Player} is command sender:
- set {_TempLoc} to ({_GoodLocation.GroundLevel::%{_PositionCount}%})
- broadcast "%{_TempLoc}% %{_GoodLocation.GroundLevel::%{_PositionCount}%}%"
- broadcast "{@P}{@H} %{_Player}%{@C} Scattered {@BC}({@C}1{@BC})"
- wait {@ScaTicks} ticks
- broadcast "{@P}{@C} First half of soul brothers scattered!"
- wait 1 second
- set {_Size} to size of {_Sb2::*}
- set {_Mindist} to (arg-3/{_Size})*3.5
- delete {_PositionCount}
- delete {_SoloCount}
- loop ({_Size}) times:
- loop 1000 times:
- if (loop-number-2) is 1000:
- message "{@P}{@C} Couldn't find position {@H}%({_Size})-(loop-number-1)%{@BC}/{@H}%{_Size}%{@C}. Try again!"
- delete {_Sb1::*}
- delete {_Sb2::*}
- stop
- set {_Location.Good} to true
- set {_Location.Sky} to (the location at (random integer between (0-arg-3) and (0+arg-3)), 255, (random integer between (0-arg-3) and (0+arg-3)) of the world (arg-2))
- 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 {_Location.GroundLevel} to {_Location.Sky}
- while (block at {_Location.GroundLevel}) is air:
- if (y-coordinate of ({_Location.GroundLevel})) is less than 4:
- delete {_Location.Good}
- stop loop
- set {_Location.GroundLevel} to (location 1 below ({_Location.GroundLevel}))
- if {_Location.Good} is true:
- if (block at {_Location.GroundLevel}) is lava, water source or cactus:
- delete {_Location.Good}
- else:
- set {_GoodLocation.Sky::%loop-number-1%} to ({_Location.Sky})
- set {_GoodLocation.GroundLevel::%loop-number-1%} to (location 3 above {_Location.GroundLevel})
- stop loop
- broadcast "{@P}{@C} Second half of chunks are being loaded..."
- set {chunkloading::%command sender%} to true
- wait 1 seconds
- set {Scatter.DontUnloadChunks} to true
- loop {_Size} times:
- if command sender is not online:
- broadcast "{@P}{@H} Stopping {@C}Soul Brothers! Chunloading player logged out."
- delete {_Sb1::*}
- delete {_Sb2::*}
- stop
- teleport command sender to {_GoodLocation.GroundLevel::%loop-number%}
- message "{@P}{@C} Loading chunk{@BC}: [{@H}%loop-number%{@BC}/{@H}%{_Size}%{@BC}]"
- wait 10 tick
- delete {chunkloading::%command sender%}
- broadcast "{@P}{@C} Second half of soul brothers are being scattered..."
- loop {_Sb2::*}:
- add 1 to {_PositionCount}
- add 1 to {_SoloCount}
- set {_Player} to ("%loop-value%" parsed as offlineplayer)
- if {_Player} is not online:
- set {SchedueldScatter::%{_Player}%} to ({_GoodLocation.GroundLevel::%{_PositionCount}%})
- else:
- teleport {_Player} to ({_GoodLocation.GroundLevel::%{_PositionCount}%})
- broadcast "{@P}{@H} %{_Player}%{@C} Scattered {@BC}({@C}2{@BC})"
- wait {@ScaTicks} ticks
- wait 20 ticks
- if {_Sb1::*} contains "%command sender%":
- teleport the command sender to the spawn of the world arg-1
- wait 5 ticks
- teleport the command sender to ({_TempLoc})
- broadcast "{@P}{@C} Soul brothers operation complete!"
- on skript load:
- delete {chunkloading::*}
- delete {Scatter.DontUnloadChunks}
- delete {Scatter.Scattering::*}
- delete {SchedueldScatter::*}
- on skript unload:
- delete {chunkloading::*}
- delete {Scatter.DontUnloadChunks}
- delete {Scatter.Scattering::*}
- delete {SchedueldScatter::*}
- on login:
- delete {Scatter.Scattering::%player%}
- {SchedueldScatter::%player%} is set
- teleport (player) to ({SchedueldScatter::%player%})
- delete {SchedueldScatter::%player%}
- broadcast "{@P}{@H} %player% {@C}Has been late scattered in their world!"
- on chunk unload:
- {Scatter.DontUnloadChunks} is set
- cancel the event
Advertisement
Add Comment
Please, Sign In to add comment