Sirroelivan
Gunnerkrigg Court
- Reaction score
- 95
Here's a very simple trigger to add a floating mana bar above units. It uses only 4 variables, pg(player group), ug (unit group),p (point array) and mana (integer). To change the color of the mana bar change the color code in the bold part. Hope someone finds a use for it.
Code:
Mana Trigger
Events
Time - Every 0.03 seconds of game time
Conditions
Actions
Set ug = (Units in (Playable map area) matching ((((Matching unit) is alive) Equal to True) and ((Max mana of (Matching unit)) Greater than 0.50)))
Unit Group - Pick every unit in ug and do (Actions)
Loop - Actions
Set String = <Empty String>
Set Mana = (Integer(((Percentage mana of (Picked unit)) / 2.00)))
For each (Integer A) from 1 to 50, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Mana Greater than or equal to (Integer A)
Then - Actions
Set String = (String + |cff0000FF'|r)
Else - Actions
Set String = (String + ')
Set p[1] = (Position of (Picked unit))
Set p[2] = (p[1] offset by (-75.00, 0.00))
Floating Text - Create floating text that reads String at p[2] with Z offset 210.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
Set pg = (All enemies of (Owner of (Picked unit)))
Floating Text - Hide (Last created floating text) for pg
Floating Text - Change (Last created floating text): Disable permanence
Floating Text - Change the lifespan of (Last created floating text) to 0.06 seconds
Custom script: call DestroyGroup(udg_ug)
Custom script: call DestroyForce(udg_pg)
Custom script: call RemoveLocation(udg_p[1])
Custom script: call RemoveLocation(udg_p[2])