motan1205

Untitled

Apr 29th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.33 KB | None | 0 0
  1. Options:
  2. #Style Options (&m?)(|)(?)(¦)(?)
  3. Style: &m? # The style of choice
  4. Length: 15 #Length Increases the amount of increments the health bar has
  5. Height: 0.8 #how high or low the bar is
  6.  
  7.  
  8. on skript load:
  9. clear {HoloHealth::*}
  10.  
  11. every 10 seconds:
  12. loop {HoloHealth::*}:
  13. if loop-value is dead:
  14. delete holo object "%entity uuid of loop-value%"
  15. remove loop-value from {HoloHealth::*}
  16.  
  17. on death:
  18. wait 1 ticks
  19. if holo object "%entity uuid of victim%" exists:
  20. set {_uuid} to entity uuid of victim
  21. delete holo object "%entity uuid of victim%"
  22.  
  23. on explode:
  24. #Creepers explode fix
  25. if holo object "%entity uuid of event-entity%" exists:
  26. set {_uuid} to uuid of event-entity
  27. delete holo object "%entity uuid of event-entity%"
  28.  
  29. function UpdateBar(entity: entity):
  30. wait 1 ticks
  31. #We wait a tick to get updated health value's if attacking quickly
  32. {_entity} is not a player
  33. {_entity} is not a dropped item
  34. {_entity} is not a projectile
  35. {_entity} is not a armor stand
  36. {_entity} is not a villager
  37.  
  38. set {_Euuid} to entity uuid of {_entity}
  39. set {_Symbol} to "{@Style}"
  40. set {_H} to hitbox length of {_entity}
  41. set {_H} to {_H}+{@Height}
  42.  
  43. set {_CurHp} to health of {_entity}
  44. set {_MaxHp} to max health of {_entity}
  45.  
  46. set {_hpAmount} to {_CurHp}/{_MaxHp}*{@Length}
  47. set {_size} to {_hpAmount}
  48.  
  49.  
  50. if holo object "%{_Euuid}%" exists:
  51. wait 0 ticks
  52. #Holo object exists doesnt have does not exists
  53. else:
  54. create bound holo object "" with id "%{_Euuid}%" to {_entity} offset by 0, {_h}, 0
  55. add {_entity} to {HoloHealth::*}
  56.  
  57. if holo object "%{_Euuid}%" exists:
  58. loop {_hpAmount} times:
  59. add {_Symbol} to {_endresult::*}
  60. add 1 to {_missing}
  61.  
  62. if {_endresult::*} isn't set:
  63. set {_end} to ""
  64. else:
  65. set {_end} to "%{_endresult::*}%"
  66. replace every "," with "" in {_end}
  67. replace every " " with "" in {_end}
  68. replace every "and" with "" in {_end}
  69.  
  70. if {_end} isn't set:
  71. set {_end} to ""
  72.  
  73. set {_missAmount} to {@Length}-{_missing}
  74. loop {_missAmount} times:
  75. add {_Symbol} to {_missresult::*}
  76. if {_missresult::*} isn't set:
  77. set {_miss} to ""
  78. else:
  79. set {_miss} to "%{_missresult::*}%"
  80. replace every "," with "" in {_miss}
  81. replace every " " with "" in {_miss}
  82. replace every "and" with "" in {_miss}
  83. edit holo object "%{_Euuid}%" to "&a%{_end}%&c%{_miss}%"
  84.  
  85.  
  86. #Creative fix for target
  87. on damage:
  88. if attacker is a player:
  89. UpdateBar(victim)
  90. if attacker's gamemode is creative:
  91. if target of victim isn't set:
  92. set target of victim to attacker
  93.  
  94. #Lets other damage update the bar EG : Fire/Poision/Fall Damage
  95. on damage:
  96. if holo object "%entity uuid of victim%" exists:
  97. UpdateBar(victim)
  98.  
  99.  
  100. #Removes the bar on untarget
  101. on untarget:
  102. set {_uuid} to uuid of entity
  103. wait 5 ticks
  104. if target of entity is not set:
  105. delete holo object "%entity uuid of entity%"
  106.  
  107. #If entiy is targeting a player spawn's the bar
  108. #Much nicer to see a full health bar then begin to get lower as you attack
  109. on target:
  110. if target of entity is a player:
  111. UpdateBar(entity)
  112.  
  113.  
  114. #World edit butcher fix for bar's not being removed
  115. on command "/butcher":
  116. loop all living entities:
  117. if holo object "%entity uuid of loop-value%" exists:
  118. set {_uuid} to uuid of loop-value
  119. delete holo object "%entity uuid of loop-value%"
  120.  
  121.  
  122. #Despawn mob's / unloaded chunk removal of health bar's
  123. on chunk unload:
  124. loop entities of event-chunk:
  125. loop-value is not a player
  126. loop-value is not a dropped item
  127. loop-value is not a projectile
  128. loop-value is not a armor stand
  129. loop-value is not a villager
  130. if holo object "%entity uuid of loop-value%" exists:
  131. set {_uuid} to uuid of loop-value
  132. delete holo object "%entity uuid of loop-value%"
Add Comment
Please, Sign In to add comment