Download

Calculating win/loss percentage?

Need some help with the correct formula for calculating the win/loss percentage for my game. Currently, I divide the total games played by the number of wins, and then multiply by 100. This only worked when I did it the first time. (I did the loss percentage the exact same way). I had 1 win, zero losses, and 100% in the win column. Then I tested it again and intentionally failed. The total should have then been 1 to 1, and 50% in both. Instead, it was 1 to 1, and 0% in the win column and 200% in the losses. Any help?

eeaeaf2d2be18428ff12f475e57d49d911b4bad8.png

Do you have the other blueprints on how you are actually getting you’re results . The logic seems fine on that bp but without seeing everything together t’s hard to work out what’s going on .

So you work out win percentage then you work out loss percentage and then do what?

Also why would you need a seperate function you just need one if you know the win percentage then you can work out the loss percentage already and vice versa. Eg win percentage is 60 you just do 100- 60 = 40 so losses are 40 percent so why would you need to have another function working out the loss percentage ?

You are dividing games won by games played.
Look at your own screenshot…

You should use float operators rather than ints or your divide op will probably floor to zero.

Looking at that graph, I think these problems could be solved by writing a little script.
Unfortunately Unreal has only hard-to-get-thru C++ or Visual Scripting and nothing inbetween.

you Need to use floats.
Integer Division cuts the decimal places (Basic math btw.)

1/2 (= 0.5) = 0 (with integers)

Why are people speculating random answers from one bp screengrab. There is not enough information here to determine what is happening or why it is happening so posting random stuff is not goimg to help. The only way to solve this is for op to debug his bp and find the answers himself . There is nothing wrong with the function he posted . I suspect either the vuse being fed in are incorrect to begin with so maybe they are not being loaded correctly from the bpsaveactor variable or the op is doing something wrong with the variables after they have been calculated . The only way to know for sure is to investigate/debug . Put print strings after each variable and breakpoints step through the function one piece at a time and see if the variables are doing what they are supposed to do if they are fine then the problem is somewhere else