Hitpoint percentage for floating text

sionts

New Member
Reaction score
0
This text has percentage of the units hitpoints and at 100% its green and at 0% its red. Could anyone show me how this would be done?
 

Optiong

New Member
Reaction score
0
u mean when the unit is hit? or it just stays with the unit and shows it over its head?
 

Rinpun

Ex TH Member
Reaction score
105
Floating text permanent or not? Ah well, guess it doesn't matter....

You will want something like this....

This only works for showing green if 100%, yellow if not dead and not 100%, and red if dead. Not sure what you wanted.

Code:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    If - Conditions
        ((Life of (Triggering unit)) / (Max life of (Triggering unit))) Equal to 1.0
    Then - Actions
        Floating Text - Create floating text that reads "100%" above (Triggering unit) with Z offset 0.00, using font size 10.00, color (0.00%, 100.00%, 0.00%), and 0.00% transparency
    Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Percentage life of (Triggering unit)) Equal to 0.00
            Then - Actions
                Floating Text - Create floating text that reads (String((Integer(((Life of (Triggering unit)) / (Max life of (Triggering unit))))))) above (Triggering unit) with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
            Else - Actions
                Floating Text - Create floating text that reads (String((Integer(((Life of (Triggering unit)) / (Max life of (Triggering unit))))))) above (Triggering unit) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 0.00%), and 0.00% transparency

You want something like this.

If you want to get more complicated, you can make a trigger that takes the percentage life of the unit and generates a color for it.
 

sionts

New Member
Reaction score
0
yeah green 100% and yellow 50% then 0% red, so if the hitpoints were going down it would slowly change color rather then isntantly change to yellow at 50%
 
E

Eilhal

Guest
I'm not in my editor right now and I'm not thinking much about what color mixing you'd get from this... but couldn't you make color = to (100[always],= to 100 - units current health %,0[always]) You could make it an if then else also so If the units HP > than 0 do (what I said already) else do same except values = (0,0,100) or something like that
 
A

Abraxas

Guest
OR

you could do a division of the (max HP of unit)\(Current HP of unit)

which will give you the units %hp.

make that a floating text whenever it gets attacked or built.
 

sionts

New Member
Reaction score
0
i just tried the trigger, and it didn't turn out to well. The text arnt destroyed so the text seems to build up on the spot and it doesnt look to good
 

Rinpun

Ex TH Member
Reaction score
105
Obviously. You didn't say at all what you would do with this text or how rapidly it would appear. Look into the floating text actions...one should let you set the fading time and lifetime of the floating text.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top