Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Options:
- #Style Options (&m?)(|)(?)(¦)(?)
- Style: &m? # The style of choice
- Length: 15 #Length Increases the amount of increments the health bar has
- Height: 0.8 #how high or low the bar is
- on skript load:
- clear {HoloHealth::*}
- every 10 seconds:
- loop {HoloHealth::*}:
- if loop-value is dead:
- delete holo object "%entity uuid of loop-value%"
- remove loop-value from {HoloHealth::*}
- on death:
- wait 1 ticks
- if holo object "%entity uuid of victim%" exists:
- set {_uuid} to entity uuid of victim
- delete holo object "%entity uuid of victim%"
- on explode:
- #Creepers explode fix
- if holo object "%entity uuid of event-entity%" exists:
- set {_uuid} to uuid of event-entity
- delete holo object "%entity uuid of event-entity%"
- function UpdateBar(entity: entity):
- wait 1 ticks
- #We wait a tick to get updated health value's if attacking quickly
- {_entity} is not a player
- {_entity} is not a dropped item
- {_entity} is not a projectile
- {_entity} is not a armor stand
- {_entity} is not a villager
- set {_Euuid} to entity uuid of {_entity}
- set {_Symbol} to "{@Style}"
- set {_H} to hitbox length of {_entity}
- set {_H} to {_H}+{@Height}
- set {_CurHp} to health of {_entity}
- set {_MaxHp} to max health of {_entity}
- set {_hpAmount} to {_CurHp}/{_MaxHp}*{@Length}
- set {_size} to {_hpAmount}
- if holo object "%{_Euuid}%" exists:
- wait 0 ticks
- #Holo object exists doesnt have does not exists
- else:
- create bound holo object "" with id "%{_Euuid}%" to {_entity} offset by 0, {_h}, 0
- add {_entity} to {HoloHealth::*}
- if holo object "%{_Euuid}%" exists:
- loop {_hpAmount} times:
- add {_Symbol} to {_endresult::*}
- add 1 to {_missing}
- if {_endresult::*} isn't set:
- set {_end} to ""
- else:
- set {_end} to "%{_endresult::*}%"
- replace every "," with "" in {_end}
- replace every " " with "" in {_end}
- replace every "and" with "" in {_end}
- if {_end} isn't set:
- set {_end} to ""
- set {_missAmount} to {@Length}-{_missing}
- loop {_missAmount} times:
- add {_Symbol} to {_missresult::*}
- if {_missresult::*} isn't set:
- set {_miss} to ""
- else:
- set {_miss} to "%{_missresult::*}%"
- replace every "," with "" in {_miss}
- replace every " " with "" in {_miss}
- replace every "and" with "" in {_miss}
- edit holo object "%{_Euuid}%" to "&a%{_end}%&c%{_miss}%"
- #Creative fix for target
- on damage:
- if attacker is a player:
- UpdateBar(victim)
- if attacker's gamemode is creative:
- if target of victim isn't set:
- set target of victim to attacker
- #Lets other damage update the bar EG : Fire/Poision/Fall Damage
- on damage:
- if holo object "%entity uuid of victim%" exists:
- UpdateBar(victim)
- #Removes the bar on untarget
- on untarget:
- set {_uuid} to uuid of entity
- wait 5 ticks
- if target of entity is not set:
- delete holo object "%entity uuid of entity%"
- #If entiy is targeting a player spawn's the bar
- #Much nicer to see a full health bar then begin to get lower as you attack
- on target:
- if target of entity is a player:
- UpdateBar(entity)
- #World edit butcher fix for bar's not being removed
- on command "/butcher":
- loop all living entities:
- if holo object "%entity uuid of loop-value%" exists:
- set {_uuid} to uuid of loop-value
- delete holo object "%entity uuid of loop-value%"
- #Despawn mob's / unloaded chunk removal of health bar's
- on chunk unload:
- loop entities of event-chunk:
- loop-value is not a player
- loop-value is not a dropped item
- loop-value is not a projectile
- loop-value is not a armor stand
- loop-value is not a villager
- if holo object "%entity uuid of loop-value%" exists:
- set {_uuid} to uuid of loop-value
- delete holo object "%entity uuid of loop-value%"
Add Comment
Please, Sign In to add comment