Hi all,
Im trying to write a script that allows for health to be over 20 and for health and damage to be broken up into two different categories. I am achieving this by:
- "Capping" the health at 20 visually (the status bar will reflect 20/20 always) - I may work on changing this later but is not my biggest concern
- The defense value will be the max health value of the player minus 20.
In sum, the status bar will look like as such:
20/20 Health | 1500 / 1500 Defense
Total health = 1520
However, during development of this Skript, I encountered an issue setting the scaled health bar. Right now, I have on player join the health bar scaling down to 20 so I prevent having the health bar from showing rows and rows of hearts. The scaling itself works fine, it keeps the health bar at showing only 10 hears. But the issue is when I equip armor over max health (for example, a piece of armor giving 10,000 health). The armor "damages" the player and the heart bar shows half a heart after being equipped.
I want to avoid the health bar from:
1. Reflecting the heart bar from showing anything other than the bottom 20 health points of a player (or, if armor is equipped, showing no change to the bar)
2. Not directly a health bar problem, but preventing the player from taking damage when placing armor on that increases max health.
I have pasted my code below. If you need any additional information of clarification, please feel free to ask. I know my descriptions may be a bit confusing.
Thanks!
Im trying to write a script that allows for health to be over 20 and for health and damage to be broken up into two different categories. I am achieving this by:
- "Capping" the health at 20 visually (the status bar will reflect 20/20 always) - I may work on changing this later but is not my biggest concern
- The defense value will be the max health value of the player minus 20.
In sum, the status bar will look like as such:
20/20 Health | 1500 / 1500 Defense
Total health = 1520
However, during development of this Skript, I encountered an issue setting the scaled health bar. Right now, I have on player join the health bar scaling down to 20 so I prevent having the health bar from showing rows and rows of hearts. The scaling itself works fine, it keeps the health bar at showing only 10 hears. But the issue is when I equip armor over max health (for example, a piece of armor giving 10,000 health). The armor "damages" the player and the heart bar shows half a heart after being equipped.
I want to avoid the health bar from:
1. Reflecting the heart bar from showing anything other than the bottom 20 health points of a player (or, if armor is equipped, showing no change to the bar)
2. Not directly a health bar problem, but preventing the player from taking damage when placing armor on that increases max health.
I have pasted my code below. If you need any additional information of clarification, please feel free to ask. I know my descriptions may be a bit confusing.
Thanks!
Code:
on join:
set the scaled health of player to 20
while player is online:
send action bar "&c20&7/&c20 ❤ &f | &aDefense: xxxx&7/&axxxx ❈" to player
wait 2 ticks