NullChips

Untitled

Feb 15th, 2017 (edited)
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. options:
  2.     Prefix: &f[&7Scatter&f]&r
  3.     MaxTries: 1001
  4.     ChunkWaitTicks: 10
  5.     ScatterWaitTicks: 1
  6.    
  7. command /scatterall <world> <integer> <integer>:
  8.     description: Scatter command
  9.     usage: /scatterall <world> <radius> <mindist>
  10.     permission: skript.scatter
  11.     trigger:
  12.         if (size of (all players)) is equal to 0:
  13.             message "{@Prefix} Nobody online. Insert Sadface!"
  14.             stop           
  15.         broadcast "{@Prefix} Attempt with radius &6%arg 2% &rand mindist. &6%arg 3%&r..."
  16.         command "/scatter-playsound note.harp"     
  17.         set {_Players::*} to all players       
  18.         set {_Size} to (size of {_Players::*}) 
  19.         loop {_Size} times:
  20.             loop {@MaxTries} times:
  21.                 if loop-number-2 is equal to {@MaxTries}:
  22.                     message "{@Prefix} Could not get position &7[&f%loop-number-1%&9/&f%{_Size}%&7]"
  23.                     command "/scatter-playsound random.break"
  24.                     stop trigger   
  25.                 set {_ThisLocation.Okay} to true
  26.                 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))
  27.                 loop ((loop-number-1)-1) times:
  28.                     {_ThisLocation.Okay} is true
  29.                     distance between {_ThisLocation.Sky} and {_FinalLocation.Sky::%loop-number-3%} is less than (arg 3)
  30.                     delete {_ThisLocation.Okay}    
  31.                 if {_ThisLocation.Okay} is true:
  32.                     set {_ThisLocation.Ground} to {_ThisLocation.Sky}
  33.                     while (block at {_ThisLocation.Ground}) is air:
  34.                         if y-coordinate of {_ThisLocation.Ground} is less than 4:
  35.                             delete {_ThisLocation.Okay}
  36.                             stop loop
  37.                         set {_ThisLocation.Ground} to location 1 below {_ThisLocation.Ground}          
  38.                     if {_ThisLocation.Okay} is true:
  39.                         if (block at {_ThisLocation.Ground}) is lava, water or cactus:
  40.                             delete {_ThisLocation.Okay}                
  41.                         if {_ThisLocation.Okay} is true:
  42.                             set {_FinalLocation.Sky::%loop-number-1%} to {_ThisLocation.Sky}
  43.                             set {_FinalLocation.Ground::%loop-number-1%} to (location 1 above {_ThisLocation.Ground})
  44.                             stop loop                  
  45.         set {Scatter.DisableChunkUnloading} to true
  46.         set {_ApproxTime} to {_Size}*{@ChunkWaitTicks}/20
  47.         broadcast "{@Prefix} Positions found, pre-loading chunksets&r!"
  48.         broadcast "{@Prefix} Operation will take approx. &4%{_ApproxTime}% seconds&r!"
  49.         command "/scatter-playsound fireworks.launch"
  50.         loop {_Size} times:
  51.             if command sender is not online:
  52.                 broadcast "{@Prefix} Operation failed, chunkloading player logged out."
  53.                 command "/scatter-playsound random.break"
  54.                 stop trigger           
  55.             teleport (command sender) to {_FinalLocation.Ground::%loop-number%}
  56.             message "{@Prefix} Loading Chunkset &7[&f%loop-number%&9/&f%{_Size}%&7]" to command sender
  57.             wait {@ChunkWaitTicks} ticks                   
  58.         broadcast "{@Prefix} &4All locations loaded."
  59.         command "/scatter-playsound random.explode"
  60.         wait 40 ticks
  61.         set {_Count} to 0
  62.         loop {_Players::*}:
  63.             increase {_Count} by 1
  64.             if (loop-value) is not online:
  65.                 broadcast "{@Prefix} &cNot online: &7[&f%{_Count}%&9/&f%{_Size}%&7]&4 : &6%loop-value% &r- scheduling."
  66.                 set {ScatterScheduler::%loop-value%} to {_FinalLocation.Ground::%{_Count}%}
  67.             else:
  68.                 teleport (loop-value) to {_FinalLocation.Ground::%{_Count}%}
  69.                 broadcast "{@Prefix} &aScattered &7[&f%{_Count}%&9/&f%{_Size}%&7]&4 : &6%loop-value%"
  70.             command "/scatter-playsound note.bass"
  71.             wait {@ScatterWaitTicks} tick
  72.         broadcast "{@Prefix} &aAll players scattered."
  73.         command "/scatter-playsound fireworks.twinkle"
  74.         delete {Scatter.DisableChunkUnloading}
  75.        
  76.        
  77. # variables
  78. # {Teams::*}                - list of integer   - all team numbers currently active
  79. # {Team.%integer%.Set}      - true/null         - Team created?
  80. # {Team.%integer%::*}       - list of "text"    - player names in that team (TEXT!)
  81. # {Teams.InTeam::%player%}  - integer/null      - what team is player in?
  82.    
  83.    
  84. command /scatterteams <world> <integer> <integer>:
  85.     usage: /scatterteams <world> <radius> <mindist>
  86.     permission: skript.teams
  87.     trigger:
  88.         set {_Count} to 0
  89.         loop {Teams::*}:
  90.             {Team.%loop-value%::*} is set
  91.             increase {_Count} by 1
  92.             add {_Count} to {_Scatter.Teams::*}
  93.             set {_Scatter.Team.%{_Count}%::*} to {Team.%loop-value%::*}
  94.            
  95.         loop all players:
  96.             {Teams.InTeam::%loop-player%} is not set
  97.             add (name of loop-player) to {_Solos::*}
  98.            
  99.         broadcast "{@Prefix} Attempt with radius &6%arg 2% &rand mindist. &6%arg 3%&r..."
  100.         command "/scatter-playsound note.harp"
  101.         set {_Size} to ((size of {_Scatter.Teams::*})+(size of {_Solos::*}))
  102.        
  103.         # this is copied from the above scatter
  104.         loop {_Size} times:
  105.             loop {@MaxTries} times:
  106.                 if loop-number-2 is equal to {@MaxTries}:
  107.                     message "{@Prefix} Could not get position &7[&f%loop-number-1%&9/&f%{_Size}%&7]"
  108.                     command "/scatter-playsound random.break"
  109.                     stop trigger   
  110.                 set {_ThisLocation.Okay} to true
  111.                 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))
  112.                 loop ((loop-number-1)-1) times:
  113.                     {_ThisLocation.Okay} is true
  114.                     distance between {_ThisLocation.Sky} and {_FinalLocation.Sky::%loop-number-3%} is less than (arg 3)
  115.                     delete {_ThisLocation.Okay}    
  116.                 if {_ThisLocation.Okay} is true:
  117.                     set {_ThisLocation.Ground} to {_ThisLocation.Sky}
  118.                     while (block at {_ThisLocation.Ground}) is air:
  119.                         if y-coordinate of {_ThisLocation.Ground} is less than 4:
  120.                             delete {_ThisLocation.Okay}
  121.                             stop loop
  122.                         set {_ThisLocation.Ground} to location 1 below {_ThisLocation.Ground}          
  123.                     if {_ThisLocation.Okay} is true:
  124.                         if (block at {_ThisLocation.Ground}) is lava, water or cactus:
  125.                             delete {_ThisLocation.Okay}                
  126.                         if {_ThisLocation.Okay} is true:
  127.                             set {_FinalLocation.Sky::%loop-number-1%} to {_ThisLocation.Sky}
  128.                             set {_FinalLocation.Ground::%loop-number-1%} to (location 1 above {_ThisLocation.Ground})
  129.                             stop loop
  130.         set {Scatter.DisableChunkUnloading} to true
  131.         set {_ApproxTime} to {_Size}*{@ChunkWaitTicks}/20
  132.         broadcast "{@Prefix} Positions found, pre-loading chunksets&r!"
  133.         broadcast "{@Prefix} Operation will take approx. &4%{_ApproxTime}% seconds&r!"
  134.         command "/scatter-playsound fireworks.launch"
  135.         loop {_Size} times:
  136.             if command sender is not online:
  137.                 broadcast "{@Prefix} Operation failed, chunkloading player logged out."
  138.                 command "/scatter-playsound random.break"
  139.                 stop trigger           
  140.             teleport (command sender) to {_FinalLocation.Ground::%loop-number%}
  141.             message "{@Prefix} Loading Chunkset &7[&f%loop-number%&9/&f%{_Size}%&7]" to command sender
  142.             wait {@ChunkWaitTicks} ticks                   
  143.         broadcast "{@Prefix} &4All locations loaded."
  144.         command "/scatter-playsound random.explode"
  145.         wait 40 ticks
  146.         set {_TeamSize} to (size of {_Scatter.Teams::*})
  147.         set {_SoloSize} to (size of {_Solos::*})
  148.         set {_PositionCount} to 0
  149.         set {_TeamCount} to 0
  150.         set {_SoloCount} to 0
  151.         loop {_Scatter.Teams::*}:
  152.             increase {_PositionCount} by 1
  153.             increase {_TeamCount} by 1
  154.             broadcast "{@Prefix} &rScattering &4Team %{_TeamCount}%&r:"
  155.             loop {_Scatter.Team.%loop-value%::*}:
  156.                 set {_Player} to ("%loop-value-2%" parsed as offlineplayer)
  157.                 if {_Player} is not online:
  158.                     broadcast "{@Prefix} &b- &6&l%{_Player}%&r: §4Not online &b- §rscheduling."
  159.                     set {ScatterScheduler::%{_Player}%} to {_FinalLocation.Ground::%{_PositionCount}%}
  160.                 else:
  161.                     teleport {_Player} to {_FinalLocation.Ground::%{_PositionCount}%}
  162.                     broadcast "{@Prefix} &b- &6&l%{_Player}%&r: §aScattered!"
  163.                 command "/scatter-playsound note.bass"
  164.                 wait {@ScatterWaitTicks} ticks
  165.         broadcast "{@Prefix} &rScattering &5Solos&r!"
  166.         loop {_Solos::*}:
  167.             increase {_PositionCount} by 1
  168.             increase {_SoloCount} by 1
  169.             set {_Player} to ("%loop-value%" parsed as offlineplayer)
  170.             if {_Player} is not online:
  171.                 broadcast "{@Prefix} &b- &6&l%{_Player}%&r: §4Not online &b- §rscheduling."
  172.                 set {ScatterScheduler::%{_Player}%} to {_FinalLocation.Ground::%{_PositionCount}%}
  173.             else:
  174.                 teleport {_Player} to {_FinalLocation.Ground::%{_PositionCount}%}
  175.                 broadcast "{@Prefix} &b- &6&l%{_Player}%&r: §aScattered!"
  176.             command "/scatter-playsound note.bass"
  177.             wait {@ScatterWaitTicks} ticks
  178.            
  179.         broadcast "{@Prefix} &aAll players scattered."
  180.         command "/scatter-playsound fireworks.twinkle"
  181.         delete {Scatter.DisableChunkUnloading}
  182.        
  183. command /scatter-playsound <text>:
  184.     permission: skript.scatter.playsound
  185.     trigger:
  186.         loop all players:
  187.             command "/playsound %arg 1% %loop-player%"
  188.  
  189. on chunk unload:
  190.     {Scatter.DisableChunkUnloading} is true
  191.     cancel the event
  192.    
  193. on skript start:
  194.     delete {Scatter.DisableChunkUnloading}
  195.    
  196. on join:
  197.     {ScatterScheduler::%player%} is set
  198.     teleport player to {ScatterScheduler::%player%}
  199.     delete {ScatterScheduler::%player%}
  200.     broadcast "{@Prefix} &aScheduled late-scatter of %player%."
Add Comment
Please, Sign In to add comment