Zeldaboy111

Circle Functie ]|[ Skript #404

Apr 4th, 2021
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 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: Number) :: 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) :: Number:
  19. # Location incorrect with a different number than four stands
  20. set {_value} to {_input} / (4/{_standAmount})
  21. while {_value} >= 4:
  22. remove 4 from {_value}
  23. #broadcast "%{_value} parsed as an integer%"
  24. return {_value}
  25. #return ({_input} / (4/{_standAmount})) parsed as an integereger
  26. #return ({_input} / {_standAmount}) parsed as an integer
  27. #while {_input} >= {_standAmount}/4:
  28. # remove {_standAmount}/4 from {_input}
  29. #return {_input} parsed as an integer
  30.  
  31. function circle(loc: location, radius: Integer, amount: Integer, entity: EntityType):
  32. set {_distance} to {_radius} / {_amount} * 2 + 1
  33. #broadcast "%{_distance}%"
  34. #set {_startLocation} to location {_distance} meters north of {_loc}
  35. set {_startLocation} to {_loc}
  36. loop {_amount} times:
  37. #if loop-value > 1:
  38. set {_i} to getIntegerAsDirection("%loop-value%" parsed as an integer, {_amount})
  39. broadcast "%{_i}%"
  40. set {_startLocation} to getNewLocation({_startLocation}, {_distance}, getIntegerAsDirection("%loop-value%" parsed as an integer, {_amount}))
  41. summon {_entity} at {_startLocation}
  42.  
  43. # Test commands
  44. command /circle <Integer> <Integer>:
  45. trigger:
  46. circle(location of player, argument 1, argument 2, armor stand)
  47.  
Advertisement
Add Comment
Please, Sign In to add comment