# Damage formula HELP!

#### MilkyMcGee

##### Villager
Hey guys I am making a small game and I need help with the damage formula.
I only typed in the formula (a.atk - b.def) and the Variance 10% (does that mean that my character will make 10 damage and
- the enemy def)

And I noticed when I changed that the enemies are now dealing 0 damage to me, I also want the them to deal damage like me (10,20,30 damage).
I want the damage to be simple but it is a little bit confusing to get all this done or am I stupid hahahah

can someone help me out?

#### Aoi Ninami

##### Regular
Variance 10% means the result can be up to 10% above or below the value calculated from the formula.

For instance, with (a.atk - b.def), if your ATK is 100 and the enemy's DEF is 20, the outcome is 80, so the damage dealt can be anywhere from 72 to 88.

If you want to avoid the 0 damage problem by having a minimum damage of, say, 10, replace the formula with this:

Math.max(a.atk - b.def, 10)

What this does is calculate the normal damage, then if it's less than 10, it calculates the maximum of the damage and 10, which is 10. In effect, any outcomes less than 10 are replaced with the specific number 10. (Of course, you can replace 10 with any number of your choice.)

#### MilkyMcGee

##### Villager
Variance 10% means the result can be up to 10% above or below the value calculated from the formula.

For instance, with (a.atk - b.def), if your ATK is 100 and the enemy's DEF is 20, the outcome is 80, so the damage dealt can be anywhere from 72 to 88.

If you want to avoid the 0 damage problem by having a minimum damage of, say, 10, replace the formula with this:

Math.max(a.atk - b.def, 10)

What this does is calculate the normal damage, then if it's less than 10, it calculates the maximum of the damage and 10, which is 10. In effect, any outcomes less than 10 are replaced with the specific number 10. (Of course, you can replace 10 with any number of your choice.)

I noticed the 0 damage the enemies made was because i had items quiped and their damage was lower than my defense now i fixed it

is it a good idea to make say my character attack in the classes 20 and and then just make him equip weapons witch deal different damage for example ( my character does 20 damage and with a axe equipped witch deals 5 now he has 25 damage)

will It be a problem later in the game if I introduce stronger enemies?

#### ATT_Turan

##### Forewarner of the Black Wind
is it a good idea to make say my character attack in the classes 20 and and then just make him equip weapons witch deal different damage for example ( my character does 20 damage and with a axe equipped witch deals 5 now he has 25 damage)

will It be a problem later in the game if I introduce stronger enemies?
No one can answer this except you. You know what numbers you want to have in your game (do actors and enemies have 20 HP before they die? 100? 5,000?).

You have full control over how strong your enemies are. If adding 5 ATK would make them hit too hard, add less than that.

And, for that matter, you have full control over your damage formulae. There's zero reason that what you type in there now has to be the same as at the end of your project.

If you do a touch of Googling there are several threads dedicated to exploring how damage formulae act and explaining the math behind them.

#### MilkyMcGee

##### Villager
No one can answer this except you. You know what numbers you want to have in your game (do actors and enemies have 20 HP before they die? 100? 5,000?).

You have full control over how strong your enemies are. If adding 5 ATK would make them hit too hard, add less than that.

And, for that matter, you have full control over your damage formulae. There's zero reason that what you type in there now has to be the same as at the end of your project.

If you do a touch of Googling there are several threads dedicated to exploring how damage formulae act and explaining the math behind them.

Thank you I will check it out <3

I wanted to make it so the characters do not level up I am a little bit scared what will happen later in the game because I want to make it simple and do not want to mess something up later in the game

### Latest Profile Posts

Updated my game's development post with the first video of it in action!

'Milestone Get!'
Heh, heh. I've been experimenting with a naughty word detector Common Event and using scripts to check certain strings. I never thought I would see such language in computer code. I would post a screen shot, but it probably wouldn't be appropriate, even with a Spoiler. But it certainly makes me laugh and it works great.
Looooooonnnnggg maaaaannnnn
Yknow what? Im seriously considering recruiting a manager to oversee my games development.
Because I cannot focus or complete these tasks by myself. I need someone to give me orders, without having them be my boss.