Zeldaboy111

Bugs fixen ]|[ Skript #418

May 23rd, 2021
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.58 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. if {_target} is not a dropped item:
  104. if {_target} is not experience orb:
  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 9
  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 10
  169. set {_rng} to 3
  170. if {_rng} is 0, 1 or 2:
  171. circle(location of {_boss}, 3, 4, skeleton)
  172. else if {_rng} is 3 or 4:
  173. set {_target} to getRandomTarget({_boss}, 17)
  174. if {_target} is set:
  175. shootArrows({_boss}, random integer between 4 and 7, {_target})
  176. wait 40 ticks
  177.  
  178. function shootArrows(boss: Entity, arrowAmount: Number, target: Entity):
  179. loop {_arrowAmount} times:
  180. if {_boss} is alive:
  181. if {_target} is alive:
  182. if distance between {_boss} and {_target} <= 17:
  183. set {_v} to vector from {_boss} to location of {_target}
  184. make {_boss} shoot arrow at speed 1 {_v}
  185. wait "%random integer between 5 and 9% ticks" parsed as a timespan
  186.  
  187. on inventory click:
  188. if inventory name of player's current inventory is "{@bossGuiName}":
  189. cancel event
  190. if clicked item is {zombieBossItem}:
  191. summonZombieBoss(location of player)
  192. close inventory of player
  193. else if clicked item is {skeletonBossItem}:
  194. summonSkeletonBoss(location of player)
  195. close inventory of player
  196. else if clicked item is {blazeBossItem}:
  197. send "BLAZE"
  198. close inventory of player
  199. else if clicked item is {shamanBossItem}:
  200. send "SHAMAN"
  201. close inventory of player
  202.  
  203.  
  204. on inventory close:
  205. delete {boss.currentInventory.%player%}
  206. on inventory drag:
  207. if {boss.currentInventory.%player%} is true:
  208. cancel event
  209.  
  210. on quit:
  211. delete {boss.currentInventory.%player%}
  212.  
  213. on damage:
  214. if damage cause is fall:
  215. if {%victim%.hasUsedJumpAbility} is true:
  216. delete {%victim%.hasUsedJumpAbility}
  217. loop all entities in radius 4.6 around victim:
  218. if loop-entity is not victim:
  219. damage loop-entity by 4.6/(distance between location of loop-entity and location of victim)
  220. cancel event
  221.  
Advertisement
Add Comment
Please, Sign In to add comment