Advertisement
fleft17

Untitled

Jul 19th, 2014
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.79 KB | None | 0 0
  1. options:
  2. Prefix: &8[&bFavonius&8]&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.  
  30. broadcast "&7-----------------------------------"
  31. broadcast "{@Prefix} Teams are being scattered!"
  32. set {_Size} to ((size of {_Scatter.Teams::*})+(size of {_Solos::*}))
  33.  
  34. # this is copied from the above scatter
  35. loop {_Size} times:
  36. loop {@MaxTries} times:
  37. if loop-number-2 is equal to {@MaxTries}:
  38. message "{@Prefix} Could not get position &7[&f%loop-number-1%&9/&f%{_Size}%&7]"
  39. command "/scatter-playsound random.break"
  40. stop trigger
  41. set {_ThisLocation.Okay} to true
  42. 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))
  43. loop ((loop-number-1)-1) times:
  44. {_ThisLocation.Okay} is true
  45. distance between {_ThisLocation.Sky} and {_FinalLocation.Sky::%loop-number-3%} is less than (arg 3)
  46. delete {_ThisLocation.Okay}
  47. if {_ThisLocation.Okay} is true:
  48. set {_ThisLocation.Ground} to {_ThisLocation.Sky}
  49. while (block at {_ThisLocation.Ground}) is air:
  50. if y-coordinate of {_ThisLocation.Ground} is less than 4:
  51. delete {_ThisLocation.Okay}
  52. stop loop
  53. set {_ThisLocation.Ground} to location 1 below {_ThisLocation.Ground}
  54. if {_ThisLocation.Okay} is true:
  55. if (block at {_ThisLocation.Ground}) is lava, water or cactus:
  56. delete {_ThisLocation.Okay}
  57. if {_ThisLocation.Okay} is true:
  58. set {_FinalLocation.Sky::%loop-number-1%} to {_ThisLocation.Sky}
  59. set {_FinalLocation.Ground::%loop-number-1%} to (location 1 above {_ThisLocation.Ground})
  60. stop loop
  61. set {Scatter.DisableChunkUnloading} to true
  62. set {_ApproxTime} to {_Size}*{@ChunkWaitTicks}/20
  63. broadcast "{@Prefix} Scatter will take &a%{_ApproxTime}%&r seconds!"
  64. loop {_Size} times:
  65. if command sender is not online:
  66. broadcast "{@Prefix} Operation failed, chunkloading player logged out."
  67. command "/scatter-playsound random.break"
  68. stop trigger
  69. teleport (command sender) to {_FinalLocation.Ground::%loop-number%}
  70. message "{@Prefix} &aLoading: &7[&a%loop-number%&7/&b%{_Size}%&7]" to command sender
  71. wait {@ChunkWaitTicks} ticks
  72. broadcast "&7-----------------------------------"
  73. wait 40 ticks
  74. set {_TeamSize} to (size of {_Scatter.Teams::*})
  75. set {_SoloSize} to (size of {_Solos::*})
  76. set {_PositionCount} to 0
  77. set {_TeamCount} to 0
  78. set {_SoloCount} to 0
  79. loop {_Scatter.Teams::*}:
  80. increase {_PositionCount} by 1
  81. increase {_TeamCount} by 1
  82. loop {_Scatter.Team.%loop-value%::*}:
  83. set {_Player} to ("%loop-value-2%" parsed as offlineplayer)
  84. if {_Player} is not online:
  85. broadcast "{@Prefix} Scheduled late scatter of &a%{_Player}%."
  86. set {ScatterScheduler::%{_Player}%} to {_FinalLocation.Ground::%{_PositionCount}%}
  87. else:
  88. teleport {_Player} to {_FinalLocation.Ground::%{_PositionCount}%}
  89. execute console command "/sall note.bass 1"
  90. wait {@ScatterWaitTicks} ticks
  91. loop {_Solos::*}:
  92. increase {_PositionCount} by 1
  93. increase {_SoloCount} by 1
  94. set {_Player} to ("%loop-value%" parsed as offlineplayer)
  95. if {_Player} is not online:
  96. broadcast "{@Prefix} Scheduled late scatter of &a%{_Player}%!"
  97. set {ScatterScheduler::%{_Player}%} to {_FinalLocation.Ground::%{_PositionCount}%}
  98. else:
  99. teleport {_Player} to {_FinalLocation.Ground::%{_PositionCount}%}
  100. wait {@ScatterWaitTicks} ticks
  101.  
  102. broadcast "{@Prefix} All teams scattered!"
  103. broadcast "&7-----------------------------------"
  104. execute console command "/sall random.successful_hit 0.5"
  105. delete {Scatter.DisableChunkUnloading}
  106.  
  107.  
  108. on chunk unload:
  109. {Scatter.DisableChunkUnloading} is true
  110. cancel the event
  111.  
  112. on skript start:
  113. delete {Scatter.DisableChunkUnloading}
  114.  
  115. on join:
  116. {ScatterScheduler::%player%} is set
  117. teleport player to {ScatterScheduler::%player%}
  118. delete {ScatterScheduler::%player%}
  119. broadcast "{@Prefix}&r Scheduled late-scatter of &a%player%!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement