Zeldaboy111

Shaman Boss ]|[ Skript #422

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