Zeldaboy111

summonBoss-functie ]|[ Skript #415

May 13th, 2021
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.37 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. zombieBossItem: zombie head named "&aZombie Boss" with lore "&8", " &7Click to summon" and " &7the Zombie Boss."
  13. skeletonBossItem: skeleton head named "&fSkeleton Boss" with lore "&8", " &7Click to summon" and " &7the Skeleton Boss."
  14. blazeBossItem: blaze rod named "&cSkeleton Boss" with lore "&8", " &7Click to summon" and " &7the Blaze Boss."
  15. shamanBossItem: stick named "&2Skeleton Boss" with lore "&8", " &7Click to summon" and " &7the Shaman Boss."
  16. permission: "boss.*"
  17.  
  18. function getNewLocation(location: Location, offset: Number, direction: Integer) :: Location:
  19. if {_direction} is 0:
  20. set {_location} to location {_offset} meters northeast of {_location}
  21. else if {_direction} is 1:
  22. set {_location} to location {_offset} meters northwest of {_location}
  23. else if {_direction} is 2:
  24. set {_location} to location {_offset} meters southwest of {_location}
  25. else if {_direction} is 3:
  26. set {_location} to location {_offset} meters southeast of {_location}
  27. return {_location}
  28.  
  29. function mustUpdateDirection(input: Number, standsWithTheSameDirection: Integer, dir: Integer) :: boolean:
  30. if {_standsWithTheSameDirection} < 1:
  31. set {_standsWithTheSameDirection} to 1
  32. while {_input} >= {_standsWithTheSameDirection}:
  33. remove {_standsWithTheSameDirection} from {_input}
  34. if {_input} is 0:
  35. return true
  36. return false
  37.  
  38. function getNewDirection(dir: Integer) :: integer:
  39. add 1 to {_dir}
  40. if {_dir} is 4:
  41. set {_dir} to 0
  42. return {_dir}
  43.  
  44. # Number MUST be a duplicate of four
  45. function circle(loc: location, radius: Integer, amount: Integer, entity: EntityType):
  46. set {_summonLocation} to location {_radius} meters north of {_loc}
  47. set {_standsWithTheSameDirection} to {_amount}/4
  48. set {_distanceBetweenStands} to {_radius}/{_standsWithTheSameDirection}
  49. set {_dir} to 2
  50. summon {_entity} at {_summonLocation}
  51. loop {_amount} -1 times:
  52. set {_summonLocation} to getNewLocation({_summonLocation}, {_distanceBetweenStands}, {_dir})
  53. if mustUpdateDirection(loop-value, "%{_standsWithTheSameDirection}%" parsed as an integer, {_dir}) is true:
  54. set {_dir} to getNewDirection({_dir})
  55. summon {_entity} at {_summonLocation}
  56. set display name of last spawned armor stand to "%loop-value%: %{_dir}%"
  57.  
  58. command /boss:
  59. trigger:
  60. if executor is not player:
  61. send "{@logo} This command can only be executed by a player."
  62. else if player doesn't have permission {@permission}:
  63. send "{@logo} You do not have enough permissions to do this."
  64. else:
  65. open chest with 3 rows named "{@bossGuiName}" to player
  66. loop 10 times:
  67. set slot loop-value - 1 of player's current inventory to gray stained glass pane named "&k"
  68. set slot 26 - loop-value - 1 of player's current inventory to gray stained glass pane named "&k"
  69.  
  70. set slot 10 of player's current inventory to {@zombieBossItem}
  71. set slot 11 of player's current inventory to {@skeletonBossItem}
  72. set slot 12 of player's current inventory to {@blazeBossItem}
  73. set slot 13 of player's current inventory to {@shamanBossItem}
  74. set {boss.currentInventory.%player%} to true
  75.  
  76. #
  77. # B o s s e s
  78. #
  79.  
  80. function getRandomTarget(boss: Entity, radius: Number) :: Entity:
  81. set {_possibleTargets::*} to all players in radius {_radius} around {_boss}
  82. set {_targetsAreEntities} to false
  83. if size of {_possibleTargets::*} < 1:
  84. set {_targetsAreEntities} to true
  85. set {_possibleTargets::*} to all entities in radius {_radius} around {_boss}
  86. while {_possibleTargets::*} is not empty:
  87. set {_target} to random element out of {_possibleTargets::*}
  88. remove {_target} from {_possibleTargets::*}
  89. if {_target} is not a player:
  90. if {_target} is not {_boss}:
  91. return {_target}
  92. else if gamemode of {_target} is survival or adventure:
  93. if {_entity} is dropped item:
  94. return {_target}
  95.  
  96. set {_stopLoop} to false
  97. if {_possibleTargets::*} is empty:
  98. set {_stopLoop} to true
  99. else if {_possibleTargets::*} is not set:
  100. set {_stopLoop} to true
  101. if {_stopLoop}:
  102. if {_targetsAreEntities} is false:
  103. set {_targetsAreEntities} to true
  104. set {_possibleTargets::*} to all entities in radius {_radius} around {_boss}
  105. else:
  106. return null
  107.  
  108. function summonBoss(entityType: EntityType, location: Location, name: String, helmet: Item, chestplate: Item, leggings: Item, boots: Item, heldItem: Item, isAdult: Boolean) :: entity:
  109. set {_boss} to {_entityType}
  110. summon {_boss} at {_location}
  111. set {_boss} to last spawned entity
  112. set display name of {_boss} to "%{_name}%"
  113. set custom name visibility of {_boss} to true
  114. set helmet of {_boss} to unbreakable {_helmet}
  115. set chestplate of {_boss} to unbreakable {_chestplate}
  116. set leggings of {_boss} to unbreakable {_leggings}
  117. set boots of {_boss} to unbreakable {_boots}
  118. set held item of {_boss} to unbreakable {_heldItem}
  119. set {_boss} to adult
  120. if {_isAdult} is false:
  121. set {_boss} to baby
  122. return {_boss}
  123.  
  124. function summonZombieBoss(location: Location):
  125. set {_zombie} to summonBoss(zombie, {_location}, "&a&lZombie Boss", iron helmet, iron chestplate, iron leggings, iron boots, iron sword, true)
  126. set max health of {_zombie} to 100
  127. set health of {_zombie} to 100
  128. wait 20 ticks
  129. while {_zombie} is alive:
  130. if {%{_zombie}%.hasUsedJumpAbility} is not true:
  131. set {_rng} to random integer between 0 and 10
  132. if {_rng} is 0, 1 or 2:
  133. circle(location of {_zombie}, 3, 8, zombie)
  134. else if {_rng} is 3 or 4:
  135. set {_target} to getRandomTarget({_zombie}, 9)
  136. if {_target} is set:
  137. jump({_zombie}, 5, {_target})
  138. wait 40 ticks
  139.  
  140. function jump(entity: Entity, height: Number, targetLocation: Location):
  141. set {%{_entity}%.hasUsedJumpAbility} to true
  142. push {_entity} (direction from location of {_entity} to {_targetLocation}) at speed 0.7436
  143. push {_entity} 0.9513 meters upwards
  144.  
  145.  
  146. function summonSkeletonBoss(location: Location):
  147. # Change items and heals
  148. set {_zombie} to summonBoss(skeleton, {_location}, "&f&lSkeleton Boss", iron helmet, iron chestplate, iron leggings, iron boots, iron sword, true)
  149. set max health of {_zombie} to 100
  150. set health of {_zombie} to 100
  151. wait 20 ticks
  152.  
  153.  
  154.  
  155. on inventory click:
  156. if inventory name of player's current inventory is "{@bossGuiName}":
  157. cancel event
  158. if clicked item is {@zombieBossItem}:
  159. summonZombieBoss(location of player)
  160. close inventory of player
  161. else if clicked item is {@skeletonBossItem}:
  162. send "SKELETON"
  163. close inventory of player
  164. else if clicked item is {@blazeBossItem}:
  165. send "BLAZE"
  166. close inventory of player
  167. else if clicked item is {@shamanBossItem}:
  168. send "SHAMAN"
  169. close inventory of player
  170.  
  171.  
  172. on inventory close:
  173. delete {boss.currentInventory.%player%}
  174. on inventory drag:
  175. if {boss.currentInventory.%player%} is true:
  176. cancel event
  177.  
  178. on quit:
  179. delete {boss.currentInventory.%player%}
  180.  
  181. on damage:
  182. if damage cause is fall:
  183. if {%victim%.hasUsedJumpAbility} is true:
  184. delete {%victim%.hasUsedJumpAbility}
  185. loop all entities in radius 4.6 around victim:
  186. if loop-entity is not victim:
  187. damage loop-entity by 4.6/(distance between location of loop-entity and location of victim)
  188. cancel event
  189.  
Advertisement
Add Comment
Please, Sign In to add comment