Zeldaboy111

Circle Functie ]|[ Skript #403

Apr 1st, 2021
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 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. function getNewLocation(location: Location, offset: Number, direction: Integer) :: Location:
  8. if {_direction} is 0:
  9. set {_location} to location {_offset} meters northeast of {_location}
  10. else if {_direction} is 1:
  11. set {_location} to location {_offset} meters northwest of {_location}
  12. else if {_direction} is 2:
  13. set {_location} to location {_offset} meters southwest of {_location}
  14. else if {_direction} is 3:
  15. set {_location} to location {_offset} meters southeast of {_location}
  16. return {_location}
  17.  
  18. function getIntegerAsDirection(input: Integer, standAmount: Integer) :: Integer:
  19. # Location incorrect with a different number than four stands
  20. while {_input} >= {_standAmount}/4:
  21. remove {_standAmount}/4 from {_input}
  22. return {_input} parsed as an integer
  23.  
  24. function circle(loc: location, radius: Integer, amount: Integer, entity: EntityType):
  25. set {_distance} to {_radius} / {_amount} * 2 + 1
  26. broadcast "%{_distance}%"
  27. set {_startLocation} to location {_distance} meters north of {_loc}
  28.  
  29. loop {_amount} times:
  30. if loop-value > 1:
  31. set {_i} to getIntegerAsDirection("%loop-value%" parsed as an integer, {_amount})
  32. set {_startLocation} to getNewLocation({_startLocation}, {_distance}, getIntegerAsDirection("%loop-value%" parsed as an integer, {_amount}))
  33. summon {_entity} at {_startLocation}
  34.  
  35. # Test commands
  36. command /circle <Integer> <Integer>:
  37. trigger:
  38. circle(location of player, argument 1, argument 2, armor stand)
  39.  
Advertisement
Add Comment
Please, Sign In to add comment