• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

HP & Mana Bar system





226052-albums8526-picture103209.png

Mostly Functional ! - All GUI !
Simplest import ever!
-just C&P and your done-


226052-albums8526-picture103197.gif


226052-albums8526-picture103194.jpg


226052-albums8526-picture103196.jpg

  • System Set up
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Game - Display to (All players) the text: |c00FF0000P|c00FA05...
      • -------- Disables standard health bars --------
      • Game - Enable pre-selection functionality (Disable pre-selection circles, life bars, and object info)
      • -------- ------------------------------------------------------- --------
      • -------- Turns on custom Hp and Mana bars --------
      • Set ManaBars_On[(Player number of (Triggering player))] = True
      • -------- ------------------------------------------------------- --------
      • -------- In game instructions for on/off --------
      • Quest - Create a Required quest titled Hp and Mana Bars with the description To turn bars off an..., using icon path ReplaceableTextures\CommandButtons\BTNAmbush.blp
      • -------- ------------------------------------------------------- --------
      • -------- I think this just looks nicer--------------------------------- --------
      • Camera - Change camera smoothing factor to 100.00
      • -------- ------------------------------------------------------- --------
      • -------- Set Bar Color Fading------------------------------------------ --------
      • -------- ------------------------------------------------------- --------
      • -------- The (Integer A) here will = (% Life for HP_Unit) In the Bars Loop trigger --------
      • -------- ------------------------------------------------------- --------
      • -------- ---------------To make bars custom color simply change the RGB using the variables HP_Red, HPGreen, and HP_Blue to whatever you like---------------- --------
      • -------- ---------------------------------Remember wc3 uses hexidecimal/HTML color codes - |CFF (red = ff0000), (green = 00ff00), and (blue = 0000ff)----------|r---------------------------------- --------
      • -------- ------------------------------------------------------- --------
      • For each (Integer A) from 1 to 100, do (Actions)
        • Loop - Actions
          • -------- Set Red Color for HP Bar --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Integer A) Less than 10
            • Then - Actions
              • Set HP_Red[(Integer A)] = ff
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Integer A) Less than 20
                • Then - Actions
                  • Set HP_Red[(Integer A)] = fc
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Integer A) Less than 30
                    • Then - Actions
                      • Set HP_Red[(Integer A)] = dc
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Integer A) Less than 40
                        • Then - Actions
                          • Set HP_Red[(Integer A)] = cc
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Integer A) Less than 50
                            • Then - Actions
                              • Set HP_Red[(Integer A)] = bb
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Integer A) Less than 60
                                • Then - Actions
                                  • Set HP_Red[(Integer A)] = aa
                                • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • (Integer A) Less than 70
                                    • Then - Actions
                                      • Set HP_Red[(Integer A)] = 99
                                    • Else - Actions
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • (Integer A) Less than 80
                                        • Then - Actions
                                          • Set HP_Red[(Integer A)] = 66
                                        • Else - Actions
                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            • If - Conditions
                                              • (Integer A) Less than 90
                                            • Then - Actions
                                              • Set HP_Red[(Integer A)] = 33
                                            • Else - Actions
                                              • Set HP_Red[(Integer A)] = 00
          • -------- ------------------------------------------------------- --------
          • -------- Set Green Color for HP Bar --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Integer A) Greater than 95
            • Then - Actions
              • Set HP_Green[(Integer A)] = ff
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Integer A) Greater than 85
                • Then - Actions
                  • Set HP_Green[(Integer A)] = fc
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Integer A) Greater than 75
                    • Then - Actions
                      • Set HP_Green[(Integer A)] = df
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Integer A) Greater than 65
                        • Then - Actions
                          • Set HP_Green[(Integer A)] = dc
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Integer A) Greater than 55
                            • Then - Actions
                              • Set HP_Green[(Integer A)] = cd
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Integer A) Greater than 45
                                • Then - Actions
                                  • Set HP_Green[(Integer A)] = ca
                                • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • (Integer A) Greater than 45
                                    • Then - Actions
                                      • Set HP_Green[(Integer A)] = bb
                                    • Else - Actions
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • (Integer A) Greater than 35
                                        • Then - Actions
                                          • Set HP_Green[(Integer A)] = ab
                                        • Else - Actions
                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            • If - Conditions
                                              • (Integer A) Greater than 25
                                            • Then - Actions
                                              • Set HP_Green[(Integer A)] = 99
                                            • Else - Actions
                                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                • If - Conditions
                                                  • (Integer A) Greater than 15
                                                • Then - Actions
                                                  • Set HP_Green[(Integer A)] = 55
                                                • Else - Actions
                                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                    • If - Conditions
                                                      • (Integer A) Greater than 5
                                                    • Then - Actions
                                                      • Set HP_Green[(Integer A)] = 11
                                                    • Else - Actions
                                                      • Set HP_Green[(Integer A)] = 00
          • -------- ------------------------------------------------------- --------
          • -------- SeBlue Color for HP Bar --------
          • Set HP_Blue[(Integer A)] = 00
          • -------- ------------------------------------------------------- --------
          • -------- Set R,G,B Color for HP Bar --------
          • Set HP_Bar_Color[(Integer A)] = (|c00000000l|r|c00 + (HP_Red[(Integer A)] + (HP_Green[(Integer A)] + HP_Blue[(Integer A)])))
          • -------- ------------------------------------------------------- --------
          • -------- -----------------------End HP Bar Color-------------------------------- --------
          • -------- ------------------------------------------------------- --------
          • -------- ------------------------------------------------------------------------------- --------
          • -------- ------------------------------------------------------- --------
          • -------- ---------------------Set Mana Bar Color fading---------------------------------- --------
          • -------- ------------------------------------------------------- --------
          • -------- Set Red Color for Mana Bar --------
          • Set Mana_Red[(Integer A)] = 00
          • -------- ------------------------------------------------------- --------
          • -------- Set Green Color for Mana Bar --------
          • Set Mana_Green[(Integer A)] = 00
          • -------- ------------------------------------------------------- --------
          • -------- SeBlue Color for HP Bar --------
          • Set Mana_Blue[(Integer A)] = CC
          • -------- ------------------------------------------------------- --------
          • -------- Set R,G,B Color for HP Bar --------
          • Set Mana_Bar_Color[(Integer A)] = (|c00000000l|r|c00 + (Mana_Red[(Integer A)] + (Mana_Green[(Integer A)] + Mana_Blue[(Integer A)])))
          • -------- ------------------------------------------------------- --------
          • -------- -----------------------End Mana Bar Color-------------------------------- --------
  • HP Units init
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • -------- Selects all units already in the map to get HP bars --------
      • Set Mana_Group = (Units in (Playable map area))
      • Unit Group - Pick every unit in Mana_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Life of (Picked unit)) Greater than or equal to 100.00
              • (Owner of (Picked unit)) Not equal to Neutral Passive
              • (Unit-type of (Picked unit)) Not equal to Gold Mine
              • (Unit-type of (Picked unit)) Not equal to Entangled Gold Mine
              • (Unit-type of (Picked unit)) Not equal to Haunted Gold Mine
            • Then - Actions
              • -------- Sets the length of the Bar --------
              • Set StateString = llllllllllllllllllllllllllllllllllllllllllllllllllllllllll
              • Set HP_int = (HP_int + 1)
              • -------- sets an index number for each of the units --------
              • Set HP_Unit[HP_int] = (Picked unit)
              • Set HPstatus = (((Life of (Picked unit)) / (Max life of (Picked unit))) x (Real((Length of StateString))))
              • Set tempp1 = (Position of HP_Unit[HP_int])
              • Set tempp2 = (tempp1 offset by 40.00 towards 180.00 degrees)
              • Floating Text - Create floating text that reads StateString at tempp2 with Z offset 0.00, using font size 4.00, color (0.00%, 100.00%, 0.00%), and 0.00% transparency
              • Set HP_Text[HP_int] = (Last created floating text)
              • Floating Text - Show (Last created floating text) for (All players)
              • Custom script: call RemoveLocation(udg_tempp1)
              • Custom script: call RemoveLocation(udg_tempp2)
              • -------- ---------------- --------
              • -------- sets the size and position of the bar for different types of units --------
              • -------- ---------------- --------
              • -------- ---You may alter the size of the bar by adding lower-case Ls to StateString, and----- --------
              • -------- you can adjust the height with the values of HP_RealZ and the offset with HP_Real --------
              • -------- ---------------- --------
              • -------- Normal Unit - Default --------
              • Set HP_Bar_String[HP_int] = llllllllllllllllllllllllllllllllllllllllllllllllllll
              • Set HP_Real_BarLength[HP_int] = (Length of HP_Bar_String[HP_int])
              • Set HP_Real_Offset[HP_int] = 45.00
              • Set HP_Real_Z[HP_int] = 150.00
              • -------- ---------------- --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (HP_Unit[HP_int] is A flying unit) Equal to True
                • Then - Actions
                  • -------- Flying unit --------
                  • Set HP_Bar_String[HP_int] = lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
                  • Set HP_Real_BarLength[HP_int] = (Length of HP_Bar_String[HP_int])
                  • Set HP_Real_Offset[HP_int] = 45.00
                  • Set tempp1 = (Position of HP_Unit[(Integer A)])
                  • Custom script: set udg_Real_Z = GetLocationZ(udg_tempp1)
                  • Set HP_Real_Z[HP_int] = ((Current flying height of HP_Unit[(Integer A)]) + (300.00 + (Real_Z / 2.00)))
                  • Custom script: call RemoveLocation(udg_tempp1)
                  • -------- ---------------- --------
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (HP_Unit[HP_int] is A town-hall-type unit) Equal to True
                    • Then - Actions
                      • -------- Main Base / Hall --------
                      • Set HP_Bar_String[HP_int] = lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
                      • Set HP_Real_BarLength[HP_int] = (Length of HP_Bar_String[HP_int])
                      • Set HP_Real_Offset[HP_int] = 150.00
                      • Set HP_Real_Z[HP_int] = 350.00
                      • -------- ---------------- --------
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (HP_Unit[HP_int] is A structure) Equal to True
                        • Then - Actions
                          • -------- Buildings --------
                          • Set HP_Bar_String[HP_int] = lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
                          • Set HP_Real_BarLength[HP_int] = (Length of HP_Bar_String[HP_int])
                          • Set HP_Real_Offset[HP_int] = 130.00
                          • Set HP_Real_Z[HP_int] = 300.00
                          • -------- ---------------- --------
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • Or - Any (Conditions) are true
                                • Conditions
                                  • (HP_Unit[HP_int] is A Hero) Equal to True
                                  • (HP_Unit[HP_int] is an illusion) Equal to True
                            • Then - Actions
                              • -------- Hero --------
                              • Set HP_Bar_String[HP_int] = lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
                              • Set HP_Real_BarLength[HP_int] = (Length of HP_Bar_String[HP_int])
                              • Set HP_Real_Offset[HP_int] = 52.00
                              • Set HP_Real_Z[HP_int] = 250.00
                              • -------- ---------------- --------
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (HP_Unit[HP_int] is Mechanical) Equal to True
                                • Then - Actions
                                  • -------- Mechanical --------
                                  • Set HP_Bar_String[HP_int] = lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
                                  • Set HP_Real_BarLength[HP_int] = (Length of HP_Bar_String[HP_int])
                                  • Set HP_Real_Offset[HP_int] = 70.00
                                  • Set HP_Real_Z[HP_int] = 150.00
                                  • -------- ---------------- --------
                                • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • (HP_Unit[HP_int] is A peon-type unit) Equal to True
                                    • Then - Actions
                                      • -------- Workers --------
                                      • Set HP_Bar_String[HP_int] = llllllllllllllllllllllllllllllllllllllll
                                      • Set HP_Real_BarLength[HP_int] = (Length of HP_Bar_String[HP_int])
                                      • Set HP_Real_Offset[HP_int] = 47.00
                                      • Set HP_Real_Z[HP_int] = 100.00
                                      • -------- ---------------- --------
                                    • Else - Actions
              • Trigger - Turn on Visibility Loop <gen>
              • Trigger - Turn on Bars Loop <gen>
            • Else - Actions
      • Custom script: call DestroyGroup(udg_Mana_Group)
  • Add HP Units
    • Events
      • Unit - A unit enters (Entire map)
      • Unit - A unit Finishes reviving
    • Conditions
    • Actions
      • -------- Sets the default length of the Bar - Note: will be changed below --------
      • Set StateString = llllllllllllllllllllllllllllllllllllllllllllllllllllllllll
      • Set HP_int = (HP_int + 1)
      • -------- sets an index number for each of the units --------
      • Set HPstatus = (((Life of (Triggering unit)) / (Max life of (Triggering unit))) x (Real((Length of StateString))))
      • Set HP_Unit[HP_int] = (Triggering unit)
      • Set tempp1 = (Position of HP_Unit[HP_int])
      • Set tempp2 = (tempp1 offset by 40.00 towards 180.00 degrees)
      • Floating Text - Create floating text that reads StateString at tempp2 with Z offset 0.00, using font size 4.00, color (0.00%, 100.00%, 0.00%), and 0.00% transparency
      • Set HP_Text[HP_int] = (Last created floating text)
      • Floating Text - Show (Last created floating text) for (All players)
      • Custom script: call RemoveLocation(udg_tempp1)
      • Custom script: call RemoveLocation(udg_tempp2)
      • -------- ---------------- --------
      • -------- sets the size and position of the bar for different types of units --------
      • -------- ---------------- --------
      • -------- ---You may alter the size of the bar by adding lower-case Ls to StateString, and----- --------
      • -------- you can adjust the height with the values of HP_RealZ and the offset with HP_Real --------
      • -------- ---------------- --------
      • -------- Normal Unit - Default --------
      • Set HP_Bar_String[HP_int] = llllllllllllllllllllllllllllllllllllllllllllllllllll
      • Set HP_Real_BarLength[HP_int] = (Length of HP_Bar_String[HP_int])
      • Set HP_Real_Offset[HP_int] = 45.00
      • Set HP_Real_Z[HP_int] = 150.00
      • -------- ---------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (HP_Unit[HP_int] is A flying unit) Equal to True
        • Then - Actions
          • -------- Flying unit --------
          • Set HP_Bar_String[HP_int] = lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
          • Set HP_Real_BarLength[HP_int] = (Length of HP_Bar_String[HP_int])
          • Set HP_Real_Offset[HP_int] = 45.00
          • Set tempp1 = (Position of HP_Unit[(Integer A)])
          • Custom script: set udg_Real_Z = GetLocationZ(udg_tempp1)
          • Set HP_Real_Z[HP_int] = ((Current flying height of HP_Unit[(Integer A)]) + (300.00 + (Real_Z / 2.00)))
          • Custom script: call RemoveLocation(udg_tempp1)
          • -------- ---------------- --------
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (HP_Unit[HP_int] is A town-hall-type unit) Equal to True
            • Then - Actions
              • -------- Main Base / Hall --------
              • Set HP_Bar_String[HP_int] = lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
              • Set HP_Real_BarLength[HP_int] = (Length of HP_Bar_String[HP_int])
              • Set HP_Real_Offset[HP_int] = 150.00
              • Set HP_Real_Z[HP_int] = 350.00
              • -------- ---------------- --------
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (HP_Unit[HP_int] is A structure) Equal to True
                • Then - Actions
                  • -------- Buildings --------
                  • Set HP_Bar_String[HP_int] = lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
                  • Set HP_Real_BarLength[HP_int] = (Length of HP_Bar_String[HP_int])
                  • Set HP_Real_Offset[HP_int] = 130.00
                  • Set HP_Real_Z[HP_int] = 300.00
                  • -------- ---------------- --------
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Or - Any (Conditions) are true
                        • Conditions
                          • (HP_Unit[HP_int] is A Hero) Equal to True
                          • (HP_Unit[HP_int] is an illusion) Equal to True
                    • Then - Actions
                      • -------- Hero --------
                      • Set HP_Bar_String[HP_int] = llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
                      • Set HP_Real_BarLength[HP_int] = (Length of HP_Bar_String[HP_int])
                      • Set HP_Real_Offset[HP_int] = 52.00
                      • Set HP_Real_Z[HP_int] = 250.00
                      • -------- ---------------- --------
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (HP_Unit[HP_int] is Mechanical) Equal to True
                        • Then - Actions
                          • -------- Mechanical --------
                          • Set HP_Bar_String[HP_int] = lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
                          • Set HP_Real_BarLength[HP_int] = (Length of HP_Bar_String[HP_int])
                          • Set HP_Real_Offset[HP_int] = 70.00
                          • Set HP_Real_Z[HP_int] = 150.00
                          • -------- ---------------- --------
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (HP_Unit[HP_int] is A peon-type unit) Equal to True
                            • Then - Actions
                              • -------- Workers --------
                              • Set HP_Bar_String[HP_int] = llllllllllllllllllllllllllllllllllllllll
                              • Set HP_Real_BarLength[HP_int] = (Length of HP_Bar_String[HP_int])
                              • Set HP_Real_Offset[HP_int] = 47.00
                              • Set HP_Real_Z[HP_int] = 100.00
                              • -------- ---------------- --------
                            • Else - Actions
  • Mana Units init
    • Events
      • Time - Elapsed game time is 0.02 seconds
    • Conditions
    • Actions
      • Set Mana_Group = (Units in (Playable map area))
      • Unit Group - Pick every unit in Mana_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Max mana of (Picked unit)) Greater than or equal to 1.00
              • ((Picked unit) is A structure) Equal to False
            • Then - Actions
              • Set Mana_int = (Mana_int + 1)
              • Set Mana_Unit[Mana_int] = (Picked unit)
              • Set StateString = llllllllllllllllllllllllllllllllllllllllllllllllllllllllll
              • Set tempp1 = (Position of (Picked unit))
              • Set tempp2 = (tempp1 offset by 40.00 towards 180.00 degrees)
              • Set ManaStatus = (((Mana of (Picked unit)) / (Max mana of (Picked unit))) x (Real((Length of StateString))))
              • Floating Text - Create floating text that reads StateString at tempp2 with Z offset 0.00, using font size 4.00, color (0.00%, 0.00%, 100.00%), and 0.00% transparency
              • Set Mana_Txt[Mana_int] = (Last created floating text)
              • Floating Text - Show (Last created floating text) for (All players)
              • Custom script: call RemoveLocation(udg_tempp1)
              • Custom script: call RemoveLocation(udg_tempp2)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Mana_Unit[Mana_int] is Mechanical) Equal to True
                • Then - Actions
                  • -------- Mechanical --------
                  • Set Mana_Bar_String[Mana_int] = lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
                  • Set Mana_Real_BarLength[Mana_int] = (Length of Mana_Bar_String[Mana_int])
                  • Set Mana_Real_Offset[Mana_int] = 70.00
                  • Set Mana_Real_Z[Mana_int] = 142.00
                  • -------- ---------------- --------
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Or - Any (Conditions) are true
                        • Conditions
                          • (Mana_Unit[Mana_int] is A Hero) Equal to True
                          • (Mana_Unit[Mana_int] is an illusion) Equal to True
                    • Then - Actions
                      • -------- Heroes --------
                      • Set Mana_Bar_String[Mana_int] = llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
                      • Set Mana_Real_BarLength[Mana_int] = (Length of Mana_Bar_String[Mana_int])
                      • Set Mana_Real_Offset[Mana_int] = 52.00
                      • Set Mana_Real_Z[Mana_int] = 237.00
                      • -------- ---------------- --------
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Mana_Unit[Mana_int] is A flying unit) Equal to True
                        • Then - Actions
                          • -------- Flying unit --------
                          • Set Mana_Bar_String[Mana_int] = lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
                          • Set Mana_Real_BarLength[Mana_int] = (Length of Mana_Bar_String[Mana_int])
                          • Set Mana_Real_Offset[Mana_int] = 45.00
                          • Set tempp1 = (Position of Mana_Unit[(Integer A)])
                          • Custom script: set udg_Real_Z = GetLocationZ(udg_tempp1)
                          • Set Mana_Real_Z[Mana_int] = ((Current flying height of Mana_Unit[(Integer A)]) + (290.00 + (Real_Z / 2.00)))
                          • Custom script: call RemoveLocation(udg_tempp1)
                          • -------- ---------------- --------
                        • Else - Actions
                          • -------- Default Units --------
                          • Set Mana_Bar_String[Mana_int] = llllllllllllllllllllllllllllllllllllllllllllllllllll
                          • Set Mana_Real_BarLength[Mana_int] = (Length of Mana_Bar_String[Mana_int])
                          • Set Mana_Real_Offset[Mana_int] = 45.00
                          • Set Mana_Real_Z[Mana_int] = 137.00
                          • -------- ---------------- --------
            • Else - Actions
      • Custom script: call DestroyGroup(udg_Mana_Group)
  • Bars Loop
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to HP_int, do (Actions)
        • Loop - Actions
          • -------- Checks for signs of Life --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (HP_Unit[(Integer A)] is alive) Equal to True
              • HP_Unit[(Integer A)] Not equal to No unit
            • Then - Actions
              • -------- Implements the position of the bar for different types of units selected in the set-up triggers --------
              • Set tempp1 = (Position of HP_Unit[(Integer A)])
              • Set tempp2 = (tempp1 offset by HP_Real_Offset[(Integer A)] towards 180.00 degrees)
              • Floating Text - Change the position of HP_Text[(Integer A)] to tempp2 with Z offset HP_Real_Z[(Integer A)]
              • Custom script: call RemoveLocation(udg_tempp1)
              • Custom script: call RemoveLocation(udg_tempp2)
              • -------- Sets portion of health --------
              • Set HPstatus = (((Percentage life of HP_Unit[(Integer A)]) / 100.00) x (Real(HP_Real_BarLength[(Integer A)])))
              • -------- Re-Sets color for fading effect and amount/length of Hp. --------
              • Floating Text - Change text of HP_Text[(Integer A)] to (((HP_Bar_Color[(Integer((Percentage life of HP_Unit[(Integer A)])))] + (Substring(HP_Bar_String[(Integer A)], 1, (Integer(HPstatus))))) + |r) + ((|cff000000 + (Substring(HP_Bar_String[(Integer A)], (Integer((HPstatus + 1.00))), HP_Real_BarLength[(Integer A)] using font size 4.00
              • -------- Hides bars for units that are not visible to a player --------
              • -------- -------------------------------------------------------------------------- --------
            • Else - Actions
              • -------- Destroys bar on death --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • HP_Unit[(Integer A)] Not equal to No unit
                • Then - Actions
                  • Floating Text - Destroy HP_Text[(Integer A)]
                  • Set HP_Unit[(Integer A)] = No unit
                • Else - Actions
      • -------- ----------------------------Mana Bar Loop----------------------------------- --------
      • -------- This section works the same as above but just for the mana bars --------
      • For each (Integer A) from 1 to Mana_int, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Mana_Unit[(Integer A)] is alive) Equal to True
              • Mana_Unit[(Integer A)] Not equal to No unit
            • Then - Actions
              • Set tempp1 = (Position of Mana_Unit[(Integer A)])
              • Set tempp2 = (tempp1 offset by Mana_Real_Offset[(Integer A)] towards 180.00 degrees)
              • Floating Text - Change the position of Mana_Txt[(Integer A)] to tempp2 with Z offset Mana_Real_Z[(Integer A)]
              • Custom script: call RemoveLocation(udg_tempp1)
              • Custom script: call RemoveLocation(udg_tempp2)
              • Set ManaStatus = (((Percentage mana of Mana_Unit[(Integer A)]) / 100.00) x (Real(Mana_Real_BarLength[(Integer A)])))
              • -------- Sets color for fading effect --------
              • Floating Text - Change text of Mana_Txt[(Integer A)] to (((Mana_Bar_Color[(Integer((Percentage mana of Mana_Unit[(Integer A)])))] + (Substring(Mana_Bar_String[(Integer A)], 1, (Integer(ManaStatus))))) + |r) + ((|cff000000 + (Substring(Mana_Bar_String[(Integer A)], (Integer((ManaStatus + 1.00))), Mana_Real_BarLengt using font size 4.00
              • -------- -------------------------------------------------------------------------- --------
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Mana_Unit[(Integer A)] Not equal to No unit
                • Then - Actions
                  • Floating Text - Destroy Mana_Txt[(Integer A)]
                  • Set Mana_Unit[(Integer A)] = No unit
                • Else - Actions
  • Visibility Loop
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to HP_int, do (Actions)
        • Loop - Actions
          • -------- Checks for signs of Life --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (HP_Unit[(Integer A)] is alive) Equal to True
              • HP_Unit[(Integer A)] Not equal to No unit
            • Then - Actions
              • -------- --------------------------------------------------------------- --------
              • -------- ! These next loops are set for 2 players ---- change the varible if you add more players ! ! ! --------
              • -------- --------------------------------------------------------------- --------
              • Set NumberofPlayers = 2
              • -------- --------------------------------------------------------------- --------
              • For each (Integer B) from 1 to NumberofPlayers, do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (HP_Unit[(Integer A)] is visible to (Player((Integer B)))) Equal to True
                      • (HP_Unit[(Integer A)] is hidden) Equal to False
                      • ManaBars_On[(Player number of (Player((Integer B))))] Equal to True
                    • Then - Actions
                      • -------- Shows bars for units that are visible to a player --------
                      • Set Mana_PlayerB = (Player((Integer B)))
                      • Set Mana_PlayerGroup = (Player group(Mana_PlayerB))
                      • Floating Text - Show HP_Text[(Integer A)] for Mana_PlayerGroup
                      • Custom script: call DestroyForce(udg_Mana_PlayerGroup)
                    • Else - Actions
                      • -------- Hides bars for units that are not visible to a player --------
                      • Set Mana_PlayerB = (Player((Integer B)))
                      • Set Mana_PlayerGroup = (Player group(Mana_PlayerB))
                      • Floating Text - Hide HP_Text[(Integer A)] for Mana_PlayerGroup
                      • Custom script: call DestroyForce(udg_Mana_PlayerGroup)
            • Else - Actions
      • -------- ----------------------------Mana Bar Loop----------------------------------- --------
      • For each (Integer A) from 1 to Mana_int, do (Actions)
        • Loop - Actions
          • -------- Checks for signs of Life --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Mana_Unit[(Integer A)] is alive) Equal to True
              • Mana_Unit[(Integer A)] Not equal to No unit
            • Then - Actions
              • For each (Integer B) from 1 to NumberofPlayers, do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Mana_Unit[(Integer A)] is visible to (Player((Integer B)))) Equal to True
                      • (Mana_Unit[(Integer A)] is hidden) Equal to False
                      • ManaBars_On[(Player number of (Player((Integer B))))] Equal to True
                    • Then - Actions
                      • Set Mana_PlayerB = (Player((Integer B)))
                      • Set Mana_PlayerGroup = (Player group(Mana_PlayerB))
                      • Floating Text - Show Mana_Txt[(Integer A)] for Mana_PlayerGroup
                      • Custom script: call DestroyForce(udg_Mana_PlayerGroup)
                    • Else - Actions
                      • Set Mana_PlayerB = (Player((Integer B)))
                      • Set Mana_PlayerGroup = (Player group(Mana_PlayerB))
                      • Floating Text - Hide Mana_Txt[(Integer A)] for Mana_PlayerGroup
                      • Custom script: call DestroyForce(udg_Mana_PlayerGroup)
            • Else - Actions
  • Bars On Off
    • Events
      • Player - Player 1 (Red) types a chat message containing -Bars as An exact match
      • Player - Player 2 (Blue) types a chat message containing -Bars as An exact match
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ManaBars_On[(Player number of (Triggering player))] Equal to True
        • Then - Actions
          • Set ManaBars_On[(Player number of (Triggering player))] = False
        • Else - Actions
          • Set ManaBars_On[(Player number of (Triggering player))] = True
As with all floating text there is a limit of 100 at any time during a game. So if your map will require more than 100 bars this system will stop at 100. Also, if you use dummy units in triggered spells they must be neutral passive or they will get a HpBar. You can add exceptions to the system in the "Add Bars" trigger. Also, some units are very tall and the system does not adjust for this. KotG and Morphed Illidan are two units I know about. All other unit classes are accounted for. Besides the limitations I just mentioned this system provides classic HpBars and ManaBars with a simple cut and paste, it is leakless and clean. Enjoy!
By: Legal_Ease.


Needs update for GetLocalPlayer()
This will reduce the number of floating text dramatically and in effect increase the usefulness of this system by getting more use out of the 100 limit, making it a 100 limit for visible floating text bars per player rather than 100 total per map.

Attachments

  • HP & Mana Bar System (Legal_Ease).w3x
    52.5 KB · Views: 171
Last edited:
Top