Guest User

Untitled

a guest
Apr 8th, 2016
377
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.10 KB | None | 0 0
  1. options:
  2. ScaTicks: 3
  3. BC: &8
  4. P: &3[&bSoul Brothers&3]
  5. C: &7
  6. H: &a
  7.  
  8. command /soulbrothers <world> <world> <integer>:
  9. permission: skript.op
  10. aliases: /sb, /sbs
  11. trigger:
  12. if {Teams::*} is set:
  13. loop {Teams::*}:
  14. if size of {Team.%loop-value%::*} is not 2:
  15. message "{@P}{@C} Team {@H}%loop-value%{@C} does not have two players!"
  16. stop trigger
  17. else:
  18. message "{@P}{@C} There are no teams set!"
  19. stop trigger
  20. if arg-3 is less than 1:
  21. message "{@P}{@C} Use a valid radius!"
  22. stop
  23.  
  24. broadcast "{@P}{@C} Starting Soul Brothers..."
  25. loop {Teams::*}:
  26. set {_Temp.%loop-value%::*} to {Team.%loop-value%::*}
  27.  
  28. set {_Sb1} to a random element of {_Temp.%loop-value%::*}
  29. remove "%{_Sb1}%" from {_Temp.%loop-value%::*}
  30. add "%{_Sb1}%" to {_Sb1::*}
  31.  
  32. set {_Sb2} to a random element of {_Temp.%loop-value%::*}
  33. remove "%{_Sb2}%" from {_Temp.%loop-value%::*}
  34. add "%{_Sb2}%" to {_Sb2::*}
  35.  
  36. set {_Size} to size of {_Sb1::*}
  37. set {_Mindist} to (arg-3/{_Size})*3.5
  38. broadcast "{@P}{@C} Preparing to scatter soul brothers!"
  39. loop ({_Size}) times:
  40. loop 1000 times:
  41. if (loop-number-2) is 1000:
  42. message "{@P}{@C} Couldn't find position {@H}%({_Size})-(loop-number-1)%{@BC}/{@H}%{_Size}%{@C}. Try again!"
  43. delete {_Sb1::*}
  44. delete {_Sb2::*}
  45. stop
  46. set {_Location.Good} to true
  47. 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))
  48. loop ((loop-number-1)-1) times:
  49. (distance between {_Location.Sky} and {_GoodLocation.Sky::%loop-number-3%}) is less than ({_Mindist})
  50. delete {_Location.Good}
  51. if {_Location.Good} is true:
  52. set {_Location.GroundLevel} to {_Location.Sky}
  53. while (block at {_Location.GroundLevel}) is air:
  54. if (y-coordinate of ({_Location.GroundLevel})) is less than 4:
  55. delete {_Location.Good}
  56. stop loop
  57. set {_Location.GroundLevel} to (location 1 below ({_Location.GroundLevel}))
  58. if {_Location.Good} is true:
  59. if (block at {_Location.GroundLevel}) is lava, water source or cactus:
  60. delete {_Location.Good}
  61. else:
  62. set {_GoodLocation.Sky::%loop-number-1%} to ({_Location.Sky})
  63. set {_GoodLocation.GroundLevel::%loop-number-1%} to (location 3 above {_Location.GroundLevel})
  64. stop loop
  65. broadcast "{@P}{@C} First half of chunks are being loaded..."
  66. set {chunkloading::%command sender%} to true
  67. wait 1 seconds
  68. set {Scatter.DontUnloadChunks} to true
  69. loop {_Size} times:
  70. if command sender is not online:
  71. broadcast "{@P}{@H} Stopping {@C}operation! Chunloading player logged out."
  72. delete {_Sb1::*}
  73. delete {_Sb2::*}
  74. stop
  75. teleport command sender to {_GoodLocation.GroundLevel::%loop-number%}
  76. message "{@P}{@C} Loading chunk{@BC}: [{@H}%loop-number%{@BC}/{@H}%{_Size}%{@BC}]"
  77. wait 10 tick
  78. delete {chunkloading::%command sender%}
  79. broadcast "{@P}{@C} First half of soul brothers are being scattered..."
  80. loop {_Sb1::*}:
  81. add 1 to {_PositionCount}
  82. add 1 to {_SoloCount}
  83. set {_Player} to ("%loop-value%" parsed as offlineplayer)
  84. if {_Player} is not online:
  85. set {SchedueldScatter::%{_Player}%} to ({_GoodLocation.GroundLevel::%{_PositionCount}%})
  86. else:
  87. teleport {_Player} to ({_GoodLocation.GroundLevel::%{_PositionCount}%})
  88. if {_Player} is command sender:
  89. set {_TempLoc} to ({_GoodLocation.GroundLevel::%{_PositionCount}%})
  90. broadcast "%{_TempLoc}% %{_GoodLocation.GroundLevel::%{_PositionCount}%}%"
  91. broadcast "{@P}{@H} %{_Player}%{@C} Scattered {@BC}({@C}1{@BC})"
  92. wait {@ScaTicks} ticks
  93. broadcast "{@P}{@C} First half of soul brothers scattered!"
  94. wait 1 second
  95. set {_Size} to size of {_Sb2::*}
  96. set {_Mindist} to (arg-3/{_Size})*3.5
  97. delete {_PositionCount}
  98. delete {_SoloCount}
  99. loop ({_Size}) times:
  100. loop 1000 times:
  101. if (loop-number-2) is 1000:
  102. message "{@P}{@C} Couldn't find position {@H}%({_Size})-(loop-number-1)%{@BC}/{@H}%{_Size}%{@C}. Try again!"
  103. delete {_Sb1::*}
  104. delete {_Sb2::*}
  105. stop
  106. set {_Location.Good} to true
  107. 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))
  108. loop ((loop-number-1)-1) times:
  109. (distance between {_Location.Sky} and {_GoodLocation.Sky::%loop-number-3%}) is less than ({_Mindist})
  110. delete {_Location.Good}
  111. if {_Location.Good} is true:
  112. set {_Location.GroundLevel} to {_Location.Sky}
  113. while (block at {_Location.GroundLevel}) is air:
  114. if (y-coordinate of ({_Location.GroundLevel})) is less than 4:
  115. delete {_Location.Good}
  116. stop loop
  117. set {_Location.GroundLevel} to (location 1 below ({_Location.GroundLevel}))
  118. if {_Location.Good} is true:
  119. if (block at {_Location.GroundLevel}) is lava, water source or cactus:
  120. delete {_Location.Good}
  121. else:
  122. set {_GoodLocation.Sky::%loop-number-1%} to ({_Location.Sky})
  123. set {_GoodLocation.GroundLevel::%loop-number-1%} to (location 3 above {_Location.GroundLevel})
  124. stop loop
  125. broadcast "{@P}{@C} Second half of chunks are being loaded..."
  126. set {chunkloading::%command sender%} to true
  127. wait 1 seconds
  128. set {Scatter.DontUnloadChunks} to true
  129. loop {_Size} times:
  130. if command sender is not online:
  131. broadcast "{@P}{@H} Stopping {@C}Soul Brothers! Chunloading player logged out."
  132. delete {_Sb1::*}
  133. delete {_Sb2::*}
  134. stop
  135. teleport command sender to {_GoodLocation.GroundLevel::%loop-number%}
  136. message "{@P}{@C} Loading chunk{@BC}: [{@H}%loop-number%{@BC}/{@H}%{_Size}%{@BC}]"
  137. wait 10 tick
  138. delete {chunkloading::%command sender%}
  139. broadcast "{@P}{@C} Second half of soul brothers are being scattered..."
  140. loop {_Sb2::*}:
  141. add 1 to {_PositionCount}
  142. add 1 to {_SoloCount}
  143. set {_Player} to ("%loop-value%" parsed as offlineplayer)
  144. if {_Player} is not online:
  145. set {SchedueldScatter::%{_Player}%} to ({_GoodLocation.GroundLevel::%{_PositionCount}%})
  146. else:
  147. teleport {_Player} to ({_GoodLocation.GroundLevel::%{_PositionCount}%})
  148. broadcast "{@P}{@H} %{_Player}%{@C} Scattered {@BC}({@C}2{@BC})"
  149. wait {@ScaTicks} ticks
  150.  
  151. wait 20 ticks
  152. if {_Sb1::*} contains "%command sender%":
  153. teleport the command sender to the spawn of the world arg-1
  154. wait 5 ticks
  155. teleport the command sender to ({_TempLoc})
  156. broadcast "{@P}{@C} Soul brothers operation complete!"
  157.  
  158. on skript load:
  159. delete {chunkloading::*}
  160. delete {Scatter.DontUnloadChunks}
  161. delete {Scatter.Scattering::*}
  162. delete {SchedueldScatter::*}
  163.  
  164. on skript unload:
  165. delete {chunkloading::*}
  166. delete {Scatter.DontUnloadChunks}
  167. delete {Scatter.Scattering::*}
  168. delete {SchedueldScatter::*}
  169.  
  170. on login:
  171. delete {Scatter.Scattering::%player%}
  172. {SchedueldScatter::%player%} is set
  173. teleport (player) to ({SchedueldScatter::%player%})
  174. delete {SchedueldScatter::%player%}
  175. broadcast "{@P}{@H} %player% {@C}Has been late scattered in their world!"
  176.  
  177. on chunk unload:
  178. {Scatter.DontUnloadChunks} is set
  179. cancel the event
Advertisement
Add Comment
Please, Sign In to add comment