Convert to percent goes wrong

Kazuga

Let the game begin...
Reaction score
110
Ok I got stuck on the easy part of the spell I'm making but I'm used to that. ^^ I have created a spell which absorbs x amount of damage for x amount of time, now I have also added a "mana bar" which displays the amount of strength left on the shield. Well, that's where the problem jumps in. The shield bar is displayed, but I can't seem to figure out to get the value into percent.

The SP[] variable is created and initialized in the absorbing shield trigger which works as intended.
Help would be most appreciated.

Credits goes to Sirroelivan for his Mana bar system. Link
(I'm using the exact same sort of system as the one he created and it's based on his.)

Code:
Trigger:
  • ShieldBar
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Set string = <Empty String>
      • Set UnitGroup = (Units in (Playable map area) matching (((Matching unit) has buff AAAbsorbShield ) Equal to True))
      • Unit Group - Pick every unit in UnitGroup and do (Actions)
        • Loop - Actions
          • Set integer = (Player number of (Owner of (Picked unit)))
          • Custom script: set udg_real = (SP[udg_integer])/200 //*200 because I want 50 %.*
          • 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
                  • real Greater than or equal to (Real((Integer A)))
                • Then - Actions
                  • Set string = (string + |cFFFF0000'|r)
                • Else - Actions
                  • Set string = (string + |cFF0000FF'|r)
          • Set points[1] = (Position of (Picked unit))
          • Set points[2] = (points[1] offset by 75.00 towards 270.00 degrees)
          • Floating Text - Create floating text that reads string at points[2] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
          • 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 RemoveLocation(udg_points[1])
          • Custom script: call RemoveLocation(udg_points[2])
      • Custom script: call DestroyGroup(udg_UnitGroup)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top