# Help with attack skills

#### Telemindred

##### Telemindred the Archmage
So I've been messing around with the damage formulas for a bit, but I still don't fully understand them. I tried doing basic stuff in order to create an attack that I could predict the damage of as the developer (even created test characters and monsters with specific attack stats that I could track the multiplication of) but still have yet to create a skill which doesn't deal 100 - 1000 points of damage. The reason I want to be able to accomplish this is so that I can create a balanced system of attacks and skills and spells, with each new set being stronger than the previous ones. You could say a set of skills sorted into tiers of strength.
With that in mind, I have a few questions regarding said formulas and other influencing areas like states and stats.

Type and element I already understand.

In the explanation for the formulas, the first thing I noticed was a contradiction: It says not to input anything regarding defense or element as those are determined elsewhere, but in the default attack skill it has b.def * 2. So for this question, I'd like to know what a.atk * 4 - b.def * 2 is doing exactly, as well as: is it possible to view/edit how defense and element are handled regarding these skills, or is that beyond my control?

Context for the third question: I tried to control the exact amount of damage for the formula (a.atk * 4 - b.def * 2) by creating a test character with an attack power of 4, and an enemy with a defense of 2. How I originally thought it worked, was the attackers atk (4) would be multiplied by 4 (16), which would then be subtracted by the target's defense (2) which is multiplied by 2 (4) resulting in 12 points of damage. I had even removed variance and critical, but it still ended up with huge numbers like before. My question is did I misunderstand how that formula actually works, or is it that attack power has a higher stat than it shows (1 atk stat = 5 damage, etc.), or was it something else I missed or misunderstood?

Does the normal attack state add more damage to the attack? Or does it just control the general percent chance of the attack actually hitting it's mark?

I've been getting better at this rpgmaker, but I'm still new to this field and am still trying to learn coding/scripting. So this problem I ran into is a real head scratcher for me. Hence why I'm asking for help and advice in the forums.

#### Sheklon

##### Veteran
Did you make sure to have no weapons and armor involved in your test? I can't see why the formula a.atk * 4 - b.def * 2 wouldn't work. It works for me.

Also, regarding defense and elements, it might be worded weirdly, but it's mostly talking about special resistances and effects from states or skills. For example, if you set your attack formula to:
600
It will deal 600 damage regardless of anything else.
However, if the formula is "600", but it's set as "Fire" elemental skill and you're attacking an enemy which has a state where he takes 50% less damage from the "Fire" element, the total damage dealt in the end will be 300. You don't need to add that special condition to the formula.

#### Yuki_P

##### Villager
Maybe you had a problem in script which changed your damage calculation process

Try to make a new project and don't add any script

Then try your skill configuration again until you get what you wanted

#### Telemindred

##### Telemindred the Archmage
I decided to start with the equipment possibility, and for the most part it's a lot more manageable. Instead of hundreds of numbers it's down to 11. Still haven't figured out how that's happening (no elemental adjustments, no gear, no unique skills or stat increases, both actor and monster have 100% hit -100% eva, 4 atk & 2 df), so it should be coming out as 4x4=16-(2x2=4)=12, not 11. But it's a small enough difference for me to work with.

However, I'm now faced with another problem. I made more skills to test the general differences (x2, x4, x6, x8, x10 dmg attack skills). When I went to test them, randomly when I initialized the 'test battle', none of my attacks would ever hit home. They would either miss, despite the monster having -100% eva and the actor having 100% hit, or it would come out as null.

The skills are special, they have the 'normal attack' state at 100%. I haven't checked my scripts just yet, but I don't think they're affecting anything... Just about all of them require me to input commands in the 'note' sections of the actors, skills, items, equipment, monsters, etc. to actually affect anything.

#### Sheklon

##### Veteran
Yeah, I would also recommend to just go with a new project to make tests, like @proxydef said. It seems you have made modifications to your configs and now it's gonna be hard to pin down what exactly is wrong, even more so if you do it backwards.

Open a fresh project with no scripts, test it again. If everything works, slowly add each script that your original project has and keep tracking if everything is still fine. This should give you a much better knowledge about whatever is happening.

#### A-Moonless-Night

##### WINTER IS COMING
Here's something you can use to debug your damage stuff:
Ruby:
``````class Game_Battler < Game_BattlerBase

def make_damage_value(user, item)
value = item.damage.eval(user, self, \$game_variables)
puts "Initial value: #{value}"
value *= item_element_rate(user, item)
puts "Value after elements: #{value} | element rate = #{item_element_rate(user, item)}"
value *= pdr if item.physical?
puts "Value after PDR: #{value} | PDR = #{pdr}" if item.physical?
value *= mdr if item.magical?
puts "Value after MDR: #{value} | MDR = #{mdr}" if item.magical?
value *= rec if item.damage.recover?
puts "Value after REC: #{value} | REC = #{rec}" if item.damage.recover?
value = apply_critical(value) if @result.critical
puts "Value after critical: #{value}" if @result.critical
value = apply_variance(value, item.damage.variance)
puts "Value after variance: #{value} | variance = #{item.damage.variance}"
value = apply_guard(value)
puts "Value after guard: #{value} | guard = #{guard?}"
puts "Final value: #{value.to_i}"
@result.make_damage(value.to_i, item)
end

end``````

Put that as a new script below Materials and above Main. If you enable the console and then go into a battle, you'll see what the damage value is as it calculates through each thing. Remove it before you release your game, and also bear in mind that it may not work with other damage-related scripts.

Basically, the game takes the initial damage value (whatever you put in the damage formula box) and then applies things in the following order:
1. multiplies the value by the skill/item/user's element rate
2. multiplies the value by the target's PDR (if it's a physical skill)
3. multiplies the value by the target's MDR (if it's a magical skill)
4. multiplies the value by the target's REC (if it's a recovery skill)
5. multiplies the value by 3 if it was a critical hit
6. adds/subtracts the variance for the item/skill
7. divides the value by the target's GRD multiplied by 2 if they were guarding
Then it outputs the result rounded down to the nearest integer (e.g. 1.9 becomes 1).

#### Telemindred

##### Telemindred the Archmage
Thank you very much! The phenomenon of the 'null damage' result seems to be slim, though the 'miss' factor is still a thing. I've looked through the scripts and can't find anything that would mess the calculations up, but the miss factor isn't too big a deal. I'll keep looking nonetheless. Thank you everyone for all your help!

And thank you Moonless Night, both for the script and for explaining the process the system goes through to calculate damage ^-^

### Latest Profile Posts

Took some trial and error, but I managed to create "visuals" for underground dig path regions.
Couldn't sleep at all so I started working on the topmost deck. I've had to make several deviations from the Imperator/Berengaria's deck-plans to accommodate MV's movement, but 100% accuracy was never my intention.
Still no name for the poor ship...

Here's Mike when you get a preemptive strike in battle. There's another one for when an enemy sneaks up on you too.
Suddenly, games mean nothing. The money spent was worth it to bring souls towards the light of life. May God bless my path forever. I pray that all are shaken for truth and poured out flat on the table of true understanding, knowledge, and wisdom. Bless you.