Making two variables equate a percentage?

I'm trying to make two variables equate to a percentage. I'm trying to make a good and evil system where 1 point can be added to evil, and 1 point can be added to good. I'll show an example hopefully this makes sense what I'm trying to do.

Good Variable = 77 (Suppose they did 77 good things)
Bad Variable = 77 (And 77 bad things)
Naturally the percent would be 50%

Good Variable = 9
Bad Variable = 1
90%??? (Not 100% sure if that's correct, but I want to find out a way to solve it within game)

Good Variable = 1
Bad Variable = 9
10%??? (Not 100% sure if that's correct, but I want to find out a way to solve it within game)

Good Variable = 927
Bad Variable = 400
So the percent would be ??? I need a way using variables to work this out for me in game to figure out if the person does more evil things through %. So if they're at 90% then they do many good things, and if they are 10% they do many bad things.


I'd need the % to go downwards all the way to 0% if they ONLY did good things. Also I'd need it to go all the way up to 100% if they ONLY did good things.
Sorry this is a really tough question and really hard to explain. Hopefully you understand.
I apologize if this question annoys you I can not think of any other way to explain it.

Any help would be truly appreciated! Thank you!
You'll need to get back on your mathematics.

Basically % = 100 * Value / total
and total = bad + good

In your last example that would be
good% = 100 * 927 / (400+927) or 69.8%

That can be calculated with a simple series of control variable command, although you'll need some temp variables for the intermediate parts of the calculation
You'll need to get back on your mathematics.

Basically % = 100 * Value / total
and total = bad + good

In your last example that would be
good% = 100 * 927 / (400+927) or 69.8%

That can be calculated with a simple series of control variable command, although you'll need some temp variables for the intermediate parts of the calculation

Worked perfectly, honestly I was starting to believe it wasn't possible with RPG Maker, you made my day thank you! You're right though, I do need to get back onto my mathematics. I knew about finding a percent with one number, that's easy, but I wasn't sure how to use two.

Original thread: https://forums.rpgmakerweb.com/threads/making-two-variables-equate-a-percentage.78683/