Converting decimal to percent

zylack

New Member
Reaction score
15
Im making a trigger that shows your kills/death ratio in a percent. Only problem though is that it obviosly shows up in a decimal and its bugging me...anyone know how to convert this to a percent?
 

hobo218

Meh
Reaction score
75
Multiply that number by 100.
Then display the new one.

Set test2 = (test x 100)

Set the variables as an integer variable and adjust it accordingly for your KPD.
 

zylack

New Member
Reaction score
15
LMFAO THANK YOU SO MUCH i feel so stupid now :p +rep :D apparently it shows i fall a sleep in math class often...
 

zylack

New Member
Reaction score
15
Just a head up i hate to double post and all but multiplying the decimal by 100 dont work to convert it to a percent...i tried and if anyone wants to do it this is how i made it work.
Code:
Actions
        Set ([B]total number kill+deaths(interger)[/B])[(Player number of (Owner of (Killing unit)))] = ([B]Death_Count[/B][(Player number of (Owner of (Killing unit)))] + [B]Kill_Count[/B][(Player number of (Owner of (Killing unit)))])
        Set [B]real interger[/B][(Player number of (Owner of (Killing unit)))] = ((Real(Kill_Count[(Player number of (Owner of (Killing unit)))])) / (Real([B]totalnumber[/B][(Player number of (Owner of (Killing unit)))])))
        Set [B]FIRST DIGIT (string)[/B][(Player number of (Owner of (Killing unit)))] = (Substring((String([B]Real interger[/B][(Player number of (Owner of (Killing unit)))])), 1, 1))
        Set [B]second digit (string)[/B][(Player number of (Owner of (Killing unit)))] = (Substring((String([B]real interger[/B][(Player number of (Owner of (Killing unit)))])), 3, 4))
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Integer([B]First digit[/B][(Player number of (Owner of (Killing unit)))])) Equal to 0
            Then - Actions
                Set [B]Percent (string)[/B][(Player number of (Owner of (Killing unit)))] = (Integer([B]Second digit[/B][(Player number of (Owner of (Killing unit)))]))
            Else - Actions
                Set [B]Percent[/B][(Player number of (Owner of (Killing unit)))] = (Integer((1 + [B]Second Digit[/B][(Player number of (Owner of (Killing unit)))])))
    Else - Actions

Do this after your revival trigger if you have one or after dying unit event..also you must do this again for owner of dying unit.
 
O

OmgWtfBacon

Guest
That's pretty cool I might use it, and if I do I'll give you credit. :D
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top