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?
 
u mean when the unit is hit? or it just stays with the unit and shows it over its head?
 
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.
 
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%
 
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
 
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.
 
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
 
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
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good
  • The Helper The Helper:
    I would like to see it again like Ghan had it the first time with pagination though - without the pagination that view will not work but with pagination it just might...
  • The Helper The Helper:
    This drink recipe I have had more than a few times back in the day! Mind Eraser https://www.thehelper.net/threads/cocktail-mind-eraser.194720/

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top