Zeldaboy111

Skeleton Boss! ]|[ Skript #416

May 16th, 2021
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.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. # 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. return {_target}
  104. else if gamemode of {_target} is survival or adventure:
  105. if {_entity} is dropped item:
  106. return {_target}
  107.  
  108. set {_stopLoop} to false
  109. if {_possibleTargets::*} is empty:
  110. set {_stopLoop} to true
  111. else if {_possibleTargets::*} is not set:
  112. set {_stopLoop} to true
  113. if {_stopLoop}:
  114. if {_targetsAreEntities} is false:
  115. set {_targetsAreEntities} to true
  116. set {_possibleTargets::*} to all entities in radius {_radius} around {_boss}
  117. else:
  118. return null
  119.  
  120. function summonBoss(entityType: EntityType, location: Location, name: String, helmet: Item, chestplate: Item, leggings: Item, boots: Item, heldItem: Item, isAdult: Boolean) :: entity:
  121. set {_boss} to {_entityType}
  122. summon {_boss} at {_location}
  123. set {_boss} to last spawned entity
  124. set display name of {_boss} to "%{_name}%"
  125. set custom name visibility of {_boss} to true
  126. set helmet of {_boss} to unbreakable {_helmet}
  127. set chestplate of {_boss} to unbreakable {_chestplate}
  128. set leggings of {_boss} to unbreakable {_leggings}
  129. set boots of {_boss} to unbreakable {_boots}
  130. set held item of {_boss} to unbreakable {_heldItem}
  131. set {_boss} to adult
  132. if {_isAdult} is false:
  133. set {_boss} to baby
  134. return {_boss}
  135.  
  136. function summonZombieBoss(location: Location):
  137. set {_boss} to summonBoss(zombie, {_location}, "&a&lZombie Boss", iron helmet, iron chestplate, iron leggings, iron boots, iron sword, true)
  138. set max health of {_boss} to {@maxHealth_zombieBoss}
  139. set health of {_boss} to {@maxHealth_zombieBoss}
  140. wait 20 ticks
  141. while {_boss} is alive:
  142. if {%{_boss}%.hasUsedJumpAbility} is not true:
  143. set {_rng} to random integer between 0 and 9
  144. if {_rng} is 0, 1 or 2:
  145. circle(location of {_boss}, 3, 8, zombie)
  146. else if {_rng} is 3 or 4:
  147. set {_target} to getRandomTarget({_boss}, 9)
  148. if {_target} is set:
  149. jump({_boss}, 5, {_target})
  150. wait 47 ticks
  151.  
  152. function jump(entity: Entity, height: Number, targetLocation: Location):
  153. set {%{_entity}%.hasUsedJumpAbility} to true
  154. push {_entity} (direction from location of {_entity} to {_targetLocation}) at speed 0.7436
  155. push {_entity} 0.9513 meters upwards
  156.  
  157.  
  158. # Skeleton boss
  159. function summonSkeletonBoss(location: Location):
  160. # Change items and heals
  161. set {_boss} to summonBoss(skeleton, {_location}, "&f&lSkeleton Boss", iron helmet, iron chestplate, iron leggings, iron boots, iron sword, true)
  162. set max health of {_boss} to {@maxHealth_skeletonBoss}
  163. set health of {_boss} to {@maxHealth_skeletonBoss}
  164. wait 20 ticks
  165. while {_boss} is alive:
  166. set {_rng} to random integer between 0 and 10
  167. if {_rng} is 0, 1 or 2:
  168. circle(location of {_boss}, 3, 4, skeleton)
  169. else if {_rng} is 3 or 4:
  170. set {_target} to getRandomTarget({_boss}, 17)
  171. if {_target} is set:
  172. shootArrows({_boss}, random integer between 4 and 7, {_target})
  173. wait 40 ticks
  174.  
  175. function shootArrows(boss: Entity, arrowAmount: Number, targetLocation: Location):
  176. # Shoots and arrow in the direction of {_targetLocation} {_arrowAmount} times with a delay between each arrow
  177.  
  178.  
  179. on inventory click:
  180. if inventory name of player's current inventory is "{@bossGuiName}":
  181. cancel event
  182. if clicked item is {zombieBossItem}:
  183. summonZombieBoss(location of player)
  184. close inventory of player
  185. else if clicked item is {skeletonBossItem}:
  186. summonSkeletonBoss(location of player)
  187. close inventory of player
  188. else if clicked item is {blazeBossItem}:
  189. send "BLAZE"
  190. close inventory of player
  191. else if clicked item is {shamanBossItem}:
  192. send "SHAMAN"
  193. close inventory of player
  194.  
  195.  
  196. on inventory close:
  197. delete {boss.currentInventory.%player%}
  198. on inventory drag:
  199. if {boss.currentInventory.%player%} is true:
  200. cancel event
  201.  
  202. on quit:
  203. delete {boss.currentInventory.%player%}
  204.  
  205. on damage:
  206. if damage cause is fall:
  207. if {%victim%.hasUsedJumpAbility} is true:
  208. delete {%victim%.hasUsedJumpAbility}
  209. loop all entities in radius 4.6 around victim:
  210. if loop-entity is not victim:
  211. damage loop-entity by 4.6/(distance between location of loop-entity and location of victim)
  212. cancel event
  213.  
Advertisement
Add Comment
Please, Sign In to add comment