Zeldaboy111

Random Target! ]|[ Skript #411

Apr 29th, 2021
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.38 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. bossGuiName: Bosses
  10. zombieBossItem: zombie head named "&aZombie Boss" with lore "&8", " &7Click to summon" and " &7the Zombie Boss."
  11. skeletonBossItem: skeleton head named "&fSkeleton Boss" with lore "&8", " &7Click to summon" and " &7the Skeleton Boss."
  12. blazeBossItem: blaze rod named "&cSkeleton Boss" with lore "&8", " &7Click to summon" and " &7the Blaze Boss."
  13. shamanBossItem: stick named "&2Skeleton Boss" with lore "&8", " &7Click to summon" and " &7the Shaman Boss."
  14. permission: "boss.*"
  15.  
  16. function getNewLocation(location: Location, offset: Number, direction: Integer) :: Location:
  17. if {_direction} is 0:
  18. set {_location} to location {_offset} meters northeast of {_location}
  19. else if {_direction} is 1:
  20. set {_location} to location {_offset} meters northwest of {_location}
  21. else if {_direction} is 2:
  22. set {_location} to location {_offset} meters southwest of {_location}
  23. else if {_direction} is 3:
  24. set {_location} to location {_offset} meters southeast of {_location}
  25. return {_location}
  26.  
  27. function mustUpdateDirection(input: Number, standsWithTheSameDirection: Integer, dir: Integer) :: boolean:
  28. if {_standsWithTheSameDirection} < 1:
  29. set {_standsWithTheSameDirection} to 1
  30. while {_input} >= {_standsWithTheSameDirection}:
  31. remove {_standsWithTheSameDirection} from {_input}
  32. if {_input} is 0:
  33. return true
  34. return false
  35.  
  36. function getNewDirection(dir: Integer) :: integer:
  37. add 1 to {_dir}
  38. if {_dir} is 4:
  39. set {_dir} to 0
  40. return {_dir}
  41.  
  42. # Number MUST be a duplicate of four
  43. function circle(loc: location, radius: Integer, amount: Integer, entity: EntityType):
  44. set {_summonLocation} to location {_radius} meters north of {_loc}
  45. set {_standsWithTheSameDirection} to {_amount}/4
  46. set {_distanceBetweenStands} to {_radius}/{_standsWithTheSameDirection}
  47. set {_dir} to 2
  48. summon {_entity} at {_summonLocation}
  49. loop {_amount} -1 times:
  50. set {_summonLocation} to getNewLocation({_summonLocation}, {_distanceBetweenStands}, {_dir})
  51. if mustUpdateDirection(loop-value, "%{_standsWithTheSameDirection}%" parsed as an integer, {_dir}) is true:
  52. set {_dir} to getNewDirection({_dir})
  53. summon {_entity} at {_summonLocation}
  54. set display name of last spawned armor stand to "%loop-value%: %{_dir}%"
  55.  
  56. command /boss:
  57. trigger:
  58. if executor is not player:
  59. send "{@logo} This command can only be executed by a player."
  60. else if player doesn't have permission {@permission}:
  61. send "{@logo} You do not have enough permissions to do this."
  62. else:
  63. open chest with 3 rows named "{@bossGuiName}" to player
  64. loop 10 times:
  65. set slot loop-value - 1 of player's current inventory to gray stained glass pane named "&k"
  66. set slot 26 - loop-value - 1 of player's current inventory to gray stained glass pane named "&k"
  67.  
  68. set slot 10 of player's current inventory to {@zombieBossItem}
  69. set slot 11 of player's current inventory to {@skeletonBossItem}
  70. set slot 12 of player's current inventory to {@blazeBossItem}
  71. set slot 13 of player's current inventory to {@shamanBossItem}
  72. set {boss.currentInventory.%player%} to true
  73.  
  74. #
  75. # B o s s e s
  76. #
  77.  
  78. function getRandomTarget(boss: Entity, radius: Number) :: Entity:
  79. # Doesn't use the correct radius, check for radius
  80. set {_players::*} to all players in radius {_radius} around {_boss}
  81. if {_players::*} is not empty:
  82. return random element out of {_players::*}
  83. else:
  84. set {_entities::*} to all entities in radius {_radius} around {_boss}
  85. set {_e} to random element out of {_entities::*}
  86. while type of {_e} is type of {_boss}:
  87. remove {_e} from {_entities::*}
  88. if {_entities::*} is empty:
  89. return null
  90. set {_e} to random element out of {_entities::*}
  91. return {_e}
  92.  
  93. function summonZombieBoss(location: Location):
  94. set {_zombie} to zombie
  95. summon {_zombie} at {_location}
  96. set {_zombie} to last spawned zombie
  97. set display name of {_zombie} to "&a&lZombie Boss"
  98. set custom name visibility of {_zombie} to true
  99. wait 20 ticks
  100. while {_zombie} is alive:
  101. set {_rng} to random integer between 0 and 10
  102. set {_rng} to 3
  103. broadcast "RNG: %{_rng}%"
  104. if {_rng} is 0, 1 or 2:
  105. circle(location of {_zombie}, 3, 8, zombie)
  106. else if {_rng} is 3 or 4:
  107. set {_target} to getRandomTarget({_zombie}, 5)
  108. if {_target} is set:
  109. jump({_zombie}, 5, {_target})
  110. wait 40 ticks
  111.  
  112. function jump(entity: Entity, height: Number, targetLocation: Location):
  113. teleport {_entity} to {_targetLocation}
  114.  
  115.  
  116. on inventory click:
  117. if inventory name of player's current inventory is "{@bossGuiName}":
  118. cancel event
  119. if clicked item is {@zombieBossItem}:
  120. summonZombieBoss(location of player)
  121. close inventory of player
  122. else if clicked item is {@skeletonBossItem}:
  123. send "SKELETON"
  124. close inventory of player
  125. else if clicked item is {@blazeBossItem}:
  126. send "BLAZE"
  127. close inventory of player
  128. else if clicked item is {@shamanBossItem}:
  129. send "SHAMAN"
  130. close inventory of player
  131.  
  132.  
  133. on inventory close:
  134. delete {boss.currentInventory.%player%}
  135. on inventory drag:
  136. if {boss.currentInventory.%player%} is true:
  137. cancel event
  138.  
  139. on quit:
  140. delete {boss.currentInventory.%player%}
  141.  
Advertisement
Add Comment
Please, Sign In to add comment