Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Scatter Skript by Fleft. This is an advanced Skript. Use at your own risk. I am not responsible for any damage caused to servers because of this Skript.
- # To disable/enable and of these features below, change them to simply "true" or "false".
- # This was meant to be used in UHC games on www.reddit.com/r/ultrahardcore.
- # Version: v2 - FFA only
- options:
- #--------------------------------------------------
- # Options
- #--------------------------------------------------
- P: §f[§7Scatter]
- # Prefix for scatter messages
- H: §9
- # Chat color when there's **x** seconds, **player**, misc
- C: §f
- # Main chat color
- Tries: 1001
- # Limit to how many times the Skript will attempt to load a given location
- #--------------------------------------------------
- # Command
- #--------------------------------------------------
- command /scatterall [<world>] [<integer>]:
- permission: skript.fleftscatter
- trigger:
- command sender is player:
- command "/aps mob.enderdragon.growl"
- wait 25 ticks
- set {_ListOfAllPlayers::*} to all players
- set {_AmountOfPlayers} to (size of {_ListOfAllPlayers::*})
- loop {_ListOfAllPlayers::*}:
- add 1 to {_count}
- set {_ListOfAllPlayers::%{_count}%} to loop-value
- set {Scatter.DisableChunkUnload} to true
- set {_world} to arg-1
- set {_radius} to arg-2
- set {_mindist} to (({_radius}/{_AmountOfPlayers})*3)
- broadcast "{@P}{@C} Attempting to scatter {@H}%{_AmountOfPlayers}%{@C} players."
- loop {_AmountOfPlayers} times:
- loop {@Tries} times:
- if loop-number-2 is equal to {@Tries}:
- broadcast "{@P}{@C} Could not scatter %loop-number-1%/%{_AmountOfPlayers}%."
- broadcast "{@P}{@C} Some players may have been scattered!"
- command "/aps random.break"
- delete {Scatter.DisableChunkLoading}
- stop trigger
- set {_GoodLocation} to true
- set {_SkyLocation} to (the location at ((random integer between (0-{_radius}) and ({_radius}-1))+0.5), 255, ((random integer between (0-{_radius}) and ({_radius}-1))+0.5) of the world {_world})
- loop ((loop-number-1)-1) times:
- if distance between {_SkyLocation} and {_LastLocation} is less than {_mindist}:
- delete {_GoodLocation}
- if {_GoodLocation} is true:
- set {_GroundLocation} to {_SkyLocation}
- while (block at {_GroundLocation}) is air:
- if y-coordinate of {_GroundLocation} is less than 5:
- delete {_GoodLocation}
- stop loop
- set {_GroundLocation} to location 1 below {_GroundLocation}
- if {_GoodLocation} is true:
- if (block at {_GroundLocation}) is cactus, water, or lava:
- delete {_GoodLocation}
- if {_GoodLocation} is true:
- set {_LastLocation} to {_SkyLocation}
- set {_GroundLocation} to (location 1 above {_GroundLocation})
- add {_GroundLocation} to {_FinalLocations.Ground::*}
- add {_GroundLocation} to {_FinalLocations::*}
- wait 1 tick
- stop loop
- loop {_AmountOfPlayers} times:
- command sender is not online:
- broadcast "{@P}{@C} Scatter failed, command sender logged out."
- command "/aps random.break"
- stop trigger
- else:
- teleport (command sender) to {_FinalLocations::%loop-number%}
- if {_ListOfAllPlayers::%loop-number%} is not online:
- broadcast "{@P}{@H} %{_ListOfAllPlayers::%loop-number%}% {@C}- Scheduled"
- #set {_player} to {_ListOfAllPlayers::%loop-number%} parsed as player
- set {ScatterScheduler::%{_ListOfAllPlayers::%loop-number%}%} to {_FinalLocations::%loop-number%}
- else:
- broadcast "{@P}{@H} %{_ListOfAllPlayers::%loop-number%}% {@C}- %loop-number%/%{_AmountOfPlayers}%"
- if {_ListOfAllPlayers::%loop-number%} is equal to (command sender):
- set {_CommandSenderLocation} to {_FinalLocations::%loop-number%}
- wait 5 ticks
- teleport {_ListOfAllPlayers::%loop-number%} to (command sender)
- teleport (command sender) to {_CommandSenderLocation}
- broadcast "{@P}{@C} Task completed."
- delete {Scatter.DisableChunkUnload}
- wait 2 ticks
- loop 5 times:
- command "/aps note.harp"
- command "/aps fireworks.launch"
- command "/aps fireworks.twinkle"
- wait 4 ticks
- #--------------------------------------------------
- # End of Scatter - Event section (and sound command)
- #--------------------------------------------------
- on chunk unload:
- {Scatter.DisableChunkUnload} is true:
- cancel the event
- on skript start:
- delete {Scatter.DisableChunkUnloading}
- on login:
- if {ScatterScheduler::%player%} is set:
- wait 5 ticks
- broadcast "{@P}{@H} %event-player%{@C} was late scattered!"
- teleport player to {ScatterScheduler::%player%}
- wait 1 tick
- delete {ScatterSchedule::%event-player%}
Add Comment
Please, Sign In to add comment