- Joined
- Mar 3, 2009
- Messages
- 327
Im trying to make a custom health bar. Please dont point me to a Vjass system. Anyway, im trying to make a unit's percentage life scale to a bar made up of X characters. For example,
Unit is on 50% life
Bar is 10 characters long
Therefore, 5 characters are white, 5 have been coloured black
Unit is on 50% life
Bar is 20 characters long
Therefore, 10 characters are white, 10 have been coloured black
I just can't think of a formula to do this. Ive been trying for a while and have hit a few roadblocks. If someone could provide one for me that would be great. Also, heres a piece of code. I've been trying
to no avail.
Thanks in advance for any assistance.
Unit is on 50% life
Bar is 10 characters long
Therefore, 5 characters are white, 5 have been coloured black
Unit is on 50% life
Bar is 20 characters long
Therefore, 10 characters are white, 10 have been coloured black
I just can't think of a formula to do this. Ive been trying for a while and have hit a few roadblocks. If someone could provide one for me that would be great. Also, heres a piece of code. I've been trying
Code:
%Life/Bar length = Amount of characters to colour
-
NTest
-
Events
-
Player - Player 1 (Red) types a chat message containing n as A substring
-
-
Conditions
-
Actions
-
Set tempstring = <Empty String>
-
Set Characters = (Integer((Substring((Entered chat string), 2, (Length of (Entered chat string))))))
-
-------- X --------
-
Set Tempreal = 80.00
-
-------- Y --------
-
Set Tempreal2 = (Tempreal / (Real(Characters)))
-
For each (Integer A) from 1 to Characters, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Tempreal2 Less than (Real((Integer A)))
-
-
Then - Actions
-
Set tempstring = (tempstring + (|C00000000 + (Character + |r)))
-
-
Else - Actions
-
Set tempstring = (tempstring + Character)
-
-
-
-
-
-
Thanks in advance for any assistance.