Started by
DROPTHENOODLES
on
Topic category: Help with Minecraft modding (Java Edition)
Hay there! So i have a question... Do you perhaps know a way to get a percentage of a variable? I want to make a mana system, but i also want to make a Fancy mana bar. So this is what i want:
[(get variable (Mana)) equals to or is above (10% of (get variable (Max_Mana))]
So for example, the mana bar will fill up one segment when the 10% of (Max_Mana) is met. So like this pretty much:
("|" = empty "/" = full)
(Max_Mana) = 100
(Mana) = 5
||||||||||
(Max_Mana) = 100
(Mana) = 20
//||||||||
(Max_Mana) = 200
(Mana) = 80
////||||||
Do you know any way to make this work? If so then i would be really happy! :D
Using maths, 10% of something is the same as 0.1 of something.
Ie: if your max mana is 100. Your current mana is 23. You have 23% mana, or 0.23 max mana.
For each bar to be 10% you do this.
Return if current > (max)*((0.1)*(number of bar))
The first bar shows 10% so the number of the bar is 1 and so on.
Just make the max amount 100 so that you can get 10% by checking if its 10.