Ilom_uk

Timed Healing

Apr 26th, 2017
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.66 KB | None | 0 0
  1. #Skripted by /u/ilom_uk, idea taken from Certamina UHC Season 3.
  2. #Feel free to edit, but please credit me if you re-release this!
  3. #Version 1.1
  4.  
  5. options:
  6. perms: skript.op
  7. prefix: &3[&7UHC&3]&r
  8.  
  9. variables:
  10. #{timedhealing:ghead}= 8
  11. #{timedhealing:gapple}= 4
  12. {timedhealing:baseghead}= 8
  13. {timedhealing:basegapple}= 4
  14. {timedhealing}= false
  15. {timedhealing:timer}= 0
  16.  
  17. command /timedhealing [<text>] [<text>] [<integer>]:
  18. aliases: /thealing
  19. usage: /timedhealing <on:off/reset/gapple/timer> <set> <integer>
  20. trigger:
  21. if player has permission "{@perms}":
  22. if arg-1 is "on" or "enable" or "true":
  23. if {timedhealing} is false:
  24. set {timedhealing} to true
  25. set {timedhealing::timer} to 0
  26. broadcast "{@prefix} &3Timed Healing &benabled!"
  27. loop all players:
  28. command "/playsound note.bass %loop-player% ~ ~ ~ 0.5 1 1"
  29. else if {timedhealing} is true:
  30. send "{@prefix} &3Timed Healing is already enabled."
  31. command "/playsound random.break %command sender% ~ ~ ~ 1 1 1"
  32.  
  33. if arg-1 is "off" or "disable" or "false":
  34. if {timedhealing} is true:
  35. set {timedhealing} to false
  36. set {timedhealing:timer} to 0
  37. set {timedhealing:amountremoved} to 0
  38. set {timedhealing:gapple} to {timedhealing:basegapple}
  39. broadcast "{@prefix} &3Timed Healing &bdisabled!"
  40. loop all players:
  41. command "/playsound note.bass %loop-player% ~ ~ ~ 0.5 1 1"
  42. else if {timedhealing} is false:
  43. send "{@prefix} &3Timed Healing is already disabled."
  44. command "/playsound random.break %command sender% ~ ~ ~ 1 1 1"
  45. if arg-1 is "gapple":
  46. if arg-2 is "setbase":
  47. if arg-3 is an integer:
  48. set {timedhealing:basegapple} to arg-3
  49. send "{@prefix} &3Golden Apples set to heal a base of %{timedhealing:basegapple}/2% hearts."
  50. else if arg-3 is less than 0:
  51. send "{@prefix} &7No number lower than 0!" to command sender
  52. command "/playsound random.break %command sender% ~ ~ ~ 1 0.5 1"
  53. else if arg-3 is greater than 20:
  54. send "{@prefix} &7No number higher than 20!" to command sender
  55. command "/playsound random.break %command sender% ~ ~ ~ 1 0.5 1"
  56. if arg-2 is "set":
  57. if arg-3 is an integer:
  58. set {timedhealing:gapple} to arg-3
  59. send "{@prefix} &3Golden Apples set to heal %{timedhealing:basegapple}/2% hearts."
  60. else if arg-3 is less than 0:
  61. send "{@prefix} &7No number lower than 0!" to command sender
  62. command "/playsound random.break %command sender% ~ ~ ~ 1 0.5 1"
  63. else if arg-3 is greater than 20:
  64. send "{@prefix} &7No number higher than 20!" to command sender
  65. command "/playsound random.break %command sender% ~ ~ ~ 1 0.5 1"
  66. if arg-2 is "reset":
  67. set {timedhealing:basegapple} to 4
  68. set {timedhealing:gapple} to 4
  69. send "{@prefix} &3Golden Apple healing reset."
  70. if arg-2 is "resetbase":
  71. set {timedhealing:basegapple} to 4
  72. send "{@prefix} &3Golden Apple base healing reset."
  73. if arg-2 is "reload":
  74. set {timedhealing:gapple} to {timedhealing:gapple}-{timedhealing:amountremoved}
  75. if arg-1 is "ghead":
  76. if arg-2 is "set":
  77. if arg-3 is an integer:
  78. set {timedhealing:ghead} to arg-3
  79. send "{@prefix} &3Golden heads set to heal %{timedhealing:ghead}/2% hearts."
  80. else if arg-3 is less than 0:
  81. send "{@prefix} &7No number lower than 0!" to command sender
  82. command "/playsound random.break %command sender% ~ ~ ~ 1 0.5 1"
  83. else if arg-3 is greater than 20:
  84. send "{@prefix} &7No number higher than 20!" to command sender
  85. command "/playsound random.break %command sender% ~ ~ ~ 1 0.5 1"
  86. if arg-2 is "setbase":
  87. if arg-3 is an integer:
  88. set {timedhealing:baseghead} to arg-3
  89. send "{@prefix} &3Golden heads set to heal a base of %{timedhealing:baseghead}/2% hearts."
  90. else if arg-3 is less than 0:
  91. send "{@prefix} &7No number lower than 0!" to command sender
  92. command "/playsound random.break %command sender% ~ ~ ~ 1 0.5 1"
  93. else if arg-3 is greater than 20:
  94. send "{@prefix} &7No number higher than 20!" to command sender
  95. command "/playsound random.break %command sender% ~ ~ ~ 1 0.5 1"
  96. if arg-2 is "resetbase":
  97. set {timedhealing:baseghead} to 8
  98. send "{@prefix} &3Golden Head base healing reset."
  99. if arg-2 is "reset":
  100. set {timedhealing:ghead} to 8
  101. send "{@prefix} &3Golden Head healing reset."
  102. command "/ghead %{timedhealing:ghead}%"
  103. if arg-2 is "reload":
  104. set {timedhealing:ghead} to {timedhealing:baseghead}-{timedhealing:amountremoved}-{timedhealing:gapple}
  105. command "/ghead %{timedhealing:ghead}% -s"
  106. send "{@prefix} &3Golden Head healing reloaded."
  107. if arg-1 is "timer":
  108. if arg-2 is not set:
  109. send "{@prefix} &3Timed Healing has been active for %{timedhealing:timer}% minutes.}"
  110. if arg-2 is "reset":
  111. set {timedhealing:timer} to 0
  112. send "{@prefix} &3Timed Healing's timer has been reset."
  113. if arg-2 is "set":
  114. if arg-3 is an integer:
  115. set {timedhealing:timer} to arg-3
  116. else if arg-3 is less than 0:
  117. send "{@prefix} &7No number lower than 0!" to command sender
  118. command "/playsound random.break %command sender% ~ ~ ~ 1 0.5 1"
  119. else if arg-3 is greater than 200:
  120. send "{@prefix} &7No number higher than 200!" to command sender
  121. command "/playsound random.break %command sender% ~ ~ ~ 1 0.5 1"
  122. if arg-1 is "interval":
  123. if arg-2 is "set":
  124. if arg-3 is an integer:
  125. set {timedhealing:interval} to arg-3
  126. send "{@prefix} &3Timed Healing's interval set to every %{timedhealing:interval}% minutes."
  127. else if arg-3 is less than 0:
  128. send "{@prefix} &7No number lower than 0!" to command sender
  129. command "/playsound random.break %command sender% ~ ~ ~ 1 0.5 1"
  130. else if arg-3 is greater than 200:
  131. send "{@prefix} &7No number higher than 200!" to command sender
  132. command "/playsound random.break %command sender% ~ ~ ~ 1 0.5 1"
  133. else if arg-2 is not set:
  134. send "{@prefix} &3Timed Healing's interval is every %{timedhealing:interval}% minutes."
  135.  
  136. if arg-1 is "reset":
  137. set {timedhealing} to false
  138. set {timedhealing:timer} to 0
  139. set {timedhealing:basegapple} to 4
  140. set {timedhealing:baseghead} to 8
  141. wait for 1 tick
  142. set {timedhealing:gapple} to {timedhealing:basegapple}
  143. set {timedhealing:ghead} to {timedhealing:baseghead}
  144. set {timedhealing:amountremoved} to 0
  145. broadcast "{@prefix} &3Golden Apples now heal %{timedhealing:gapple}/2% hearts."
  146. command "/ghead %{timedhealing:baseghead}% -s"
  147. loop all players:
  148. command "/playsound random.break %loop-player% ~ ~ ~ 1 0.5 1"
  149. broadcast "{@prefix} &3Golden Heads now heal %{timedhealing:ghead}/2% hearts."
  150. broadcast "{@prefix} &3Timed Healing reset and disabled."
  151.  
  152. if arg-1 is "help":
  153. send "{@prefix} &3/timedhealing [on:off/reset]"
  154. wait for 1 tick
  155. send "{@prefix} &3/timedhealing [gapple/timer] [set:reset] [integer]"
  156. command "/playsound random.pop %command sender% ~ ~ ~ 1 1 1"
  157.  
  158.  
  159.  
  160. else if arg-1 is not set:
  161. command "/playsound note.bass %command sender% ~ ~ ~ 0.5 1 1"
  162. message "{@prefix} &3Golden Apples currently heal %{timedhealing:gapple}/2% hearts."
  163. wait for 1 tick
  164. message "{@prefix} &3Golden Heads currently heal %{timedhealing:ghead}/2% hearts."
  165. wait for 1 tick
  166. message "{@prefix} &3Admin Commands:"
  167. wait for 1 tick
  168. send "{@prefix} &3/timedhealing [on:off/reset]"
  169. wait for 1 tick
  170. send "{@prefix} &3/timedhealing [gapple/ghead] [set:setbase:reset] [integer]"
  171. wait for 1 tick
  172. send "{@prefix} &3/timedhealing [timer] [set:reset] [integer]"
  173.  
  174.  
  175. else:
  176. command "/playsound note.bass %command sender% ~ ~ ~ 0.5 1 1"
  177. message "{@prefix} &3Golden Apples currently heal %{timedhealing:gapple}/2% hearts."
  178. wait for 1 tick
  179. message "{@prefix} &3Golden Heads currently heal %{timedhealing:ghead}/2% hearts."
  180.  
  181.  
  182. on consume of golden apple:
  183. if {timedhealing} is true:
  184. cancel the event
  185. remove 1 golden apple from the player
  186. heal the player by {timedhealing:gapple}/2 hearts
  187. message "{@prefix} &3Your Golden Apple healed %{timedhealing:gapple}/2% hearts due to Timed Healing."
  188. wait for 1 tick
  189. #message "{@prefix} &3...and if it was a Golden Head then it healed %{timedhealing:ghead}/2% hearts due to Timed Healing."
  190.  
  191. every minute:
  192. if {timedhealing} is true:
  193. add 1 to {timedhealing:timer}
  194. if {timedhealing:timer} = {timedhealing:interval}:
  195. set {timedhealing:timer} to 0
  196. wait for 1 tick
  197. add 1 to {timedhealing:amountremoved}
  198. wait for 1 tick
  199. set {timedhealing:gapple} to {timedhealing:basegapple}-{timedhealing:amountremoved}
  200. wait for 1 tick
  201. set {timedhealing:ghead} to {timedhealing:baseghead}-({timedhealing:basegapple}+{timedhealing:amountremoved})
  202. if {timedhealing:gapple} is less than 1:
  203. set {timedhealing:gapple} to 1
  204. broadcast "{@prefix} &3Golden Apples now heal %{timedhealing:gapple}/2% hearts."
  205. if {timedhealing:ghead} is less than 2:
  206. set {timedhealing:ghead} to 2
  207. command "/ghead %{timedhealing:ghead}-1% -s"
  208. broadcast "{@prefix} &3Golden Heads now heal %{timedhealing:ghead}/2% hearts."
  209. else if {timedhealing:gapple} is more than 0:
  210. broadcast "{@prefix} &3Golden Apples now heal %{timedhealing:gapple}/2% hearts."
  211. loop all players:
  212. command "/playsound note.pling %loop-player% ~ ~ ~ 1 1 1"
  213. else if {timedhealing:ghead} is more than 2:
  214. command "/ghead %{timedhealing:ghead}-1% -s"
  215. broadcast "{@prefix} &3Golden Heads now heal %{timedhealing:ghead}/2% hearts."
  216. loop all players:
  217. command "/playsound note.pling %loop-player% ~ ~ ~ 1 1 1"
  218. #The End.
Advertisement
Add Comment
Please, Sign In to add comment