Zeldaboy111

Jump ]|[ Skript #412

May 2nd, 2021
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.94 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.  
  7. options:
  8. logo: &4&lBoss&8:&7
  9. bossGuiName: Bosses
  10. zombieBossItem: zombie head named "&aZombie Boss" with lore "&8", " &7Click to summon" and " &7the Zombie Boss."
  11. skeletonBossItem: skeleton head named "&fSkeleton Boss" with lore "&8", " &7Click to summon" and " &7the Skeleton Boss."
  12. blazeBossItem: blaze rod named "&cSkeleton Boss" with lore "&8", " &7Click to summon" and " &7the Blaze Boss."
  13. shamanBossItem: stick named "&2Skeleton Boss" with lore "&8", " &7Click to summon" and " &7the Shaman Boss."
  14. permission: "boss.*"
  15.  
  16. function getNewLocation(location: Location, offset: Number, direction: Integer) :: Location:
  17. if {_direction} is 0:
  18. set {_location} to location {_offset} meters northeast of {_location}
  19. else if {_direction} is 1:
  20. set {_location} to location {_offset} meters northwest of {_location}
  21. else if {_direction} is 2:
  22. set {_location} to location {_offset} meters southwest of {_location}
  23. else if {_direction} is 3:
  24. set {_location} to location {_offset} meters southeast of {_location}
  25. return {_location}
  26.  
  27. function mustUpdateDirection(input: Number, standsWithTheSameDirection: Integer, dir: Integer) :: boolean:
  28. if {_standsWithTheSameDirection} < 1:
  29. set {_standsWithTheSameDirection} to 1
  30. while {_input} >= {_standsWithTheSameDirection}:
  31. remove {_standsWithTheSameDirection} from {_input}
  32. if {_input} is 0:
  33. return true
  34. return false
  35.  
  36. function getNewDirection(dir: Integer) :: integer:
  37. add 1 to {_dir}
  38. if {_dir} is 4:
  39. set {_dir} to 0
  40. return {_dir}
  41.  
  42. # Number MUST be a duplicate of four
  43. function circle(loc: location, radius: Integer, amount: Integer, entity: EntityType):
  44. set {_summonLocation} to location {_radius} meters north of {_loc}
  45. set {_standsWithTheSameDirection} to {_amount}/4
  46. set {_distanceBetweenStands} to {_radius}/{_standsWithTheSameDirection}
  47. set {_dir} to 2
  48. summon {_entity} at {_summonLocation}
  49. loop {_amount} -1 times:
  50. set {_summonLocation} to getNewLocation({_summonLocation}, {_distanceBetweenStands}, {_dir})
  51. if mustUpdateDirection(loop-value, "%{_standsWithTheSameDirection}%" parsed as an integer, {_dir}) is true:
  52. set {_dir} to getNewDirection({_dir})
  53. summon {_entity} at {_summonLocation}
  54. set display name of last spawned armor stand to "%loop-value%: %{_dir}%"
  55.  
  56. command /boss:
  57. trigger:
  58. if executor is not player:
  59. send "{@logo} This command can only be executed by a player."
  60. else if player doesn't have permission {@permission}:
  61. send "{@logo} You do not have enough permissions to do this."
  62. else:
  63. open chest with 3 rows named "{@bossGuiName}" to player
  64. loop 10 times:
  65. set slot loop-value - 1 of player's current inventory to gray stained glass pane named "&k"
  66. set slot 26 - loop-value - 1 of player's current inventory to gray stained glass pane named "&k"
  67.  
  68. set slot 10 of player's current inventory to {@zombieBossItem}
  69. set slot 11 of player's current inventory to {@skeletonBossItem}
  70. set slot 12 of player's current inventory to {@blazeBossItem}
  71. set slot 13 of player's current inventory to {@shamanBossItem}
  72. set {boss.currentInventory.%player%} to true
  73.  
  74. #
  75. # B o s s e s
  76. #
  77.  
  78. function getRandomTarget(boss: Entity, radius: Number) :: Entity:
  79. # Doesn't use the correct radius, check for radius
  80. set {_players::*} to all players in radius {_radius} around {_boss}
  81. # death-loop (is var. is none, no stopping of the while-loop)
  82. while {_players::*} is not empty:
  83. set {_p} to random element out of {_players::*}
  84. remove {_p} from {_players::*}
  85. if gamemode of {_p} is survival or adventure:
  86. return {_p}
  87. else if {_p} is not set:
  88. clear {_players::*}
  89.  
  90. set {_entities::*} to all entities in radius {_radius} around {_boss}
  91. set {_e} to random element out of {_entities::*}
  92. while type of {_e} is type of {_boss}:
  93. remove {_e} from {_entities::*}
  94. if {_entities::*} is empty:
  95. return null
  96. set {_e} to random element out of {_entities::*}
  97. return {_e}
  98.  
  99. function summonZombieBoss(location: Location):
  100. set {_zombie} to zombie
  101. summon {_zombie} at {_location}
  102. set {_zombie} to last spawned zombie
  103. set display name of {_zombie} to "&a&lZombie Boss"
  104. set custom name visibility of {_zombie} to true
  105. wait 20 ticks
  106. while {_zombie} is alive:
  107. set {_rng} to random integer between 0 and 10
  108. set {_rng} to 3
  109. broadcast "RNG: %{_rng}%"
  110. if {_rng} is 0, 1 or 2:
  111. circle(location of {_zombie}, 3, 8, zombie)
  112. else if {_rng} is 3 or 4:
  113. set {_target} to getRandomTarget({_zombie}, 5)
  114. if {_target} is set:
  115. jump({_zombie}, 5, {_target})
  116. wait 40 ticks
  117.  
  118. function jump(entity: Entity, height: Number, targetLocation: Location):
  119. set {%{_entity}%.ignoreFallDamage} to true
  120. push {_entity} 1.2561 meters upwards
  121. #set {_v} to difference between location at {_targetLocation} and location at location of {_entity}
  122. set {_v} to vector from {_entity} to {_targetLocation}
  123. push {_entity} {_v}/2
  124.  
  125. on inventory click:
  126. if inventory name of player's current inventory is "{@bossGuiName}":
  127. cancel event
  128. if clicked item is {@zombieBossItem}:
  129. summonZombieBoss(location of player)
  130. close inventory of player
  131. else if clicked item is {@skeletonBossItem}:
  132. send "SKELETON"
  133. close inventory of player
  134. else if clicked item is {@blazeBossItem}:
  135. send "BLAZE"
  136. close inventory of player
  137. else if clicked item is {@shamanBossItem}:
  138. send "SHAMAN"
  139. close inventory of player
  140.  
  141.  
  142. on inventory close:
  143. delete {boss.currentInventory.%player%}
  144. on inventory drag:
  145. if {boss.currentInventory.%player%} is true:
  146. cancel event
  147.  
  148. on quit:
  149. delete {boss.currentInventory.%player%}
  150.  
  151. on damage:
  152. if damage cause is fall:
  153. if {%victim%.ignoreFallDamage} is true:
  154. delete {%victim%.ignoreFallDamage}
  155. cancel event
  156.  
Advertisement
Add Comment
Please, Sign In to add comment