Zeldaboy111

Circle Functie af! ]|[ Skript #408

Apr 18th, 2021
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.30 KB | None | 0 0
  1. # Use armor stands to create skills (i.e. comet)
  2. # Zombie boss: hordes of zombies, etc
  3. # Skeleton boss: archer, summon skeletons, shoot arrow with high damage
  4. # Blaze boss: comet/fireball, summon blazes,
  5. # Stray (shaman): holds stick, summon angry wolves,
  6.  
  7. options:
  8. logo: &4&lBoss&8:&7
  9. permission: "boss.*"
  10.  
  11. function getNewLocation(location: Location, offset: Number, direction: Integer) :: Location:
  12. if {_direction} is 0:
  13. set {_location} to location {_offset} meters northeast of {_location}
  14. else if {_direction} is 1:
  15. set {_location} to location {_offset} meters northwest of {_location}
  16. else if {_direction} is 2:
  17. set {_location} to location {_offset} meters southwest of {_location}
  18. else if {_direction} is 3:
  19. set {_location} to location {_offset} meters southeast of {_location}
  20. return {_location}
  21.  
  22. function mustUpdateDirection(input: Number, standsWithTheSameDirection: Integer, dir: Integer) :: boolean:
  23. if {_standsWithTheSameDirection} < 1:
  24. set {_standsWithTheSameDirection} to 1
  25. while {_input} >= {_standsWithTheSameDirection}:
  26. remove {_standsWithTheSameDirection} from {_input}
  27. if {_input} is 0:
  28. return true
  29. return false
  30.  
  31. function getNewDirection(dir: Integer) :: integer:
  32. add 1 to {_dir}
  33. if {_dir} is 4:
  34. set {_dir} to 0
  35. return {_dir}
  36.  
  37. # Number MUST be a duplicate of four
  38. function circle(loc: location, radius: Integer, amount: Integer, entity: EntityType):
  39. set {_summonLocation} to location {_radius} meters north of {_loc}
  40. set {_standsWithTheSameDirection} to {_amount}/4
  41. set {_distanceBetweenStands} to {_radius}/{_standsWithTheSameDirection}
  42. set {_dir} to 2
  43. summon {_entity} at {_summonLocation}
  44. loop {_amount} -1 times:
  45. set {_summonLocation} to getNewLocation({_summonLocation}, {_distanceBetweenStands}, {_dir})
  46. if mustUpdateDirection(loop-value, "%{_standsWithTheSameDirection}%" parsed as an integer, {_dir}) is true:
  47. set {_dir} to getNewDirection({_dir})
  48. summon {_entity} at {_summonLocation}
  49. set display name of last spawned armor stand to "%loop-value%: %{_dir}%"
  50.  
  51. command /boss:
  52. trigger:
  53. if executor is not player:
  54. send "{@logo} This command can only be executed by a player."
  55. else if player doesn't have permission {@permission}:
  56. send "{@logo} You do not have enough permissions to do this."
  57. else:
  58. send "BOSS"
  59.  
Advertisement
Add Comment
Please, Sign In to add comment