Zeldaboy111

Comet af! ]|[ Skript #421

Jun 3rd, 2021
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.64 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. function damageEntitiesInRadius(location: Location, radius: Number, damage: Number, ignoreEntity: Entity):
  122. loop all entities in radius {_radius} around {_location}:
  123. if loop-entity is not {_ignoreEntity}:
  124. damage loop-entity by {_damage}/(distance between location of loop-entity and {_location})
  125.  
  126. function summonBoss(entityType: EntityType, location: Location, name: String, heldItem: Item, isAdult: Boolean) :: entity:
  127. set {_boss} to {_entityType}
  128. summon {_boss} at {_location}
  129. set {_boss} to last spawned entity
  130. set display name of {_boss} to "%{_name}%"
  131. set custom name visibility of {_boss} to true
  132. set helmet of {_boss} to unbreakable skull of "MHF_%{_entityType}%" parsed as an offline player with name "%{_name}% Throphy"
  133. set chestplate of {_boss} to air
  134. set leggings of {_boss} to air
  135. set boots of {_boss} to air
  136. set held item of {_boss} to air
  137. add "{ArmorDropChances:[0.0f,0.0f,0.0f,1.1f],HandDropChances:[0.0f,0.0f]}" to nbt of {_boss}
  138. set {_boss} to adult
  139. if {_isAdult} is false:
  140. set {_boss} to baby
  141. return {_boss}
  142.  
  143. function summonZombieBoss(location: Location):
  144. set {_boss} to summonBoss(zombie, {_location}, "&a&lZombie Boss", iron sword, true)
  145. set max health of {_boss} to {@maxHealth_zombieBoss}
  146. set health of {_boss} to {@maxHealth_zombieBoss}
  147. wait 20 ticks
  148. while {_boss} is alive:
  149. if {%{_boss}%.hasUsedJumpAbility} is not true:
  150. set {_rng} to random integer between 0 and 6
  151. if {_rng} is 0, 1 or 2:
  152. circle(location of {_boss}, 3, 8, zombie)
  153. else if {_rng} is 3 or 4:
  154. delete {_target} # Added to resolve an issue whereas the targetted player will be targetted (even when in creative/spectator)
  155. set {_target} to getRandomTarget({_boss}, 9)
  156. if {_target} is set:
  157. jump({_boss}, 5, {_target})
  158. wait 47 ticks
  159.  
  160. function jump(entity: Entity, height: Number, targetLocation: Location):
  161. set {%{_entity}%.hasUsedJumpAbility} to true
  162. push {_entity} (direction from location of {_entity} to {_targetLocation}) at speed 0.7436
  163. push {_entity} 0.9513 meters upwards
  164.  
  165.  
  166. # Skeleton boss
  167. function summonSkeletonBoss(location: Location):
  168. set {_boss} to summonBoss(skeleton, {_location}, "&f&lSkeleton Boss", bow, true)
  169. set max health of {_boss} to {@maxHealth_skeletonBoss}
  170. set health of {_boss} to {@maxHealth_skeletonBoss}
  171. wait 20 ticks
  172. while {_boss} is alive:
  173. set {_rng} to random integer between 0 and 7
  174. if {_rng} is 0, 1 or 2:
  175. circle(location of {_boss}, 3, 4, skeleton)
  176. else if {_rng} is 3 or 4:
  177. delete {_target} # Added to resolve an issue whereas the targetted player will be targetted (even when in creative/spectator)
  178. set {_target} to getRandomTarget({_boss}, 17)
  179. if {_target} is set:
  180. shootArrows({_boss}, random integer between 4 and 7, {_target})
  181. wait 40 ticks
  182.  
  183. function shootArrows(boss: Entity, arrowAmount: Number, target: Entity):
  184. loop {_arrowAmount} times:
  185. if {_boss} is alive:
  186. if {_target} is alive:
  187. if distance between {_boss} and {_target} <= 17:
  188. set {_v} to vector from {_boss} to location of {_target}
  189. make {_boss} shoot arrow at speed 1 {_v}
  190. wait "%random integer between 5 and 9% ticks" parsed as a timespan
  191.  
  192. # Blaze boss
  193. function summonBlazeBoss(location: Location):
  194. set {_boss} to summonBoss(blaze, {_location}, "&c&lBlaze Boss", air, true)
  195. set max health of {_boss} to {@maxHealth_blazeBoss}
  196. set health of {_boss} to {@maxHealth_blazeBoss}
  197. wait 20 ticks
  198. while {_boss} is alive:
  199. set {_rng} to random integer between 0 and 8
  200. set {_rng} to 3
  201. if {_rng} is 0, 1 or 2:
  202. circle(location of {_boss}, 4, 4, blaze)
  203. else if {_rng} is 3 or 4:
  204. delete {_target} # Added to resolve an issue whereas the targetted player will be targetted (even when in creative/spectator)
  205. set {_target} to getRandomTarget({_boss}, 17)
  206. if {_target} is set:
  207. summonComet({_boss}, {_target})
  208. wait 40 ticks
  209.  
  210. function summonComet(boss: Entity, target: Entity):
  211. set {_cometY::*} to 0, 0, 0, 0, 0, 0.2 and -0.2
  212. set {_cometX::*} to 0, 0.2, 0, -0.2, 0, 0 and 0
  213. set {_cometZ::*} to 0.2, 0, -0.2, 0, 0, 0 and 0
  214. loop 7 times:
  215. summon armor stand at location 10+{_cometY::%loop-value%} meters above, {_cometX::%loop-value%} meters east and {_cometZ::%loop-value%} meters south of {_target}
  216. set {_stand::%loop-value%} to last spawned armor stand
  217. set metadata value "IsCometStand" of {_stand::%loop-value%} to true
  218. set helmet of {_stand::%loop-value%} to coal block
  219. add "{Invisible:1b}" to nbt of {_stand::%loop-value%}
  220. while {_stand::1} is not on ground:
  221. wait 5 ticks
  222. set {_loc} to location of {_stand::1}
  223. loop {_stand::*}:
  224. kill loop-value
  225. damageEntitiesInRadius({_loc}, 3.9, 3.9, {_boss})
  226.  
  227. on inventory click:
  228. if inventory name of player's current inventory is "{@bossGuiName}":
  229. cancel event
  230. if clicked item is {zombieBossItem}:
  231. summonZombieBoss(location of player)
  232. close inventory of player
  233. else if clicked item is {skeletonBossItem}:
  234. summonSkeletonBoss(location of player)
  235. close inventory of player
  236. else if clicked item is {blazeBossItem}:
  237. summonBlazeBoss(location of player)
  238. close inventory of player
  239. else if clicked item is {shamanBossItem}:
  240. send "SHAMAN"
  241. close inventory of player
  242.  
  243.  
  244. on inventory close:
  245. delete {boss.currentInventory.%player%}
  246. on inventory drag:
  247. if {boss.currentInventory.%player%} is true:
  248. cancel event
  249.  
  250. on quit:
  251. delete {boss.currentInventory.%player%}
  252.  
  253. on damage:
  254. if damage cause is fall:
  255. if {%victim%.hasUsedJumpAbility} is true:
  256. delete {%victim%.hasUsedJumpAbility}
  257. damageEntitiesInRadius(location of {_victim}, 4.3, 2.6, victim)
  258.  
  259. on right click on armor stand:
  260. if metadata value "IsCometStand" of clicked entity is true:
  261. cancel event
  262.  
Advertisement
Add Comment
Please, Sign In to add comment