Problems with HpBar display on Mutliboard

Status
Not open for further replies.
Level 8
Joined
Apr 8, 2009
Messages
499
The Triggers i'm using:

  • Hp Bar loop
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Set HpColors[1] = |cffff0000
      • Set HpColors[2] = |cffff8000
      • Set HpColors[3] = |cff00ff00
      • Unit Group - Pick every unit in (Units in (Playable map area) owned by Player 1 (Red)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is A Hero) Equal to True
              • ((Picked unit) is alive) Equal to True
            • Then - Actions
              • Set HpBarProcentualHealth_1 = (Integer((Percentage life of (Picked unit))))
            • Else - Actions
              • Set HpBarProcentualHealth_1 = 0
      • Set HpBarProcentualHealth_2 = ((HpBarProcentualHealth_1 / 10) x 2)
      • Set HpBarDisplay2 = <Empty String>
      • Set HpBarDisplayEmptyHealth = <Empty String>
      • For each (Integer A) from 0 to HpBarProcentualHealth_2, do (Actions)
        • Loop - Actions
          • Set HpBarDisplay2 = (HpBarDisplay2 + I)
      • For each (Integer A) from 0 to (20 - HpBarProcentualHealth_2), do (Actions)
        • Loop - Actions
          • Set HpBarDisplayEmptyHealth = (HpBarDisplayEmptyHealth + I)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • HpBarProcentualHealth_1 Greater than or equal to 75
        • Then - Actions
          • Set HpBarDisplay1 = ((HpColors[3] + (HpBarDisplay2 + |r)) + (|cff808080 + HpBarDisplayEmptyHealth))
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • HpBarProcentualHealth_1 Greater than or equal to 50
            • Then - Actions
              • Set HpBarDisplay1 = ((HpColors[2] + (HpBarDisplay2 + |r)) + (|cff808080 + HpBarDisplayEmptyHealth))
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • HpBarProcentualHealth_1 Greater than or equal to 25
                • Then - Actions
                  • Set HpBarDisplay1 = ((HpColors[1] + (HpBarDisplay2 + |r)) + (|cff808080 + HpBarDisplayEmptyHealth))
                • Else - Actions
      • Multiboard - Set the text for Multiboard_Experience item in column 2, row 3 to HpBarDisplay1

So far this works correctly, but when you're hp drops to a really low level, the display on the multiboard won't update anymore and it'll be stuck at IIIIIIIIIIIIIIIIIII

and i'm aware of the fact that it won't be able to judge the x% health corectly once the hero dies....

but apart from that, could someone help?

thnx, and +rep for anyone who helps. like always.
 
*Don't set the hp colours every 0.1 seconds. Set them once in some trigger.
*You leak a unit group. Add
  • Custom script: set bj_wantDestroyGroup = true
before the unit group pick.

Let's say the percentage is 13%. You conver it to an integer -> 13. Divide by 10 -> 1 (decimals get cut off), multiply by 2 -> 2.

Then you loop from 0 to 2. 0 , 1 , 2. Three bars.

Calculations should be done with reals. Convert the result to an integer, and hadnel it as needed.

You can take a look at how I do it here: https://www.hiveworkshop.com/forums/requests-341/boss-status-bar-system-182770/
 
*Don't set the hp colours every 0.1 seconds. Set them once in some trigger.
*You leak a unit group. Add
  • Custom script: set bj_wantDestroyGroup = true
before the unit group pick.

Let's say the percentage is 13%. You conver it to an integer -> 13. Divide by 10 -> 1 (decimals get cut off), multiply by 2 -> 2.

Then you loop from 0 to 2. 0 , 1 , 2. Three bars.

Calculations should be done with reals. Convert the result to an integer, and hadnel it as needed.

You can take a look at how I do it here: https://www.hiveworkshop.com/forums/requests-341/boss-status-bar-system-182770/

  • Hp Bar loop
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) owned by Player 1 (Red)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is A Hero) Equal to True
              • ((Picked unit) is alive) Equal to True
            • Then - Actions
              • Set HpBarProcentualHealth_1 = (Percentage life of (Picked unit))
            • Else - Actions
              • Set HpBarProcentualHealth_1 = 0.00
      • Set HpBarProcentualHealth_2 = (Integer(HpBarProcentualHealth_1))
      • Set HpBarDisplay2 = <Empty String>
      • Set HpBarDisplayEmptyHealth = <Empty String>
      • For each (Integer A) from 1 to HpBarProcentualHealth_2, do (Actions)
        • Loop - Actions
          • Set HpBarDisplay2 = (HpBarDisplay2 + |)
      • For each (Integer A) from 1 to (100 - HpBarProcentualHealth_2), do (Actions)
        • Loop - Actions
          • Set HpBarDisplayEmptyHealth = (HpBarDisplayEmptyHealth + |)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • HpBarProcentualHealth_1 Greater than or equal to 75.00
        • Then - Actions
          • Set HpBarDisplay1 = ((HpColors[3] + (HpBarDisplay2 + |r)) + (|cff808080 + HpBarDisplayEmptyHealth))
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • HpBarProcentualHealth_1 Greater than or equal to 50.00
            • Then - Actions
              • Set HpBarDisplay1 = ((HpColors[2] + (HpBarDisplay2 + |r)) + (|cff808080 + HpBarDisplayEmptyHealth))
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • HpBarProcentualHealth_1 Greater than or equal to 25.00
                • Then - Actions
                  • Set HpBarDisplay1 = ((HpColors[1] + (HpBarDisplay2 + |r)) + (|cff808080 + HpBarDisplayEmptyHealth))
                • Else - Actions
      • Multiboard - Set the text for Multiboard_Experience item in column 2, row 3 to HpBarDisplay1
I used a real now, not sure if i did so correctly. alsowent from 20 bars to a 100 stil have the same issues.... whatam i doing wrong O.o;; ?




You should use | instead, that way it looks like a bar

i wanted to do that at first,but then i get bar issues like this:

WC3ScrnShot_122510_080024_03.jpg

(for it wasn't clear from the screen shot, there's a "r" in the bar. comes from the |r for closing the color tag.)
 
Status
Not open for further replies.
Back
Top