Actionbar skript (damage problem)

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

FossilOG

Member
Jul 31, 2019
12
0
1
25
Skript Version (do not put latest): Skript 2.4-beta5 (btw Its a custom version but Its just a tiny changes that wont affect the skript)
Skript Author: Bensku
Minecraft Version: 1.14.4

Code:
function actionbar(p: player):
    set {_uuid} to uuid of {_p}
    send actionbar "&c%{%{_uuid}%::health}%/%{%{_uuid}%::maxhealth}%❤    &a%{%{_uuid}%::defense}%❈ Defense" to {_p}

on damage:
    if attacker isn't player:
        set {_damage} to damage
        # this part is when you get hurt and you take damage and it's in sync with the your players health and
        # actionbar health for example if your player health is 8.5 hearts its going to to be like 85/100❤ or 8.2 hearts its going to be 82/100❤
        if {%{_uuid}%::health} is less than or equal to 100:
            remove {_damage} from {%{uuid}%::health}
            remove {_damage} from player's health
            bind hologram "&c-%{_damage}*2%" to victim for 1 seconds offset by 0, 1.5, 1
        if {%{_uuid}%::health} is greater than or equal to 101:
            remove {_damage} from {%{uuid}%::health}
            # this part below makes sure that he doesn't get hurt until his actionbar health is below 100 or equal to it
            # although I dont know how to do this part
            set %player's health% to 10
            bind hologram "&c-%{_damage}*2%" to victim for 1 seconds offset by 0, 1.5, 1

My "on damage:" part isn;t working everytime I take damage the actionbar health doesn't sync with the player health please help me ;(
 
Last edited:
Status
Not open for further replies.