Zeldaboy111

Bosses af! ]|[ Skript #429

Jul 2nd, 2021
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.06 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):
  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. set metadata value "isBossMinion" of {_target} to true
  61. set helmet of last spawned entity to unbreakable skull of "MHF_%{_entity}%" parsed as an offline player
  62. loop {_amount} -1 times:
  63. set {_summonLocation} to getNewLocation({_summonLocation}, {_distanceBetweenStands}, {_dir})
  64. if mustUpdateDirection(loop-value, "%{_standsWithTheSameDirection}%" parsed as an integer, {_dir}) is true:
  65. set {_dir} to getNewDirection({_dir})
  66. summon {_entity} at {_summonLocation}
  67. set metadata value "isBossMinion" of {_target} to true
  68. set helmet of last spawned entity to unbreakable skull of "MHF_%{_entity}%" parsed as an offline player
  69. add "{ArmorDropChances:[0.0f,0.0f,0.0f,0.0f],HandDropChances:[0.0f,0.0f]}" to nbt of {_boss}
  70.  
  71.  
  72. command /boss:
  73. trigger:
  74. if executor is not player:
  75. send "{@logo} This command can only be executed by a player."
  76. else if player doesn't have permission {@permission}:
  77. send "{@logo} You do not have enough permissions to do this."
  78. else:
  79. open chest with 3 rows named "{@bossGuiName}" to player
  80. loop 10 times:
  81. set slot loop-value - 1 of player's current inventory to gray stained glass pane named "&k"
  82. set slot 26 - loop-value - 1 of player's current inventory to gray stained glass pane named "&k"
  83.  
  84. set slot 10 of player's current inventory to {zombieBossItem}
  85. set slot 11 of player's current inventory to {skeletonBossItem}
  86. set slot 12 of player's current inventory to {blazeBossItem}
  87. set slot 13 of player's current inventory to {shamanBossItem}
  88. set {boss.currentInventory.%player%} to true
  89.  
  90. #
  91. # B o s s e s
  92. #
  93.  
  94. function getRandomTarget(boss: Entity, radius: Number) :: Entity:
  95. set {_possibleTargets::*} to all players in radius {_radius} around {_boss}
  96. set {_targetsAreEntities} to false
  97. if size of {_possibleTargets::*} < 1:
  98. set {_targetsAreEntities} to true
  99. set {_possibleTargets::*} to all entities in radius {_radius} around {_boss}
  100. while {_possibleTargets::*} is not empty:
  101. set {_target} to random element out of {_possibleTargets::*}
  102. remove {_target} from {_possibleTargets::*}
  103. if {_target} is not a player:
  104. if {_target} is not {_boss}:
  105. if {_target} is not a dropped item:
  106. if {_target} is not experience orb or painting or item frame or armor stand:
  107. if "%{_target}%" does not contain "arrow":
  108. if metadata value "isBossMinion" of {_target} is not set:
  109. return {_target}
  110. if metadata value "isBossMinion" of {_target} is not true:
  111. return {_target}
  112. else if gamemode of {_target} is survival or adventure:
  113. return {_target}
  114.  
  115. set {_stopLoop} to false
  116. if {_possibleTargets::*} is empty:
  117. set {_stopLoop} to true
  118. else if {_possibleTargets::*} is not set:
  119. set {_stopLoop} to true
  120. if {_stopLoop}:
  121. if {_targetsAreEntities} is false:
  122. set {_targetsAreEntities} to true
  123. set {_possibleTargets::*} to all entities in radius {_radius} around {_boss}
  124. else:
  125. return null
  126. function damageEntitiesInRadius(location: Location, radius: Number, damage: Number, ignoreEntity: Entity):
  127. loop all entities in radius {_radius} around {_location}:
  128. if loop-entity is not {_ignoreEntity}:
  129. damage loop-entity by {_damage}/(distance between location of loop-entity and {_location})
  130.  
  131. function summonBoss(entityType: EntityType, location: Location, name: String, heldItem: Item, isAdult: Boolean) :: entity:
  132. set {_boss} to {_entityType}
  133. summon {_boss} at {_location}
  134. set {_boss} to last spawned entity
  135. set display name of {_boss} to "%{_name}%"
  136. set custom name visibility of {_boss} to true
  137. if {_entityType} is stray:
  138. set helmet of {_boss} to unbreakable skull of "12345" parsed as an offline player with nbt "{SkullOwner:{Id:""644c9bad-958b-43ce-9d2f-199d85be607c"",Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNzhkZGY3NmU1NTVkZDVjNGFhOGEwYTVmYzU4NDUyMGNkNjNkNDg5YzI1M2RlOTY5ZjdmMjJmODVhOWEyZDU2In19fQ==""}]}}}" with name "%{_name}% Trophy"
  139. else:
  140. set helmet of {_boss} to unbreakable skull of "MHF_%{_entityType}%" parsed as an offline player with name "%{_name}% Throphy"
  141. set chestplate of {_boss} to air
  142. set leggings of {_boss} to air
  143. set boots of {_boss} to air
  144. set held item of {_boss} to air
  145. add "{ArmorDropChances:[0.0f,0.0f,0.0f,1.1f],HandDropChances:[0.0f,0.0f]}" to nbt of {_boss}
  146. set {_boss} to adult
  147. if {_isAdult} is false:
  148. set {_boss} to baby
  149. return {_boss}
  150.  
  151. function summonZombieBoss(location: Location):
  152. set {_boss} to summonBoss(zombie, {_location}, "&a&lZombie Boss", iron sword, true)
  153. set max health of {_boss} to {@maxHealth_zombieBoss}
  154. set health of {_boss} to {@maxHealth_zombieBoss}
  155. wait 20 ticks
  156. while {_boss} is alive:
  157. if {%{_boss}%.hasUsedJumpAbility} is not true:
  158. set {_rng} to random integer between 0 and 6
  159. if {_rng} is 0, 1 or 2:
  160. circle(location of {_boss}, 3, 8, zombie)
  161. else if {_rng} is 3 or 4:
  162. delete {_target} # Added to resolve an issue whereas the targetted player will be targetted (even when in creative/spectator)
  163. set {_target} to getRandomTarget({_boss}, 9)
  164. if {_target} is set:
  165. jump({_boss}, 5, {_target})
  166. wait 68 ticks
  167.  
  168. function jump(entity: Entity, height: Number, targetLocation: Location):
  169. set {%{_entity}%.hasUsedJumpAbility} to true
  170. push {_entity} (direction from location of {_entity} to {_targetLocation}) at speed 0.7436
  171. push {_entity} 0.9513 meters upwards
  172.  
  173.  
  174. # Skeleton boss
  175. function summonSkeletonBoss(location: Location):
  176. set {_boss} to summonBoss(skeleton, {_location}, "&f&lSkeleton Boss", bow, true)
  177. set max health of {_boss} to {@maxHealth_skeletonBoss}
  178. set health of {_boss} to {@maxHealth_skeletonBoss}
  179. wait 20 ticks
  180. while {_boss} is alive:
  181. set {_rng} to random integer between 0 and 7
  182. delete {_target} # Added to resolve an issue whereas the targetted player will be targetted (even when in creative/spectator)
  183. if {_rng} is 0, 1 or 2:
  184. circle(location of {_boss}, 3, 4, skeleton)
  185. else if {_rng} is 3 or 4:
  186. set {_target} to getRandomTarget({_boss}, 17)
  187. if {_target} is set:
  188. shootArrows({_boss}, random integer between 4 and 7, {_target})
  189. wait 52 ticks
  190.  
  191. function shootArrows(boss: Entity, arrowAmount: Number, target: Entity):
  192. loop {_arrowAmount} times:
  193. if {_boss} is alive:
  194. if {_target} is alive:
  195. if distance between {_boss} and {_target} <= 17:
  196. set {_v} to vector from {_boss} to location of {_target}
  197. make {_boss} shoot arrow at speed 1 {_v}
  198. wait "%random integer between 5 and 9% ticks" parsed as a timespan
  199.  
  200. # Blaze boss
  201. function summonBlazeBoss(location: Location):
  202. set {_boss} to summonBoss(blaze, {_location}, "&c&lBlaze Boss", air, true)
  203. set max health of {_boss} to {@maxHealth_blazeBoss}
  204. set health of {_boss} to {@maxHealth_blazeBoss}
  205. wait 20 ticks
  206. while {_boss} is alive:
  207. set {_rng} to random integer between 0 and 8
  208. delete {_target} # Added to resolve an issue whereas the targetted player will be targetted (even when in creative/spectator)
  209. if {_rng} is 0, 1 or 2:
  210. circle(location of {_boss}, 4, 4, blaze)
  211. else if {_rng} is 3 or 4:
  212. set {_target} to getRandomTarget({_boss}, 17)
  213. if {_target} is set:
  214. summonComet({_boss}, {_target})
  215. wait 52 ticks
  216.  
  217. function summonComet(boss: Entity, target: Entity):
  218. set {_cometY::*} to 0, 0, 0, 0, 0, 0.2 and -0.2
  219. set {_cometX::*} to 0, 0.2, 0, -0.2, 0, 0 and 0
  220. set {_cometZ::*} to 0.2, 0, -0.2, 0, 0, 0 and 0
  221. loop 7 times:
  222. summon armor stand at location 10+{_cometY::%loop-value%} meters above, {_cometX::%loop-value%} meters east and {_cometZ::%loop-value%} meters south of {_target}
  223. set {_stand::%loop-value%} to last spawned armor stand
  224. set metadata value "IsCometStand" of {_stand::%loop-value%} to true
  225. set helmet of {_stand::%loop-value%} to coal block
  226. add "{Invisible:1b}" to nbt of {_stand::%loop-value%}
  227. while {_stand::1} is not on ground:
  228. wait 5 ticks
  229. set {_loc} to location of {_stand::1}
  230. loop {_stand::*}:
  231. kill loop-value
  232. damageEntitiesInRadius({_loc}, 3.9, 3.9, {_boss})
  233.  
  234. function getRandomVector() :: integers:
  235. loop 3 times:
  236. if loop-value is 1:
  237. add random integer between -1 and 0 to {_values::*}
  238. else:
  239. add random integer between -5 and 5 to {_values::*}
  240. return {_values::*}
  241.  
  242. command /fb:
  243. trigger:
  244. summonFallingBlock(player, player)
  245.  
  246. function summonFallingBlock(boss: Entity, target: Location):
  247. set {_loc} to getRandomFallingBlockLocation({_boss}, location 1 meters below {_target}, 5)
  248. set {_block} to block at {_loc}
  249. set {_valid} to true
  250. if isValidBlockLocation({_loc}, location 1 meters below {_target}) is false:
  251. set {_valid} to false
  252. set {_block} to dirt
  253. chance of 4%:
  254. set {_block} to grass block
  255. spawn falling block of {_block} at location 7 meters above {_target}
  256. set {_fallingBlock} to last spawned falling block
  257. set metadata value "IsBossFallingBlock" of {_fallingBlock} to true
  258. if {_valid}:
  259. set block at {_loc} to air
  260.  
  261. function isValidBlockLocation(location: Location, invalidLocation: Location) :: Boolean:
  262. if {_location} is {_invalidLocation}:
  263. return false
  264. else if block at {_location} is air:
  265. return false
  266. return true
  267.  
  268. function getRandomFallingBlockLocation(boss: Entity, invalidLocation: Location, retryCount: Integer) :: location:
  269. loop {_retryCount} times:
  270. set {_vector::*} to getRandomVector()
  271. set {_l} to location {_vector::1} meters north, {_vector::2} meters above and {_vector::3} meters east of {_boss}
  272. if block at {_l} is not air:
  273. if {_l} is not {_invalidLocation}:
  274. return {_l}
  275. return {_l}
  276. # Head is incorrect
  277. function summonShamanBoss(location: Location):
  278. set {_boss} to summonBoss(stray, {_location}, "&2&lShaman Boss", stick, true)
  279. set metadata value "ExcemptWolfTarget" of {_boss} to true
  280. set max health of {_boss} to {@maxHealth_shamanBoss}
  281. set health of {_boss} to {@maxHealth_shamanBoss}
  282. wait 20 ticks
  283. while {_boss} is alive:
  284. set {_rng} to random integer between 0 and 7
  285. delete {_target}
  286. if {_rng} is 0 or 1:
  287. set {_target} to getRandomTarget({_boss}, 21)
  288. if {_target} is set:
  289. circle(location of {_boss}, 4, 4, skeleton)
  290. else if {_rng} is 2 or 3:
  291. set {_target} to getRandomTarget({_boss}, 27)
  292. if {_target} is set:
  293. summonFallingBlock({_boss}, {_target})
  294. else if {_rng} is 4 or 5:
  295. if health of {_boss}+20 < max health of {_boss}:
  296. set health of {_boss} to health of {_boss}+20
  297. else:
  298. set health of {_boss} to max health of {_boss}
  299. wait 52 ticks
  300.  
  301.  
  302. on inventory click:
  303. if inventory name of player's current inventory is "{@bossGuiName}":
  304. cancel event
  305. if clicked item is {zombieBossItem}:
  306. summonZombieBoss(location of player)
  307. close inventory of player
  308. else if clicked item is {skeletonBossItem}:
  309. summonSkeletonBoss(location of player)
  310. close inventory of player
  311. else if clicked item is {blazeBossItem}:
  312. summonBlazeBoss(location of player)
  313. close inventory of player
  314. else if clicked item is {shamanBossItem}:
  315. summonShamanBoss(location of player)
  316. close inventory of player
  317.  
  318.  
  319. on inventory close:
  320. delete {boss.currentInventory.%player%}
  321. on inventory drag:
  322. if {boss.currentInventory.%player%} is true:
  323. cancel event
  324.  
  325. on quit:
  326. delete {boss.currentInventory.%player%}
  327.  
  328. on damage:
  329. if damage cause is fall:
  330. if {%victim%.hasUsedJumpAbility} is true:
  331. delete {%victim%.hasUsedJumpAbility}
  332. damageEntitiesInRadius(location of {_victim}, 4.3, 2.6, victim)
  333.  
  334. on right click on armor stand:
  335. if metadata value "IsCometStand" of clicked entity is true:
  336. cancel event
  337.  
  338. on falling block land:
  339. if metadata value "IsBossFallingBlock" of event-entity is true:
  340. clear metadata value "IsBossFallingBlock" of event-entity
  341. damageEntitiesInRadius(location of event-entity, 4.2, 3.2, event-entity)
  342.  
  343.  
Advertisement
Add Comment
Please, Sign In to add comment