# RMMV Damage Formula - ideas and help

Discussion in 'RPG Maker MV' started by Shaz, Oct 25, 2015.

1. ### luigiman2201Villager

Messages:
16
2
First Language:
English
What is probably the problem is that

(b.def / (b.def + 100)always gives you a value between 0.999 and 0 so

a.atk * (1 - (b.def / (b.def + 100))will always be

a.atk * (1 - (number between 0.999 and 0)therefore multiplying your a.atk by a value between 0.999 and 0, which the game might round to 0

Try

a.atk * (2 - (b.def / (b.def + 100))Maybe that will work

2. ### gotnovicksVeteran

Messages:
76
9
First Language:
Portuguese
Primarily Uses:
N/A
but it'll make the atk higher (the result will be a number between 2 and 1).

The (b.def / (b.def + 100) should return a decimal

like in a % of physical damage.

If the target has 25 def it'll have 25/125 = 0.2 ~~ 20% of physical reduction :T

javascript always round down? in Ruby (VxAce) I used this code and it worked D:

3. ### DachimotsuVeteran

Messages:
61
12
Location:
Sharon, PA, USA
First Language:
English
I'm having trouble writing the damage formula I've decided on into MV.

Basically it works like this:

(a.X - b.def) * (a.Y / 2)

X is the total attack stat of the attacker, equipment bonus included,

while Y is the user's BASE attack stat, minus any bonuses granted by equipment.

How would one write this?

4. ### YouKnowAVillager

Messages:
10
6
First Language:
English
Well, crud. We'll get this eventually!

Now for some questions...

• 81 is which weapon? You may need to setup multiple arrays depending on different weapon types. I whipped up the below damage equation. 25-30 are the katanas (adding a.mat) while 19-24 are swords (adding a.agi). You could theoretically make arrays for every weapon.
var x = 1; var arr = [25, 26, 27, 28, 29, 30]; var arrb = [19, 21, 22, 23, 24]; for (var i = 0, len = arr.length; i < len; i++) {x += a.hasWeapon(\$dataWeapons[arr]) ? a.level + 2 * a.mat : 0; x += a.hasWeapon(\$dataWeapons[arrb]) ? a.level + 2 * a.agi : 0}; x += 2 * a.atk; x - 2 * b.def;
• x += + a.level + a.atk*2 should maybe just be x += a.level + a.atk*2
• Do you use your equation in a skill or somewhere else?
• The - b.def in the conditional statement may off balance the attack, but I'm not sure. It would mean that the target's defense would more greatly reduce the damage dealt if using weapon ID 81.

And, I'll probably be even slower on my responses for the next day or two... barring another bout of insomnia. XD

5. ### okugiVillager

Messages:
28
6
First Language:
English
Is that a direct cut and paste of the formula you use?  If so, your problem is you don't have a closing ) at the end.  You have 3 opening ( but only 2 closing )

Last edited by a moderator: Nov 5, 2015
6. ### okugiVillager

Messages:
28
6
First Language:
English
X would equal atk, so (a.atk - b.def) would be the first part of your equation.

As for Y, equipment bonus are added automatically, so without a plug in, there's no way to separate the base attack and equipment bonus in the formula bar.

7. ### huythekirbyWarper

Messages:
2
0
First Language:
English
I am new to RPG MAKER MV and Javascript so I am not sure if this is a dumb question or not but how do you use an eval code? If so, how do I check if an actor is having a specific state? Like if they have a "poison" state then the attack will deal more damage?

8. ### BloodletterQChaotic Neutral Assassin

Messages:
1,462
1,060
Location:
My head's in the clouds at least...
First Language:
English
Primarily Uses:
N/A
I decided to stop troubling you about it then. Most games still use Strength for bows anyhow and it'll just make archers' Strength useless. I'm just hoping that Yanfly's new plugin would let us use the dexterity stat for a hit rate and critical chance, making archers good for critical damage. Sorry about that.

9. ### KeroTaniVeteran

Messages:
180
14
Location:
Behind you, really turn around.
First Language:
English
I was trying to work on my damage formula so I set the Mdf of a enemy too 1 and my character has a magic stat of 70 or so but the spell will do 0 damage. It will start doing damage if I take off the mdf from the formula but I don't think it's supposed to work that way. Can anyone help with this.

10. ### stupid enough to like FF13Veteran

Messages:
587
316
First Language:
English
It would help if you provide the damage formula you're using.

11. ### KeroTaniVeteran

Messages:
180
14
Location:
Behind you, really turn around.
First Language:
English
Good point. (a.mat*2 - mdf). Crap I just looked and I didn't put the b. in front of the mdf part. I'm still new to this so I think i'm overlooking things.

12. ### DachimotsuVeteran

Messages:
61
12
Location:
Sharon, PA, USA
First Language:
English
OK, so if my current damage formula is impossible, then I'm gonna need help coming up with a replacement.

Therefore, I will list as much as I can about the stats in my game and the results I want out of them.

First, there's the average ATK stat the heroes will have at each level. At lv1, it's 40, and at lv50, it's 68. Not too drastic of an increase from 49 level-ups.

Second, there's the average DEF stat the enemies will have at each projected level. At lv1, it's 10, and at lv50, it's 38. Again, small numbers.

So, at lv1, you have (an average of) 40 ATK vs 10 DEF, and at lv50, you have 68 ATK vs 38 DEF.

Now, I'm trying to come up with a formula that will result in particular damage ranges at each of these levels. For level 1, I'd like the base damage (before variance) to be somewhere between 150-200. For level 50, somewhere between 550-750.

Any more experienced mathmeticians out there wanna solve this for me?

EDIT: I have discovered and perfected the perfect damage formula for my needs. Please disregard this post.

Last edited by a moderator: Nov 5, 2015
13. ### KeroTaniVeteran

Messages:
180
14
Location:
Behind you, really turn around.
First Language:
English
It would depend on how you wanted the math to work. at level one and an attack of 4 you formula would be (a.atk*5-b.def*2)  you would need to change your numbers a bit to get them to scale the way you want them. Having smaller numbers can work well but it makes hitting some numbers hard.

14. ### SeraVeteran

Messages:
80
16
First Language:
English
Let's say I have a skill where the formula is 100 + 50.

Without making a duplicate skill, is there a way to set it up so that if the person using the skill is an enemy, it becomes 100 - 50 instead?

15. ### DachimotsuVeteran

Messages:
61
12
Location:
Sharon, PA, USA
First Language:
English
I think we need more information than this. Where are the 100 and 50 coming from? If they're fixed numbers, why not just write 150 in the box?

Unless, of course, you're just using these numbers as examples. Either way, we need more information than this.

16. ### SeraVeteran

Messages:
80
16
First Language:
English
I was using them as examples, yes. In reality, the numbers being used were really complicated formulas.

But someone else actually helped me to figure this out a moment ago. The solution is:

s = a.isEnemy() ? -1 : 1; 100 + (50 * s)

17. ### RogdagoRVeteran

Messages:
127
29
Location:
Venice
First Language:
Italian
I'm trying to do some skill that is quite the same of your, did you figured out how to heal/buff all party members? I didn't find a reply in here about this, or maybe i'm blind lol.

I'm looking to do 2 "limit" skills that deals aoe damage to enemy, one as bonus heal the party and remove debuffs, and the other give bonus damage of 1 element....

Someone know how to apply heal/buff to entire party? I just need an example so i can figure out other kind of similar "limit" skill

Last edited by a moderator: Nov 5, 2015
18. ### okugiVillager

Messages:
28
6
First Language:
English
Would you mind posting what you ended up with?  Kinda curious what direction you went.

19. ### illuminaZeroWarper

Messages:
4
1
First Language:
English
I'm running with: (a.atk * 2) - ((b.def / 2) + (b.agi / 4))

In the game Heavy armor has high Defense and negative agility and light armors have low defense and positive agility.

Seems okay so far.

saikais likes this.

Messages:
107