Zeldaboy111

Jump Ability Klaar ]|[ Skript #414

May 9th, 2021
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.13 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. return {_target}
  94.  
  95. set {_stopLoop} to false
  96. if {_possibleTargets::*} is empty:
  97. set {_stopLoop} to true
  98. else if {_possibleTargets::*} is not set:
  99. set {_stopLoop} to true
  100. if {_stopLoop}:
  101. if {_targetsAreEntities} is false:
  102. set {_targetsAreEntities} to true
  103. set {_possibleTargets::*} to all entities in radius {_radius} around {_boss}
  104. else:
  105. return null
  106.  
  107. function summonZombieBoss(location: Location):
  108. set {_zombie} to zombie
  109. summon {_zombie} at {_location}
  110. set {_zombie} to last spawned zombie
  111. set display name of {_zombie} to "&a&lZombie Boss"
  112. set custom name visibility of {_zombie} to true
  113. set helmet of {_zombie} to air
  114. set chestplate of {_zombie} to air
  115. set leggings of {_zombie} to air
  116. set boots of {_zombie} to air
  117. set held item of {_zombie} to air
  118. wait 20 ticks
  119. while {_zombie} is alive:
  120. broadcast "%{%{_entity}%.hasUsedJumpAbility}%"
  121. if {%{_zombie}%.hasUsedJumpAbility} is not true:
  122. set {_rng} to random integer between 0 and 10
  123. set {_rng} to 3
  124. broadcast "RNG: %{_rng}%"
  125. if {_rng} is 0, 1 or 2:
  126. circle(location of {_zombie}, 3, 8, zombie)
  127. else if {_rng} is 3 or 4:
  128. set {_target} to getRandomTarget({_zombie}, 9)
  129. if {_target} is set:
  130. jump({_zombie}, 5, {_target})
  131. wait 40 ticks
  132.  
  133. function jump(entity: Entity, height: Number, targetLocation: Location):
  134. set {%{_entity}%.hasUsedJumpAbility} to true
  135. push {_entity} (direction from location of {_entity} to {_targetLocation}) at speed 0.7436
  136. push {_entity} 0.9513 meters upwards
  137.  
  138. on inventory click:
  139. if inventory name of player's current inventory is "{@bossGuiName}":
  140. cancel event
  141. if clicked item is {@zombieBossItem}:
  142. summonZombieBoss(location of player)
  143. close inventory of player
  144. else if clicked item is {@skeletonBossItem}:
  145. send "SKELETON"
  146. close inventory of player
  147. else if clicked item is {@blazeBossItem}:
  148. send "BLAZE"
  149. close inventory of player
  150. else if clicked item is {@shamanBossItem}:
  151. send "SHAMAN"
  152. close inventory of player
  153.  
  154.  
  155. on inventory close:
  156. delete {boss.currentInventory.%player%}
  157. on inventory drag:
  158. if {boss.currentInventory.%player%} is true:
  159. cancel event
  160.  
  161. on quit:
  162. delete {boss.currentInventory.%player%}
  163.  
  164. on damage:
  165. if damage cause is fall:
  166. if {%victim%.hasUsedJumpAbility} is true:
  167. delete {%victim%.hasUsedJumpAbility}
  168. loop all entities in radius 4.6 around victim:
  169. if loop-entity is not victim:
  170. damage loop-entity by 4.6/(distance between location of loop-entity and location of victim)
  171. cancel event
  172. # Use armor stands to create skills (i.e. comet)
  173. # Zombie boss: hordes of zombies, etc
  174. # Skeleton boss: archer, summon skeletons, shoot arrow with high damage
  175. # Blaze boss: comet/fireball, summon blazes,
  176. # Stray (shaman): holds stick, summon angry wolves,
  177. # Add particles & sounds
  178.  
  179.  
  180. options:
  181. logo: &4&lBoss&8:&7
  182. bossGuiName: Bosses
  183. zombieBossItem: zombie head named "&aZombie Boss" with lore "&8", " &7Click to summon" and " &7the Zombie Boss."
  184. skeletonBossItem: skeleton head named "&fSkeleton Boss" with lore "&8", " &7Click to summon" and " &7the Skeleton Boss."
  185. blazeBossItem: blaze rod named "&cSkeleton Boss" with lore "&8", " &7Click to summon" and " &7the Blaze Boss."
  186. shamanBossItem: stick named "&2Skeleton Boss" with lore "&8", " &7Click to summon" and " &7the Shaman Boss."
  187. permission: "boss.*"
  188.  
  189. function getNewLocation(location: Location, offset: Number, direction: Integer) :: Location:
  190. if {_direction} is 0:
  191. set {_location} to location {_offset} meters northeast of {_location}
  192. else if {_direction} is 1:
  193. set {_location} to location {_offset} meters northwest of {_location}
  194. else if {_direction} is 2:
  195. set {_location} to location {_offset} meters southwest of {_location}
  196. else if {_direction} is 3:
  197. set {_location} to location {_offset} meters southeast of {_location}
  198. return {_location}
  199.  
  200. function mustUpdateDirection(input: Number, standsWithTheSameDirection: Integer, dir: Integer) :: boolean:
  201. if {_standsWithTheSameDirection} < 1:
  202. set {_standsWithTheSameDirection} to 1
  203. while {_input} >= {_standsWithTheSameDirection}:
  204. remove {_standsWithTheSameDirection} from {_input}
  205. if {_input} is 0:
  206. return true
  207. return false
  208.  
  209. function getNewDirection(dir: Integer) :: integer:
  210. add 1 to {_dir}
  211. if {_dir} is 4:
  212. set {_dir} to 0
  213. return {_dir}
  214.  
  215. # Number MUST be a duplicate of four
  216. function circle(loc: location, radius: Integer, amount: Integer, entity: EntityType):
  217. set {_summonLocation} to location {_radius} meters north of {_loc}
  218. set {_standsWithTheSameDirection} to {_amount}/4
  219. set {_distanceBetweenStands} to {_radius}/{_standsWithTheSameDirection}
  220. set {_dir} to 2
  221. summon {_entity} at {_summonLocation}
  222. loop {_amount} -1 times:
  223. set {_summonLocation} to getNewLocation({_summonLocation}, {_distanceBetweenStands}, {_dir})
  224. if mustUpdateDirection(loop-value, "%{_standsWithTheSameDirection}%" parsed as an integer, {_dir}) is true:
  225. set {_dir} to getNewDirection({_dir})
  226. summon {_entity} at {_summonLocation}
  227. set display name of last spawned armor stand to "%loop-value%: %{_dir}%"
  228.  
  229. command /boss:
  230. trigger:
  231. if executor is not player:
  232. send "{@logo} This command can only be executed by a player."
  233. else if player doesn't have permission {@permission}:
  234. send "{@logo} You do not have enough permissions to do this."
  235. else:
  236. open chest with 3 rows named "{@bossGuiName}" to player
  237. loop 10 times:
  238. set slot loop-value - 1 of player's current inventory to gray stained glass pane named "&k"
  239. set slot 26 - loop-value - 1 of player's current inventory to gray stained glass pane named "&k"
  240.  
  241. set slot 10 of player's current inventory to {@zombieBossItem}
  242. set slot 11 of player's current inventory to {@skeletonBossItem}
  243. set slot 12 of player's current inventory to {@blazeBossItem}
  244. set slot 13 of player's current inventory to {@shamanBossItem}
  245. set {boss.currentInventory.%player%} to true
  246.  
  247. #
  248. # B o s s e s
  249. #
  250.  
  251. function getRandomTarget(boss: Entity, radius: Number) :: Entity:
  252. set {_possibleTargets::*} to all players in radius {_radius} around {_boss}
  253. set {_targetsAreEntities} to false
  254. if size of {_possibleTargets::*} < 1:
  255. set {_targetsAreEntities} to true
  256. set {_possibleTargets::*} to all entities in radius {_radius} around {_boss}
  257. while {_possibleTargets::*} is not empty:
  258. set {_target} to random element out of {_possibleTargets::*}
  259. remove {_target} from {_possibleTargets::*}
  260. if {_target} is not a player:
  261. if {_target} is not {_boss}:
  262. return {_target}
  263. else if gamemode of {_target} is survival or adventure:
  264. return {_target}
  265.  
  266. set {_stopLoop} to false
  267. if {_possibleTargets::*} is empty:
  268. set {_stopLoop} to true
  269. else if {_possibleTargets::*} is not set:
  270. set {_stopLoop} to true
  271. if {_stopLoop}:
  272. if {_targetsAreEntities} is false:
  273. set {_targetsAreEntities} to true
  274. set {_possibleTargets::*} to all entities in radius {_radius} around {_boss}
  275. else:
  276. return null
  277.  
  278. function summonZombieBoss(location: Location):
  279. set {_zombie} to zombie
  280. summon {_zombie} at {_location}
  281. set {_zombie} to last spawned zombie
  282. set display name of {_zombie} to "&a&lZombie Boss"
  283. set custom name visibility of {_zombie} to true
  284. set helmet of {_zombie} to air
  285. set chestplate of {_zombie} to air
  286. set leggings of {_zombie} to air
  287. set boots of {_zombie} to air
  288. set held item of {_zombie} to air
  289. wait 20 ticks
  290. while {_zombie} is alive:
  291. broadcast "%{%{_entity}%.hasUsedJumpAbility}%"
  292. if {%{_zombie}%.hasUsedJumpAbility} is not true:
  293. set {_rng} to random integer between 0 and 10
  294. set {_rng} to 3
  295. broadcast "RNG: %{_rng}%"
  296. if {_rng} is 0, 1 or 2:
  297. circle(location of {_zombie}, 3, 8, zombie)
  298. else if {_rng} is 3 or 4:
  299. set {_target} to getRandomTarget({_zombie}, 9)
  300. if {_target} is set:
  301. jump({_zombie}, 5, {_target})
  302. wait 40 ticks
  303.  
  304. function jump(entity: Entity, height: Number, targetLocation: Location):
  305. set {%{_entity}%.hasUsedJumpAbility} to true
  306. push {_entity} (direction from location of {_entity} to {_targetLocation}) at speed 0.7436
  307. push {_entity} 0.9513 meters upwards
  308.  
  309. on inventory click:
  310. if inventory name of player's current inventory is "{@bossGuiName}":
  311. cancel event
  312. if clicked item is {@zombieBossItem}:
  313. summonZombieBoss(location of player)
  314. close inventory of player
  315. else if clicked item is {@skeletonBossItem}:
  316. send "SKELETON"
  317. close inventory of player
  318. else if clicked item is {@blazeBossItem}:
  319. send "BLAZE"
  320. close inventory of player
  321. else if clicked item is {@shamanBossItem}:
  322. send "SHAMAN"
  323. close inventory of player
  324.  
  325.  
  326. on inventory close:
  327. delete {boss.currentInventory.%player%}
  328. on inventory drag:
  329. if {boss.currentInventory.%player%} is true:
  330. cancel event
  331.  
  332. on quit:
  333. delete {boss.currentInventory.%player%}
  334.  
  335. on damage:
  336. if damage cause is fall:
  337. if {%victim%.hasUsedJumpAbility} is true:
  338. delete {%victim%.hasUsedJumpAbility}
  339. loop all entities in radius 4.6 around victim:
  340. if loop-entity is not victim:
  341. damage loop-entity by 4.6/(distance between location of loop-entity and location of victim)
  342. cancel event
  343.  
Advertisement
Add Comment
Please, Sign In to add comment