# Making two variables equate a percentage?

#### TenebrisCrow

##### The Kelphy Corp
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)
Naturally the percent would be 50%

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

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

Good Variable = 927
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!

#### Andar

##### Veteran
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

#### TenebrisCrow

##### The Kelphy Corp
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.

### Latest Profile Posts

A surprising number of plugins have appeared for MZ since last year. I'm currently making a "shopping list" so that I'll know what I need to test when I switch over to MZ later this year. Much of it is stuff updated from MV plugins, but there are also a good number of new things. It'll be fun to test it all out.
A little dental dilemma this week. One my temp crowns was sized incorrectly and needs some sanding. And dentist was out till Tuesday. Pain is minimal though. Hope everyone here is well.
Got like a sudden surge of wish lists overnight.

The theory has been proved. Based on an invisible image's data(the big red dot in the previous image), RM can identify different parts of an enemy and do something respectively.
Ok.. coding what should be a simple "everyone is petrified and therefore dead, now go to game over screen" shouldn't involve needing to become Dr. J and dunking from the free throw line(my way of saying "jumping through hoops").