# How can I make Defense into a percent reduction?

#### GolvaeGames

##### Veteran
I would like to have the damage formula reduce damage by a percent value, which would be the targets defense. Ideally it would be 1 def = 1% reduction. Is this possible?

#### magnaangemon01

##### Miles Montgomery
I don't have my computer in front of me, but I want to say there's a way to change defense in the class tab of your database.

#### rainyday

##### Veteran
Say your damage formula is equal to 4 times the user's attack, a.atk * 4. In order to reduce it by defense, you'd put
Code:
``(a.atk * 4) * ((100 - b.def)/ 100)``
in the formula box.

#### Doktor_Q

##### I'm not a real doktor, but I am a real Q
The effect of defense on damage is entirely dependent on the damage formula you write for the skill. So, the default damage formula is
Code:
``a.atk * 4 - b.def * 2``
which subtracts twice the target's defense from four times the user's attack.

An example formula where your damage is based purely on the user's attack and loses 1% per defense the target has, you'd do a formula more like this
Code:
``a.atk * (1.0 - b.def/100)``
If you have 50 attack and the enemy has 10 defense, that becomes "50 * (1 - 0.1)", or "50 * 0.9" which means you deal 90% damage.

There's not one singular place that controls the damage formulas, you need to write them for each skill. Another option is to use resistances, like resistance to an element, or physical / magical resistance, instead of giving characters a defense stat. Resistances can be modified as Trait in the list on the right for actors, classes, enemies, equipment, and status effects.

#### magnaangemon01

##### Miles Montgomery
Oops. I was so sleepy I missed the target's defense part so my answer was irrelevant. My apologies.

#### GolvaeGames

##### Veteran
Thank you so much, I couldn't figure out the syntax, everything I typed in put out some wonky numbers

### Latest Profile Posts

Making games is the only thing I'm good at. Real talk.
So, uh... where's the RPG Maker MZ update with the MV animation system? Is there a release date confirmed?
Also I'm kind of brave enough to admit this. I... I have a crush on Sephiroth.
Please don't call me anything offensive. I'm naturally crazy.
thanks to a lot of lunatic coding... my game finally has a stun mechanic that I feel really good about. damage enemy's mental psyche (mp), and once empty, hitting with certain attacks trigger combos that can stack the damage.
Waiting for the 1.40 update before testing out my copy of MZ so that I don't end up adding unnecessary work to my plate. Meanwhile the current fourth draft for my story is taking shape, and I'm fleshing out the lore as I realize how things would make better sense here and there for the world that I'm building.
Just found out about your complications. I'm so sorry that you're going through this. I wish I could do something substantial for you, but our distance from each other makes that an impossibility. Still, if you ever need to talk or vent, I'm here.