Advertisement
fleft17

Untitled

Jun 26th, 2014
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.64 KB | None | 0 0
  1. options:
  2. Prefix: &7[&fScatter&7]&r
  3. MaxTries: 1001
  4. ChunkWaitTicks: 10
  5. ScatterWaitTicks: 1
  6.  
  7. # variables
  8. # {Teams::*} - list of integer - all team numbers currently active
  9. # {Team.%integer%.Set} - true/null - Team created?
  10. # {Team.%integer%::*} - list of "text" - player names in that team (TEXT!)
  11. # {Teams.InTeam::%player%} - integer/null - what team is player in?
  12.  
  13.  
  14. command /scatterteams <world> <integer> <integer>:
  15. usage: /scatterteams <world> <radius> <mindist>
  16. permission: skript.teams
  17. trigger:
  18. set {_Count} to 0
  19. loop {Teams::*}:
  20. {Team.%loop-value%::*} is set
  21. increase {_Count} by 1
  22. add {_Count} to {_Scatter.Teams::*}
  23. set {_Scatter.Team.%{_Count}%::*} to {Team.%loop-value%::*}
  24.  
  25. loop all players:
  26. {Teams.InTeam::%loop-player%} is not set
  27. add (name of loop-player) to {_Solos::*}
  28.  
  29. broadcast "{@Prefix} Attempting scatter with &3%arg 2% &eradius"
  30. set {_Size} to ((size of {_Scatter.Teams::*})+(size of {_Solos::*}))
  31.  
  32. # this is copied from the above scatter
  33. loop {_Size} times:
  34. loop {@MaxTries} times:
  35. if loop-number-2 is equal to {@MaxTries}:
  36. message "{@Prefix} Could not get position &7[&f%loop-number-1%&9/&f%{_Size}%&7]"
  37. command "/scatter-playsound random.break"
  38. stop trigger
  39. set {_ThisLocation.Okay} to true
  40. 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))
  41. loop ((loop-number-1)-1) times:
  42. {_ThisLocation.Okay} is true
  43. distance between {_ThisLocation.Sky} and {_FinalLocation.Sky::%loop-number-3%} is less than (arg 3)
  44. delete {_ThisLocation.Okay}
  45. if {_ThisLocation.Okay} is true:
  46. set {_ThisLocation.Ground} to {_ThisLocation.Sky}
  47. while (block at {_ThisLocation.Ground}) is air:
  48. if y-coordinate of {_ThisLocation.Ground} is less than 4:
  49. delete {_ThisLocation.Okay}
  50. stop loop
  51. set {_ThisLocation.Ground} to location 1 below {_ThisLocation.Ground}
  52. if {_ThisLocation.Okay} is true:
  53. if (block at {_ThisLocation.Ground}) is lava, water or cactus:
  54. delete {_ThisLocation.Okay}
  55. if {_ThisLocation.Okay} is true:
  56. set {_FinalLocation.Sky::%loop-number-1%} to {_ThisLocation.Sky}
  57. set {_FinalLocation.Ground::%loop-number-1%} to (location 1 above {_ThisLocation.Ground})
  58. stop loop
  59. set {Scatter.DisableChunkUnloading} to true
  60. set {_ApproxTime} to {_Size}*{@ChunkWaitTicks}/20
  61. broadcast "{@Prefix} Scatter will take &3%{_ApproxTime}% &eseconds!"
  62. loop {_Size} times:
  63. if command sender is not online:
  64. broadcast "{@Prefix} Operation failed, chunkloading player logged out."
  65. command "/scatter-playsound random.break"
  66. stop trigger
  67. teleport (command sender) to {_FinalLocation.Ground::%loop-number%}
  68. message "{@Prefix} Loading Chunkset &7[&f%loop-number%&9/&f%{_Size}%&7]" to command sender
  69. wait {@ChunkWaitTicks} ticks
  70. broadcast "{@Prefix} &4All locations loaded."
  71. wait 40 ticks
  72. set {_TeamSize} to (size of {_Scatter.Teams::*})
  73. set {_SoloSize} to (size of {_Solos::*})
  74. set {_PositionCount} to 0
  75. set {_TeamCount} to 0
  76. set {_SoloCount} to 0
  77. loop {_Scatter.Teams::*}:
  78. increase {_PositionCount} by 1
  79. increase {_TeamCount} by 1
  80. loop {_Scatter.Team.%loop-value%::*}:
  81. set {_Player} to ("%loop-value-2%" parsed as offlineplayer)
  82. if {_Player} is not online:
  83. broadcast "{@Prefix} &b- &6&l%{_Player}%&r: §4Not online &b- §rscheduling."
  84. set {ScatterScheduler::%{_Player}%} to {_FinalLocation.Ground::%{_PositionCount}%}
  85. else:
  86. teleport {_Player} to {_FinalLocation.Ground::%{_PositionCount}%}
  87. wait {@ScatterWaitTicks} ticks
  88. loop {_Solos::*}:
  89. increase {_PositionCount} by 1
  90. increase {_SoloCount} by 1
  91. set {_Player} to ("%loop-value%" parsed as offlineplayer)
  92. if {_Player} is not online:
  93. broadcast "{@Prefix} &b- &6&l%{_Player}%&r: §4Not online &b- §rscheduling."
  94. set {ScatterScheduler::%{_Player}%} to {_FinalLocation.Ground::%{_PositionCount}%}
  95. else:
  96. teleport {_Player} to {_FinalLocation.Ground::%{_PositionCount}%}
  97. wait {@ScatterWaitTicks} ticks
  98.  
  99. broadcast "{@Prefix} &aAll players scattered."
  100. wait 1 second
  101. delete {Scatter.DisableChunkUnloading}
  102.  
  103.  
  104. on chunk unload:
  105. {Scatter.DisableChunkUnloading} is true
  106. cancel the event
  107.  
  108. on skript start:
  109. delete {Scatter.DisableChunkUnloading}
  110.  
  111. on join:
  112. {ScatterScheduler::%player%} is set
  113. teleport player to {ScatterScheduler::%player%}
  114. delete {ScatterScheduler::%player%}
  115. broadcast "{@Prefix} &aScheduled late-scatter of %player%."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement