Zeldaboy111

Armor stand interactie ]|[ Skript #420

May 30th, 2021
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.94 KB | None | 0 0
  1. # Use armor stands to create skills (i.e. comet)
  2. # Zombie boss: hordes of zombies, leap
  3. # Skeleton boss: summon skeletons, shoot arrow with high damage
  4. # Blaze boss: comet/fireball, summon blazes,
  5. # Stray (shaman): holds stick, summon angry wolves,
  6. # Add particles & sounds
  7.  
  8.  
  9. options:
  10. logo: &4&lBoss&8:&7
  11. bossGuiName: Bosses
  12.  
  13. # Boss health
  14. maxHealth_zombieBoss: 100
  15. maxHealth_skeletonBoss: 140
  16. maxHealth_blazeBoss: 120
  17. maxHealth_shamanBoss: 110
  18.  
  19. # The permission required to execute the command '/boss'
  20. permission: "boss.*"
  21.  
  22. on enable:
  23. set {zombieBossItem} to zombie head named "&aZombie Boss" with lore " &7Health&8: &7{@maxHealth_zombieBoss}", "&8 ", " &7Click to summon" and " &7the Zombie Boss."
  24. set {skeletonBossItem} to skeleton head named "&fSkeleton Boss" with lore " &7Health&8: &7{@maxHealth_skeletonBoss}", "&8 ", " &7Click to summon" and " &7the Skeleton Boss."
  25. set {blazeBossItem} to blaze rod named "&cBlaze Boss" with lore " &7Health&8: &7{@maxHealth_blazeBoss}", "&8 ", " &7Click to summon" and " &7the Blaze Boss."
  26. set {shamanBossItem} to stick named "&2Shaman Boss" with lore " &7Health&8: &7{@maxHealth_shamanBoss}", "&8 ", " &7Click to summon" and " &7the Shaman Boss."
  27.  
  28.  
  29.  
  30. function getNewLocation(location: Location, offset: Number, direction: Integer) :: Location:
  31. if {_direction} is 0:
  32. set {_location} to location {_offset} meters northeast of {_location}
  33. else if {_direction} is 1:
  34. set {_location} to location {_offset} meters northwest of {_location}
  35. else if {_direction} is 2:
  36. set {_location} to location {_offset} meters southwest of {_location}
  37. else if {_direction} is 3:
  38. set {_location} to location {_offset} meters southeast of {_location}
  39. return {_location}
  40.  
  41. function mustUpdateDirection(input: Number, standsWithTheSameDirection: Integer, dir: Integer) :: boolean:
  42. if {_standsWithTheSameDirection} < 1:
  43. set {_standsWithTheSameDirection} to 1
  44. while {_input} >= {_standsWithTheSameDirection}:
  45. remove {_standsWithTheSameDirection} from {_input}
  46. if {_input} is 0:
  47. return true
  48. return false
  49.  
  50. function getNewDirection(dir: Integer) :: integer:
  51. add 1 to {_dir}
  52. if {_dir} is 4:
  53. set {_dir} to 0
  54. return {_dir}
  55.  
  56. # Number MUST be a duplicate of four
  57. function circle(loc: location, radius: Integer, amount: Integer, entity: EntityType):
  58. set {_summonLocation} to location {_radius} meters north of {_loc}
  59. set {_standsWithTheSameDirection} to {_amount}/4
  60. set {_distanceBetweenStands} to {_radius}/{_standsWithTheSameDirection}
  61. set {_dir} to 2
  62. summon {_entity} at {_summonLocation}
  63. loop {_amount} -1 times:
  64. set {_summonLocation} to getNewLocation({_summonLocation}, {_distanceBetweenStands}, {_dir})
  65. if mustUpdateDirection(loop-value, "%{_standsWithTheSameDirection}%" parsed as an integer, {_dir}) is true:
  66. set {_dir} to getNewDirection({_dir})
  67. summon {_entity} at {_summonLocation}
  68. set display name of last spawned armor stand to "%loop-value%: %{_dir}%"
  69.  
  70. command /boss:
  71. trigger:
  72. if executor is not player:
  73. send "{@logo} This command can only be executed by a player."
  74. else if player doesn't have permission {@permission}:
  75. send "{@logo} You do not have enough permissions to do this."
  76. else:
  77. open chest with 3 rows named "{@bossGuiName}" to player
  78. loop 10 times:
  79. set slot loop-value - 1 of player's current inventory to gray stained glass pane named "&k"
  80. set slot 26 - loop-value - 1 of player's current inventory to gray stained glass pane named "&k"
  81.  
  82. set slot 10 of player's current inventory to {zombieBossItem}
  83. set slot 11 of player's current inventory to {skeletonBossItem}
  84. set slot 12 of player's current inventory to {blazeBossItem}
  85. set slot 13 of player's current inventory to {shamanBossItem}
  86. set {boss.currentInventory.%player%} to true
  87.  
  88. #
  89. # B o s s e s
  90. #
  91.  
  92. function getRandomTarget(boss: Entity, radius: Number) :: Entity:
  93. set {_possibleTargets::*} to all players in radius {_radius} around {_boss}
  94. set {_targetsAreEntities} to false
  95. if size of {_possibleTargets::*} < 1:
  96. set {_targetsAreEntities} to true
  97. set {_possibleTargets::*} to all entities in radius {_radius} around {_boss}
  98. while {_possibleTargets::*} is not empty:
  99. set {_target} to random element out of {_possibleTargets::*}
  100. remove {_target} from {_possibleTargets::*}
  101. if {_target} is not a player:
  102. if {_target} is not {_boss}:
  103. if {_target} is not a dropped item:
  104. if {_target} is not experience orb or painting or item frame or armor stand:
  105. if "%{_target}%" does not contain "arrow":
  106. return {_target}
  107. else if gamemode of {_target} is survival or adventure:
  108. return {_target}
  109.  
  110. set {_stopLoop} to false
  111. if {_possibleTargets::*} is empty:
  112. set {_stopLoop} to true
  113. else if {_possibleTargets::*} is not set:
  114. set {_stopLoop} to true
  115. if {_stopLoop}:
  116. if {_targetsAreEntities} is false:
  117. set {_targetsAreEntities} to true
  118. set {_possibleTargets::*} to all entities in radius {_radius} around {_boss}
  119. else:
  120. return null
  121.  
  122. function summonBoss(entityType: EntityType, location: Location, name: String, heldItem: Item, isAdult: Boolean) :: entity:
  123. set {_boss} to {_entityType}
  124. summon {_boss} at {_location}
  125. set {_boss} to last spawned entity
  126. set display name of {_boss} to "%{_name}%"
  127. set custom name visibility of {_boss} to true
  128. set helmet of {_boss} to unbreakable skull of "MHF_%{_entityType}%" parsed as an offline player with name "%{_name}% Throphy"
  129. set chestplate of {_boss} to air
  130. set leggings of {_boss} to air
  131. set boots of {_boss} to air
  132. set held item of {_boss} to air
  133. add "{ArmorDropChances:[0.0f,0.0f,0.0f,1.1f],HandDropChances:[0.0f,0.0f]}" to nbt of {_boss}
  134. set {_boss} to adult
  135. if {_isAdult} is false:
  136. set {_boss} to baby
  137. return {_boss}
  138.  
  139. function summonZombieBoss(location: Location):
  140. set {_boss} to summonBoss(zombie, {_location}, "&a&lZombie Boss", iron sword, true)
  141. set max health of {_boss} to {@maxHealth_zombieBoss}
  142. set health of {_boss} to {@maxHealth_zombieBoss}
  143. wait 20 ticks
  144. while {_boss} is alive:
  145. if {%{_boss}%.hasUsedJumpAbility} is not true:
  146. set {_rng} to random integer between 0 and 6
  147. if {_rng} is 0, 1 or 2:
  148. circle(location of {_boss}, 3, 8, zombie)
  149. else if {_rng} is 3 or 4:
  150. set {_target} to getRandomTarget({_boss}, 9)
  151. if {_target} is set:
  152. jump({_boss}, 5, {_target})
  153. wait 47 ticks
  154.  
  155. function jump(entity: Entity, height: Number, targetLocation: Location):
  156. set {%{_entity}%.hasUsedJumpAbility} to true
  157. push {_entity} (direction from location of {_entity} to {_targetLocation}) at speed 0.7436
  158. push {_entity} 0.9513 meters upwards
  159.  
  160.  
  161. # Skeleton boss
  162. function summonSkeletonBoss(location: Location):
  163. set {_boss} to summonBoss(skeleton, {_location}, "&f&lSkeleton Boss", bow, true)
  164. set max health of {_boss} to {@maxHealth_skeletonBoss}
  165. set health of {_boss} to {@maxHealth_skeletonBoss}
  166. wait 20 ticks
  167. while {_boss} is alive:
  168. set {_rng} to random integer between 0 and 7
  169. if {_rng} is 0, 1 or 2:
  170. circle(location of {_boss}, 3, 4, skeleton)
  171. else if {_rng} is 3 or 4:
  172. set {_target} to getRandomTarget({_boss}, 17)
  173. if {_target} is set:
  174. shootArrows({_boss}, random integer between 4 and 7, {_target})
  175. wait 40 ticks
  176.  
  177. function shootArrows(boss: Entity, arrowAmount: Number, target: Entity):
  178. loop {_arrowAmount} times:
  179. if {_boss} is alive:
  180. if {_target} is alive:
  181. if distance between {_boss} and {_target} <= 17:
  182. set {_v} to vector from {_boss} to location of {_target}
  183. make {_boss} shoot arrow at speed 1 {_v}
  184. wait "%random integer between 5 and 9% ticks" parsed as a timespan
  185.  
  186. # Blaze boss
  187. function summonBlazeBoss(location: Location):
  188. set {_boss} to summonBoss(blaze, {_location}, "&c&lBlaze Boss", air, true)
  189. set max health of {_boss} to {@maxHealth_blazeBoss}
  190. set health of {_boss} to {@maxHealth_blazeBoss}
  191. wait 20 ticks
  192. while {_boss} is alive:
  193. set {_rng} to random integer between 0 and 8
  194. set {_rng} to 3
  195. if {_rng} is 0, 1 or 2:
  196. circle(location of {_boss}, 4, 4, blaze)
  197. else if {_rng} is 3 or 4:
  198. set {_target} to getRandomTarget({_boss}, 17)
  199. if {_target} is set:
  200. summonComet({_boss}, {_target})
  201. wait 40 ticks
  202.  
  203. command /comet:
  204. trigger:
  205. summonComet(player, player)
  206.  
  207. function summonComet(boss: Entity, target: Entity):
  208. set {_cometY::*} to 0, 0, 0, 0 and 0.2
  209. set {_cometX::*} to 0, 0.2, 0, -0.2 and 0
  210. set {_cometZ::*} to 0.2, 0, -0.2, 0 and 0
  211. loop 5 times:
  212. summon armor stand at location 10+{_cometY::%loop-value%} meters above, {_cometX::%loop-value%} meters east and {_cometZ::%loop-value%} meters south of {_target}
  213. set {_stand::%loop-value%} to last spawned armor stand
  214. set metadata value "IsCometStand" of {_stand::%loop-value%} to true
  215. set helmet of {_stand::%loop-value%} to coal block
  216. #set visibility of target entity to false
  217.  
  218.  
  219. on inventory click:
  220. if inventory name of player's current inventory is "{@bossGuiName}":
  221. cancel event
  222. if clicked item is {zombieBossItem}:
  223. summonZombieBoss(location of player)
  224. close inventory of player
  225. else if clicked item is {skeletonBossItem}:
  226. summonSkeletonBoss(location of player)
  227. close inventory of player
  228. else if clicked item is {blazeBossItem}:
  229. summonBlazeBoss(location of player)
  230. close inventory of player
  231. else if clicked item is {shamanBossItem}:
  232. send "SHAMAN"
  233. close inventory of player
  234.  
  235.  
  236. on inventory close:
  237. delete {boss.currentInventory.%player%}
  238. on inventory drag:
  239. if {boss.currentInventory.%player%} is true:
  240. cancel event
  241.  
  242. on quit:
  243. delete {boss.currentInventory.%player%}
  244.  
  245. on damage:
  246. if damage cause is fall:
  247. if {%victim%.hasUsedJumpAbility} is true:
  248. delete {%victim%.hasUsedJumpAbility}
  249. loop all entities in radius 4.3 around victim:
  250. if loop-entity is not victim:
  251. damage loop-entity by 4.3/(distance between location of loop-entity and location of victim)
  252. cancel event
  253.  
  254. on right click on armor stand:
  255. if metadata value "IsCometStand" of clicked entity is true:
  256. cancel event
  257.  
Advertisement
Add Comment
Please, Sign In to add comment