RMMV Damage Formula - ideas and help

● ARCHIVED · READ-ONLY
Started by Shaz 1539 posts Page 26 of 77 View original ↗
  1. After looking around for a good while, im not sure where else to put this.


    im trying to make a formula for basic attacks that is just, eluding me, so bad.


    basically what i want, is for the attackers attack, to never exceed their attack stat, so if they have 50atk, they can do, at most, 50dmg without a crit hit. Though I also want them to almost never be able to do 0 dmg even if the enemies defense is 5x higher than the attackers attack stat. I'd like it to work in some kind of percentile value, like, idk, if the attackers atk is the same as the defenders def, than the attacker does around 50% of their attack stat as dmg. but if the defenders def is twice the attackers atk, then the attacker only does like, idk, something around 20-30% of their atk stat, and if the defender is 3x higher than the atk, then it's even lower % of the attackers atk. On the flip side, if the atk is higher than def, obviously i want the percent higher, but i never want to exceed 100% of the attackers attack stat, and i just cannot seem to manage it x.x


    is a formula for something like this even possible?
  2. Jojozityjo said:
    After looking around for a good while, im not sure where else to put this.


    im trying to make a formula for basic attacks that is just, eluding me, so bad.


    basically what i want, is for the attackers attack, to never exceed their attack stat, so if they have 50atk, they can do, at most, 50dmg without a crit hit. Though I also want them to almost never be able to do 0 dmg even if the enemies defense is 5x higher than the attackers attack stat. I'd like it to work in some kind of percentile value, like, idk, if the attackers atk is the same as the defenders def, than the attacker does around 50% of their attack stat as dmg. but if the defenders def is twice the attackers atk, then the attacker only does like, idk, something around 20-30% of their atk stat, and if the defender is 3x higher than the atk, then it's even lower % of the attackers atk. On the flip side, if the atk is higher than def, obviously i want the percent higher, but i never want to exceed 100% of the attackers attack stat, and i just cannot seem to manage it x.x


    is a formula for something like this even possible?



    Of course it is. Just decide how you want it to work, we can work out something.
  3. Riff said:
    Of course it is. Just decide how you want it to work, we can work out something.



    Well, i would like it to be something like a mitigation system. Like, if you have the same def as your attackers atk, then you only take 50% of the damage, but if you have higher def than your attackers attack, then you take less and less, 49%, 48%, 30% even down to 1% of the total dmg. On the flip side, if your attacker has more atk than you do def, then you take more and more, up to 99-100% of the attackers atk stat. The more atk part is where im having trouble. I keep finding formula's that work for more def, but when you get more atk, it ends up going over 100% value so an attacker with 100 attack can end up doing 200dmg without any crits or elemental weakness exploits.


    I would also like it flexible somehow, for skills, so if i have skills that like "this skill attacks with +20% extra atk stat!" and ones like, "this skill adds 500dmg onto your attack" etc etc. I could kinda imagine how i could squeaze those into a formula, but that's only with what i can do with formula's, which, obviously isnt working otherwise i wouldnt be here asking for help lol XD
  4. Jojozityjo said:
    Well, i would like it to be something like a mitigation system. Like, if you have the same def as your attackers atk, then you only take 50% of the damage, but if you have higher def than your attackers attack, then you take less and less, 49%, 48%, 30% even down to 1% of the total dmg. On the flip side, if your attacker has more atk than you do def, then you take more and more, up to 99-100% of the attackers atk stat. The more atk part is where im having trouble. I keep finding formula's that work for more def, but when you get more atk, it ends up going over 100% value so an attacker with 100 attack can end up doing 200dmg without any crits or elemental weakness exploits.


    I would also like it flexible somehow, for skills, so if i have skills that like "this skill attacks with +20% extra atk stat!" and ones like, "this skill adds 500dmg onto your attack" etc etc. I could kinda imagine how i could squeaze those into a formula, but that's only with what i can do with formula's, which, obviously isnt working otherwise i wouldnt be here asking for help lol XD



    I get the rough picture, but still need a bit more clarity. From what i understand, you're saying


    If a.atk = b.def, deal 50% damage


    If a.atk > b.def, deal 50% - 100% damage


    If a.atk < b.def, deal 0% - 50% damage


    What i'm missing here is how is your damage calculated. Is the damage a fixed value for each skill and scales with the above rules (ignoring crit/elemental modifiers)?
  5. here is how you would do it


    Math.Min(a.atk, a.atk*(a.atk/(b.def*2)))


    How it works is a.atk is times by the ratio of atk verse def, times the def by 2 means that when atk = def the value is atk*0.5


    Math.Min means you take the lower number, so if the formula is more then a.atk it will instead set it as a.atk
  6. Not entirely sure what you mean Riff, what i would like, is for that to be the base calculation for all atks, be it atk vs def or matk vs mdef, or even atk vs mdef, and then skills, if they add anything to it, will alter the formula, like some of my skills will basically attack with 50% more of the attackers attack stat, so not only is the dmg done higher, it also reduces teh mitigation the defender has, skills that would be useful for high def targets.


    i would never have guessed that gamma, the whole, math.min, math.max, other codes like that are foreign to me lol


    that calculation though, ill use that for default attacks, how exactly would i add variations to it like i mentioned above?


    Such as, my Technique, "Overpower Slam" would basically attack a target with 50% more atk value, does that mean id make the calculation for that skill something like ...


    Math.Min((a.atk*1.5), (a.atk*1.5)*((a.atk*1.5)/(b.def*2)))


    ?


    and what of another technique, "Mana Fused Strike" where it combines the attackers m.atk with their atk to get the atk value, would it be something like ....


    Math.Min((a.mat+a.atk), (a.mat+a.atk)*((a.mat+a.atk)/(b.def*2)))


    ?


    and one more to help see if i got editing the formula for skills right, another technique, that attacks, but uses either the targets def or mdef, whichever is lower, would i do that calculation like this ...


    Math.Min(a.atk, a.atk*(a.atk/Math.Min(b.def*2), (b.mdf*2)))


    ?
  7. I must have missed something. Let's see if this is what you're looking for:


    var value = a.atk*2;
    var scale = 0.5 + (a.atk - b.def)/b.def;
    scale = scale.clamp(0, 1.0);
    value *= scale;


    Or in one line:


    var value = a.atk*2; var scale = 0.5 + (a.atk - b.def)/b.def; scale = scale.clamp(0, 1.0); value *= scale;


    That clamp function is the min and max functions in one. So it'll never go below 0 and above 1. Feel free to change the min/max value to 1.2 or never less than 0.5, up to you. You can also change the basic damage formula (first line).


    Still raw, but just tell me what sort of adjustment you'd like to make and we'll see if we can help.


    - Riff
  8. that formula is running circles around me.


    what does the "var value" and "var scale" do to the equation exatly? and when you say, clamp function, is that the entire "scale = scale.clamp" thing?


    cause im trying to do the math in my head, to see what stuff like, 100atk vs 200def would equal in that equation, but im not sure lol
  9. Jojozityjo said:
    that formula is running circles around me.


    what does the "var value" and "var scale" do to the equation exatly? and when you say, clamp function, is that the entire "scale = scale.clamp" thing?


    cause im trying to do the math in my head, to see what stuff like, 100atk vs 200def would equal in that equation, but im not sure lol



    The 'var's declare new variables to be used. Not really necessary, but it's a good practice, i remember.


    Yeah, 'clamp' is basically Math.min and Math.max, both in one.


    Let's use your info:


    a.atk = 100;


    b.def = 200;


    var value = a.atk*2;var scale = 0.5 + (a.atk - b.def)/b.def;scale = scale.clamp(0, 1.0);value *= scale;


    So, the calculation:


    value (base damage) should be 200,


    scale should be 0.5 + (100 - 200)/200, so that's 0. Third line will clamp it to 0 (it's already 0 anyway).


    So end damage is 200 * 0 = 0.


    If a.atk is 100, b.def is 100,


    value (base damage) should be 200,


    scale should be 0.5 + (100 - 100)/100, so that's 0.5. This scale result doesnt go below 0 or 1, so no clamping effect.


    So end damage is 200 * 0.5 = 100.


    If a.atk is 100, b.def is 50,


    value (base damage) should be 200,


    scale should be 0.5 + (100 - 50)/50, so that's 1.5. Since this is higher than 1, the value will be clamped to 1.0.


    So end damage is 200 * 1 = 200


    Hope these 3 examples explain the effect of the formula.


    - Riff
  10. that does explain it more clearly. So the, var value, basically makes it so it can varry, kinda like how the Variance setting in skills does so it can do -20% to +20% of the result.


    though i think Gamma's formula is closer to what id like, with yours, if atk vs def is even, then do full attack dmg basically, when id like a dead even stat vs stat to be about half the total atk stat as dmg, so the def stat has more worth in the even grounds.


    i like the clamp thing though, could i replace the "Math.Min(a.atk, a.atk*(etc))" with something like "Clamp(0.1, 1.0); a.atk*(a.atk/(.b.def*2))" ?


    also id still like to know if my formula's were right for the above mentioned skills, ill quote it below :o

    Jojozityjo said:
    Such as, my Technique, "Overpower Slam" would basically attack a target with 50% more atk value, does that mean id make the calculation for that skill something like ...


    Math.Min((a.atk*1.5), (a.atk*1.5)*((a.atk*1.5)/(b.def*2)))


    ?


    and what of another technique, "Mana Fused Strike" where it combines the attackers m.atk with their atk to get the atk value, would it be something like ....


    Math.Min((a.mat+a.atk), (a.mat+a.atk)*((a.mat+a.atk)/(b.def*2)))


    ?


    and one more to help see if i got editing the formula for skills right, another technique, that attacks, but uses either the targets def or mdef, whichever is lower, would i do that calculation like this ...


    Math.Min(a.atk, a.atk*(a.atk/Math.Min(b.def*2), (b.mdf*2)))


    ?
  11. Overpower:  Math.Min((a.atk*1.5), (a.atk*1.5)*(a.at)/(b.def*2))); if you do the times in the middle you will have 2.25 times the atk


    Mana Fused Strike: this one depends on how you want vs the damage


    A ) take the combined total (mat+atk), however this means the base value will double or triple


    eg. if mat=10, atk=10 and def=10 then: (10+10)*((10+10)/(10*2))


    20*(20/20)=20


    B ) take the average (mat+atk)/2, this in my mind makes more sense for a character with very low atk but high mat since you are calculating against def only


    eg. if mat=10, atk=10 and def=10 then: (10+10)/2*((10+10)/2/(10*2))


    10*(10/20)=5


    C ) just increase the end damage by mat


    eg. if mat=10, atk=10 and def=10 then: (10+10)*(10/(10*2))


    20*(10/20)=10


    note: B will change drastically if you change mat or atk, I'd say test these out with different numbers to see which works best


    Math.Min(a.atk, a.atk*(a.atk/ Math.Min(b.def*2, b.mdf*2)) this will do exactly what you thing it does, just be careful with your brackets (you were missing a '(' ), you don't need to use brackets in Math.Min(x+y, x+z) I only used them so you get the difference between atk and def first


    The main thing is atk/def, this means you never get 0 damage, but their is a flaw, if you don't multiple the result then the damage will be the same for 10/5 and 100/50 (both equal 2)


    so 10*(10/5)=20, 100*(100/50)=200
  12. hmm, so for Overpower: Math.Min((atk*1.5), (a.atk*1.5)*(a.atk/(b.def*2)))


    wouldnt that basically make the attack have the same mitigation % as a normal attack? Like, 100atk vs 100def is 50% mitigation, but with that formula for Overpower, wouldnt it still be 50% mitigation? Instead of 150atk(the 50% more atk bonus from Overpower) vs 100def = 75% mitigation, so instead of 75Dmg with the default mitigation, it would do 112Dmg with the 75% mitigation?


    As for Mana Fused Strike, for that move in particular i would like the combined total of matk and atk, it's suppose to be a powerful attack, or an atk meant to make mage types be able to do some form of dmg through the targets Def stat. So for your Option A, the formula should be ...


    Math.Min((a.mat+a.atk), (a.mat+a.atk)*((a.mat+a.atk)/(b.def*2)))


    and let me see if i got option B right as well cause that is another form of atk id be using in another skill. The formula should look like this right? ...


    Math.Min((a.mat+a.atk)/2, ((a.mat+a.atk)/2/(b.def*2)))


    and for C im confused, too many 10's, not sure which 10 is which stat lol


    but despite my dyslexia, and assuming you meant option c as basically a basic atk, but just adding the Matk stat onto it as extra dmg that bypasses the mitigation mark, lets see if i got the formula for it ...


    Math.Min((a.mat+a.atk), (a.atk/(b.def*2)+m.atk))


    as for the either def or mdef, i got that one right? least i got one right XD


    posting it again to make sure i got the bracket thing down...


    Math.Min(a.atk, a.atk*(a.atk/ Math.Min(b.def*2, b.mdf*2))


    basically i dont need to bracket off the "def*2" "mdf*2" parts after a Math.Min?


    NOTE: sorry if im troublesome, im a dyslexic person who is doing math, so i may be a lil hard to understand what you are exactly pointing out, plus all the formula's with all the brackets can be rather hard for me to make sure i got the brackets and * and / all in the right places without reading it over about a dozen times lol
  13. Thats fine


    the reason I went  Math.Min((atk*1.5), (a.atk*1.5)*(a.atk/(b.def*2))) is as follows


    atk = 15, def = 5


    a.atk * ( a.atk / ( b.def * 2 ) ) [Normal Attack]


    15 * (15 / ( 5 * 2 ) )


    15 * 3 = 45


    (a.atk * 1.5 ) * ( a.atk / ( b.def * 2  )) [Overpower]


    ( 15 * 1.5 ) * (15 / ( 5 * 2 ) )


    22.5 * 3 = 67.5 [the game will round up to 68]


    If Overpowered is 50% greater than a Normal Attack then the damage difference should equal 1.5


    67.5 / 45 = 1.5


    You seem too understand the rest fine but I should make sense of why B was weird


    lets say atk is 10 and mat is 30, def can be 5


    ( ( a.mat + a.atk ) / 2 ) * ( ( ( a.mat + a.atk ) / 2 ) / ( b.def * 2 ) )


    ( 10 + 30 ) / 2 * ( ( 10 + 30 ) / 2 / ( 5 * 2 ) )


    (40 / 2 ) * ( ( 40 / 2 ) / ( 5 * 2 ) )


    20 * ( 20 / 10 )


    20 * 2 = 40


    B basic has a power that is between atk and mat, if you favour one stat, say mat, then


    ( mat * 1.5 + atk *0.5 ) / 2; lets redo the above with this change


    ( ( mat * 1.5 + atk *0.5 ) / 2 ) * ( ( ( mat * 1.5 + atk *0.5 ) / 2 ) / ( b.def * 2 ) )


    ( 30 * 1.5 + 10 * 0.5 ) / 2 * ( ( 30 * 1.5 + 10 * 0.5 ) / 2 / ( 5 * 2 ) )


    ( 45 + 5 ) / 2 * ( ( 45 + 5 ) / 2 / ( 5 * 2 ) )


    (50 / 2 ) * ( ( 50 / 2 ) / ( 5 * 2 ) )


    25 * ( 25 / 10 )


    25 * 2.5 = 62.5 [63 in game]


    and just like that 23 more points in damage
  14. i see, well, for Overpower specially just increases the attack stat for the attack, kind of like buffing atk stat but just for that one atk, so it would help turn your mitigation in your favor as well as do more damage.


    for another skill though, i would word it differently for a straight up just 50% more dmg, like "This atk deals 50% more damage than normal" where is Overpower is "Increase your attack by 50% for this attack"


    so for overpower i'd use ...


    Math.Min((atk*1.5), (a.atk*1.5)*((a.atk*1.5)/(b.def*2)))


    where is the other skill that just adds a straight up 50% dmg bonus would be ...


    Math.Min((atk*1.5), (a.atk*1.5)*(a.atk/(b.def*2)))


    correct?


    and i think i understand b, as long as the "Math.Min" keeps it from going over the value of matk+atk/2, so if that equaled 30, the move couldnt do over 30 dmg without a crit or something
  15. yes and yes
  16. good, so, i think i got this then,i might be able to tweak that for anything i want.


    OH! what about heals? i heard heals worked differently in MV than in XP or ones before, is there some change id have to do to the formula to make it acknowledge it's a heal and not an atk?


    like if i did


    a.mat +30


    would it heal like, (m.atk=50)+30 = 80 points of heal?
  17. Naridar said:
    You should replace "$gameVariables[2]" with "Math.min(700, $gameVariables[2])"



    Hey thank you it actually worked pretty well, I have another question... Is there a way to check for Debuff? I want to make a skill that deals more damage the more debuffs a foe is affected with like...


    normal formula deals 1000


    foe with 1 ATK debuff, then formula delas 1100


    foe with 2 ATk debuff;  1200


    foe with 2 ATK debuff and 1 DEF debuff, 1300


    and so?
  18. I am trying to create a skill that has its damaged decided by the user's strength multiplied by the base attack value of the user's weapon. Any ideas?
  19. okay im running into a problem with my formula in game. I was trying to do a test to see some skills or any of these formula's in action really, and everything keeps doing 0 damage, even though the attackers have 11 atk vs the bats 3 def, why is it doing that? :o
  20. Jojozityjo said:
    good, so, i think i got this then,i might be able to tweak that for anything i want.


    OH! what about heals? i heard heals worked differently in MV than in XP or ones before, is there some change id have to do to the formula to make it acknowledge it's a heal and not an atk?


    like if i did


    a.mat +30


    would it heal like, (m.atk=50)+30 = 80 points of heal?

    Yes, but make sure you set the skill as Heal HP instead of HP damage

    Dennis89 said:
    I am trying to create a skill that has its damaged decided by the user's strength multiplied by the base attack value of the user's weapon. Any ideas?



    This will only work if a weapon can be equipped


    dmg = 1; weapons= user.weapons(); if(weapons > 0, dmg = a.weapons.atk); dmg*a.atk


    [disclosure, not 100% sure if its correct, a.weapons calls all weapons equipped to 'a', but I couldn't fine weapon.param in my quick look of the code]