• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Trigger] Mana bars above units

Status
Not open for further replies.
Level 6
Joined
Sep 9, 2006
Messages
92
I'm trying to make a GUI floating text display of a bar showing the amount of mana above all units with mana; currently my triggering is messed up somewhere in the arrays/loops and the only thing in-game it does is lag up. Here's the trigger:

Mana bar
Events
-Time - Every 0.04 seconds of game time
Conditions
Actions
-Set ManaInt[1] = 0
-Unit Group - Pick every unit in (Units in (Playable map area)((Max mana of (Matching unit)) Greater than 0.00)) and do (Actions)
--Loop - Actions
---Set ManaInt[1] = (ManaInt[1] + 1)
---Set ManaUnit[ManaInt[1]] = (Picked unit)
---Set ManaTextCount[ManaInt[1]] = 0
-Set ManaGroup = (Last created unit group)
-For each (Integer B) from 1 to ManaInt[1], do (Actions)
--Loop - Actions
---Set ManaPoint[(Integer B)] = ((Position of ManaUnit[(Integer B)]) offset by ((FTSize[2] - (FTSize[2] x 1.50)), 0.00))
---For each (Integer A) from 1 to 100, do (Actions)
----Loop - Actions
-----Floating Text - Destroy FTTESTText[ManaTextCount[(Integer B)]]
-----Set ManaTextCount[(Integer B)] = (ManaTextCount[(Integer B)] + 1)
-----If (All Conditions are True) then do (Then Actions) else do (Else Actions)
------If - Conditions
-------(Integer((Percentage mana of ManaUnit[(Integer B)]))) Greater than or equal to (Integer A)
------Then - Actions
-------Floating Text - Create floating text that reads I at ManaPoint[(Integer B)] with Z offset 192.00, using font size FTSize[1], color (0.00%, 40.00%, 100.00%), and 0.00% transparency
------Else - Actions
-------Floating Text - Create floating text that reads I at ManaPoint[(Integer B)] with Z offset 192.00, using font size FTSize[1], color (10.00%, 10.00%, 10.00%), and 0.00% transparency
-----Set FTTESTText[ManaTextCount[(Integer B)]] = (Last created floating text)
-----Set ManaPoint[(Integer B)] = (ManaPoint[(Integer B)] offset by ((FTSize[2] / 100.00), 0.00))
---Custom script: call RemoveLocation (udg_ManaPoint[GetForLoopIndexB()])
---Custom script: set udg_ManaUnit[GetForLoopIndexB()] = null
-Custom script: call GroupClear( udg_ManaGroup )
-Custom script: call DestroyGroup( udg_ManaGroup )

IDK if u can use spaces at the beginning to make it neater and indented so i went ahead and used dashes
 
Level 16
Joined
Mar 26, 2004
Messages
569
7 Variables:
ManaFloatingTextFloating Text

ManaUnit
Integer

ManaValue
Integer Array

ManaPosition
Point Array

ManaGauge
String Array

ManaString
String Array

ManaGrp
Unit Group

  • Do Multiple ActionsFor each (Integer A) from 1 to 10, do (Actions)
    • Loop - Actions
      • Set ManaString[(Integer A)] = (I + ManaString[((Integer A) - 1)])
  • ManaBar
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • Do Multiple ActionsFor each (Integer A) from 1 to ManaUnit, do (Actions)
        • Loop - Actions
          • Floating Text - Destroy ManaFloatingText[(Integer A)]
      • Unit Group - Remove all units from ManaGrp
      • Set ManaUnit = 0
      • -------- --------
      • Set ManaGrp = (Units in (Playable map area))
      • Unit Group - Pick every unit in ManaGrp and do (Actions)
        • Loop - Actions
          • Set ManaUnit = (ManaUnit + 1)
          • Set ManaPosition[ManaUnit] = ((Position of (Picked unit)) offset by (-20.00, 0.00))
          • Set ManaValue[ManaUnit] = ((Integer((Percentage mana of (Picked unit)))) / 10)
          • Set ManaGauge[ManaUnit] = ((|cff648bcb + ManaString[ManaValue[ManaUnit]]) + (|cff303030 + ManaString[(10 - ManaValue[ManaUnit])]))
          • Floating Text - Create floating text that reads ManaGauge[ManaUnit] at ManaPosition[ManaUnit] with Z offset 190.00, using font size 8.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
          • Set ManaFloatingText[ManaUnit] = (Last created floating text)
          • Custom script: call RemoveLocation (udg_ManaPosition[udg_ManaUnit])
 
Last edited:
Status
Not open for further replies.
Top