RMMV Damage Formula - ideas and help

● ARCHIVED · READ-ONLY
Started by Shaz 1539 posts Page 42 of 77 View original ↗
  1. I'm not 100% sure if this will work for your needs but my favorite damage formula is the LoL damage formula. It keeps everything quite reasonable and scales very nicely into the end game. Here it is: a.atk * (100/(100 + b.def)) If you want higher numbers of course it's easy to just apply a multiplier to the attack, like (a.atk *2) * (100/(100 + b.def)) or something like that.

    This isn't quite what I had in mind, the formula doesn't seem to be designed to work with larger number values, as it requires ridiculously huge stat values to get into the 4-digit or 5-digit damage numbers.

    However, it definitely works a lot better than the default formula overall. If necessary, I guess I could just simply modify the values to work with smaller three-digit numbers instead of four or five.

    Thanks for the suggestion.
  2. @Hungry Moogle:
    If you like that kind of formula in general but want to increase the scaling of your damage, you could try to power your stats with constant exponents.
    Given the two damage values you specified, a base formula for your ATK could look like these:
    1) 0.1 * a.atk^1.75
    2) a.atk + 0.02 * a.atk^2
    (Note that in Javascript you have to use Math.pow(X, Y) instead of X^Y to calculate "X to the power Y")

    In general, if you exponentiate your ATK with a constant exponent then increasing ATK by a fixed percentage will also increase the damage by a fixed percentage. If you use the first formula for example, increasing ATK by 50% would increase the damage by ~100% (=> 150%^1.75 = 203.31% ).

    If you combine multiple exponents like in the second formula, the higher exponents will take more precedence the higher your ATK gets (the a.atk part doubles each time you double the ATK, the 0.02 * a.atk^2 part quadruples but is limited at first due to the low coefficient).
    As a result, using a 50% ATK buff at 28 ATK increases the damage by ~77%, using it at 500 ATK increases the damage by ~118%.

    If you choose to let DEF scale a bit weaker so that the damage can increase over the course of the game while the ATK/DEF ratio remains about the same, your 50% DEF buff is probably getting a bit inferior to your 33% ATK debuff. However, you could boost the percentages a bit to counterbalance this.

    If you want your ATK and DEF to scale the same, you can still achieve a growing damage value by keeping your enemies DEF relatively low or use additional factors in your formula (like the attackers level, weapon power, etc.) of course.


    Bottom line you could for example change that formula to this:
    (0.1 * Math.pow(a.atk, 1.75)) * 200 / (b.def + 100)
    This would result in the damage you want when the target has exactly 100 DEF. Increasing the ATK by 50% would double the damage, increasing the DEF by 50% would reduce the damage to 80% (down to 67% with higher DEF, decrease the additional addend if you want to approach the maximum reduction faster).

    Always make sure your formula works for the most extreme stat values you use.
    Hope this helps. :)
  3. Okay, to help convey what I'm trying to achieve I decided to post an old damage formula I made a couple of years ago using an Excel spreadsheet. This formula wasn't made for RPG Maker, and it is has a number of issues (for one thing the damage total in the first example below is too high, the damage should be between 30-40 points), which is why I abandoned it to begin with, but I figured it might help give a rough idea of what I'm looking for in regards to how damage should scale.

    BASE DAMAGE FORMULA:

    1.) Base Damage
    Base Damage = [Weapon Attack + (Attacker's Strength × Strength Modifier)] - (Target's Defense × Defense Modifier)

    2.) Damage Modifier
    Damage Modifier = 1 + [Attacker's Level + (Attacker's Strength × Strength Modifier)] ÷ 8

    3.) Final Damage Calculation
    Damage = Base Damage × Damage Modifier

    EXAMPLES:

    Example #1.)
    Attacker's Level: 1
    Attacker's Weapon Power: 16
    Attacker's Strength: 12
    Target's Defense: 6

    = {[16 + (12 × 1)] - (6 × 1)} × {1 + [1 + (12 × 1)] ÷ 8}

    Final Damage Total = 57

    Example #2.)
    Attacker's Level: 65
    Attacker's Weapon Power: 200
    Attacker's Strength: 116
    Target's Defense: 100

    = {[200 + (116 × 1)] - (100 × 1)} × {1 + [68 + (116 × 1)] ÷ 8}

    Final Damage Total = 5184

    Example #3.)
    Attacker's Level: 99
    Attacker's Weapon Power: 200
    Attacker's Strength: 255
    Target's Defense: 100

    = {[200 + (116 × 1)] - (100 × 1)} × {1 + [68 + (116 × 1)] ÷ 8}

    Final Damage Total = 16063


    I hope this proves to be somewhat useful, although I'm not too sure how much it will be, but every little bit helps, right?
  4. Edit: Redid the post. :)

    When you only provide two damage values, you can draw a lot of functions between them. Unfortunately I'm not that experienced with actually balancing a whole battle system around a damage formula, so I fear I cannot give an absolute recommendation what kind of formula you should use (and I doubt there is a perfect way to do a formula in the first place).


    I don't know exactly what issues you had with the formula you posted, but there would be a number of ways to make it match your preferred damage values. For example, you could edit your damage modifier a bit:

    Damage Modifier = 0.5 + Attacker's Level ÷ 5+ (Attacker's Strength × Strength Modifier) ÷ 15

    (This would also make the damage at very low ATK values though. Finding fitting values comes down to solving equation systems.)


    Subtracting DEF from the damage taken might make DEF more valuable when the target has a lot of it compared to the attackers ATK (reducing damage from 10 to 9 makes you survive ~10% more hits, reducing damage from 500 to 499 would probably be barely noticable in most cases. At least when not considering healing or other battle mechanics).
    On the other hand, the maximum damage a target can take is limited - at least in the default formula a no-DEF-target will only take twice as much damage as one whose DEF is equal to the attackers ATK.


    You still could use something like this:

    0.1 * Math.pow(a.atk, 1.75)

    which would at least be "a formula where a low Attack value of 28 would translate to about 30-40 damage, while a high Attack value of 500 should translate to about 4000-6000 damage". You'd still have to include DEF of couse and counterbalance it so an average DEF value would not change the result.

    For example, you could take the DEF calculation part from the LoL-formula and make it something like this:
    0.1 * Math.pow(a.atk, 1.75) * [100 + Average DEF value] / (100 + b.def)

    At this point, I don't know what influence DEF should have in your formula of course.^^

    I hope this somehow helps.


    Edit: Previous version of the post:
    Spoiler
    I'm no expert in creating formulas unfortunately and I'm not quite sure what exactly was wrong with the formula apart from the numbers being a bit off.

    Aside the final damage numbers there are differences how changing the default ATK/DEF would affect the formula result, for example:

    If you use a formula in the form [X * a.atk - b.def] then DEF will reduce the damage by a fixed amount. That means that attackers with very low ATK will probably do little damage or will not be able to break through your defense at all, while attackers with very high ATK will probably do almost the same damage as they would have done against a defenseless target.
    That is again measured in "attacks required to defeat the target", in reality this might be a bit more complex.

    If you use a formula in the form [X * a.atk / b.def] then DEF will reduce the damage by a fixed percentage. That means debuffing a 500 DEF target by 50% would have a similar effect as debuffing a 100 DEF target. In addition a high ATK attacker hitting a very low DEF target will probably do many times the damage they'd do against an appropriate target.

    ---

    If you just want to match your numbers, one suggestion would still be to use the base formula from my last post and factor the targets DEF in (so an average DEF value does not change the preferred outcome):

    (0.1 * Math.pow(a.atk, 1.75)) * ([average DEF value] / b.def)

    For example, if you balance your formula around DEF being ATK / 2 you could replace the placeholder with that. In this case that would increase the total exponent for your ATK to 2.75, which means a 50% DEF buff would be negated by a ~16% ATK buff from the attacker.

    ---

    To make a formula match certain damage values you'd usually choose multiple variables that do not affect the features of your formula you need (make sure the variables can't be combined). Depending on the variables, there might not be a solution or one you absolutely don't like sometimes (like a negative modifier for your ATK).

    For example, if you want your first example to exactly result in 35 damage and your second one to result in 5000 damage you could try to change the two constants in your damage modifier to achieve that:

    (16 + 12 - 6) * (a + (1 + 12) / b) = 35,
    (200 + 116 - 100) * (a + (65 + 116) / b) = 5000

    Tools like Wolfram Alpha can also help solving equations like this:
    a = -7705 / 99792 (≈ -0.077)
    b = 99792 / 12805 (≈ 7.793)
    If you prefer flat numbers, you could round these results to a = 0 and b = 8. In this case you would still get 35.75 and 4887 damage respectively.

    (This particular solution might not be perfect of course since removing the "1 +" probably means that very low ATK values might result in 0 damage, even when they surpass the targets DEF)

    I don't know if I understood what you were looking for exactly, but I still hope any of this helps. :D
  5. Something here is obviously wrong, could someone point out what is it :c. Using this skill unlocks another, kind of like a follow up attack.

    'var = a.actorId(); $gameActors.actor(var).learnSkill(19); 100'

    I tried a few variations on this. I had it working a few weeks ago but can't remember what I ended up using?...


    Edit/// all I needed was a.learnSkill(19) fml.
  6. Is there any way to change the success rate/hit rate of an attack with the damage formula? I have some moves that only work on specific enemies and I'd rather see a 'miss' message than a '0' or just nothing.
  7. Is it possible to do negative damage in a damage formula based on the element of the attack and the element of the object reviving damage o result in healing. (Hit enemy with fire element with fire spell and restore health as a result)
  8. Check out Yanfly's Element Absorb plugin.
  9. How exactly would I be able to scale skill damage with the user's level? I find the skills I have created become useless after too many levels as the normal attack ends up doing way more damage.
  10. I have a decent understanding of this, but what if I want:

    Heal target
    then the actor that used the skill gains exp equal to target's level
    I think I need

    b.isActor()
    a.gainExp(b.level)

    and lets say, heal 50hp
  11. UraniumRain said:
    How exactly would I be able to scale skill damage with the user's level? I find the skills I have created become useless after too many levels as the normal attack ends up doing way more damage.

    Code:
    (a.atk - b.def) * (1 + a.atk * (a.atk + a.level)/256)

    Try that. It's a watered-down version of Final Fantasy 12's damage formula for swords. Unless you're using Yanfly's Enemy Levels, your enemies won't be able to use this formula - unless you add in a conditional branch that doesn't account for levels. The original formula forced priority on the ATK bonus of whatever weapon you were using at the time, meaning a max level character would still deal fairly low damage if their weapon wasn't up to par. I'll include that one below:

    Code:
    (a.paramPlus(2) - b.def) * (1 + a.paramBase(2) * (a.paramBase(2) + a.level)/256)

    Again, keep in mind: paramPlus and paramBase will return 0 if the skill is used by an enemy. Adjust as needed.
  12. Backwardskey said:
    Code:
    (a.atk - b.def) * (1 + a.atk * (a.atk + a.level)/256)

    Try that. It's a watered-down version of Final Fantasy 12's damage formula for swords. Unless you're using Yanfly's Enemy Levels, your enemies won't be able to use this formula - unless you add in a conditional branch that doesn't account for levels. The original formula forced priority on the ATK bonus of whatever weapon you were using at the time, meaning a max level character would still deal fairly low damage if their weapon wasn't up to par. I'll include that one below:

    Code:
    (a.paramPlus(2) - b.def) * (1 + a.paramBase(2) * (a.paramBase(2) + a.level)/256)

    Again, keep in mind: paramPlus and paramBase will return 0 if the skill is used by an enemy. Adjust as needed.

    Thanks!
  13. Hey, I'm having some trouble with my formula... I tried it out on Libre Office' Calc and worked like a charm, but in game... not so much.
    I have 3 chars, one with medium def, and mdf, other with low def and high mdf, and another that's well rounded, but high on both (has a better armor).
    I'll translate this on numbers (after adding equipment, of course, for a couple of levels to see some differences):
    char _____ def __________ mdf __________ lvl ________ def __________ mdf __________ lvl
    1 ________ 38 ___________ 31 ____________ 5 ________ 42 ___________ 35 ____________ 8
    2 ________ 22 ___________ 42 ____________ 5 ________ 24 ___________ 50 ____________ 8
    3 ________ 53 ___________ 46 ____________ 5 ________ 58 ___________ 51 ____________ 8

    Now, the formula (I use parenthesis just to make sure the calculations go in this order) I'm using for generic attack is:
    = 30 + ((a.atk/b.def)*21)
    and the one for certain skill (shared both by enemies and characters) is:
    = ((30+((a.mat/b.mdf)*21)) * 4/5) + 20 --- this is an attack that happens up to 6 times, against up to 4 chars, but if all six hits happen against one target... boy, that's trouble... :p

    So, when you see the numbers up there, you might agree that char 1 would always take more damage than char 3, right? Well... that is the problem, right there... char 1 gets less damage from ANY source than the other two chars. For example, when hit by the second formula, each attack does around 10-11 points of HP against char 1, but against both char 2 and 3, it does around 60 points of damage... per hit... so... WTF??!!

    Also, with the normal attack, char 1 gets around 30-40 points of damage (which is intended), while the other two get around 50-60 (which obviously isn't for the 3rd char).

    So, anyone see anything wrong in the formulas? Is there something I'm missing somewhere?

    Thanks in advance, and please excuse any grammathical mistakes I might had, but English isn't my language. :)
  14. I'm another person who's having trouble balancing buffs and debuffs in his damage formulas.

    In my case, I'm not aiming for super huge numbers; the strongest attack I currently have does around 1240 damage (though technically it hits for 310 damage four times). My big issue is that the default "a.atk * 4 - b.def * 2"-esqe formulas tended to give me 0 damage when debuffs were factored into the equation, and I'm still having issues with debuffed attacks doing piddly damage now.

    At the moment, this is the damage formula I'm using:
    Code:
    0.75 * (Math.pow((a.atk * 2), 2) / b.def)

    It accomplishes the intended results without debuffs factored into the equation; an attack off 122.5 does around 430 damage to a target with 103 base defense. If the target has max buffed defense (in my game's case, buffs can be stacked 2 times; stage 1 is *1.5 and stage two is *2), the same attack does 218 damage.

    The problem, as previously mentioned, is when debuffs are factored into the equation. When the aforementioned attack stat is fully debuffed (in my game's case, debuffs also stack twice; the first stage is *0.625 and the second stage is *0.25), the attack does a piddling ~27 damage. It's even more pathetic when the defense stat is buffed fully as well; that attack does ~13 damage.

    Ideally, I'd like a fully debuffed attack off this formula to do at least 75 damage, if not 100 or more (assuming the same attack and defense stats as before). Is there a way to accomplish this result through just the damage formula, or should I settle for nerfing my debuffs?
  15. Nerf your debuffs, OR - use 'a.atk - b.def' to determine the base power of the attack and work from there.
    Also, if I'm not mistaken you could just use a ^ in place of the Math.pow function.
  16. I need someone's help with the critical damage formula. So the battler's ATK / MAT is lower than the opponent's DEF / MDF, and because of that, a critical hit won't inflict any damage upon the opponent.

    It seems as if RPG Maker MV deals critical damage only if the user's ATK / MAT is higher than the foe's DEF / MDF. But I want it to rather triple the user's ATK / MAT whenever the critical is initiated, regardless if the foe's DEF / MDF is higher.

    Like for example: The battler has 550 ATK, and the foe has 600 DEF. The battler initiates a critical but it doesn't deal any damage, since the foe's defense is higher. What I'm looking for is like 550 ATK / MAT being multiplied by 3 where critical damage can be inflicted, even if the user's base ATK / MAT is lower than the DEF / MDF.

    ------------------------------------------------------------------

    Edit: Never mind this, there was a misunderstanding on my part. I see now how critical hits work in general, though some games will multiply attack power in critical hits.
  17. What is the easiest way to make physical damage that results in a 0 have an equal chance of being 0 or 1 like in DQ games?
  18. What's a good way to make an attack deal more damage according to the amount of HP that you've lost?

    In my game, the characters attack level (1-99, without boosts from gear) governs their potential to hit numbers on the enemy in this way:

    damage = a.atk * 0.25

    The simplest way I can figure out would be something like

    damage = a.atk * 0.05 + (a.mhp/(a.hp/2))

    The damage equals the actors attack value plus the ratio of their max hp to that of their current hp divided by 2. Doesn't have to be halved, just works better in my game.

    But couldn't there be a better way? I was hoping there would be a way to modify the original damage output so that they deal more damage according to how many HP points they've lost. LMK if you know or think of anything good. Oh and I am using Yanflys armor piercing so that's why there is no b.def.
  19. Nza3 said:
    What's a good way to make an attack deal more damage according to the amount of HP that you've lost?

    In my game, the characters attack level (1-99, without boosts from gear) governs their potential to hit numbers on the enemy in this way:

    damage = a.atk * 0.25

    The simplest way I can figure out would be something like

    damage = a.atk * 0.05 + (a.mhp/(a.hp/2))

    The damage equals the actors attack value plus the ratio of their max hp to that of their current hp divided by 2. Doesn't have to be halved, just works better in my game.

    But couldn't there be a better way? I was hoping there would be a way to modify the original damage output so that they deal more damage according to how many HP points they've lost. LMK if you know or think of anything good. Oh and I am using Yanflys armor piercing so that's why there is no b.def.

    Here's a few:

    Let's say you want to give a move a multiplier based on how much HP is missing.

    Code:
    damage = (a.atk * 0.25) * (1.5 * (1 - (a.hp/a.mhp)))

    The maximum multiplier is 1.5, so the lower our HP, the closer our bonus gets to 50%.

    Let's say you want to add a flat percentage of the difference between HP and MHP.

    Code:
    damage = (a.atk * 0.25) + (.25 * (a.mhp - a.hp))

    Now 25% of all damage we've taken is added to our damage output.

    Let's say we want to boost our damage by..say, 10% for every 20% of our total HP missing.
    For example, if we were at 40% of our HP, we'd get a 30% damage bonus.

    Code:
    (a.atk * 0.25) * (1.1 * Math.floor((1 - (a.hp/a.mhp)) * 5))

    Those are just some that I can think of. Happy formulating!
  20. Is there a way for a skill to do almost, if not exact, the same amount of damage either being a physical or being a magical type class.

    I tried "((a.atk + a.mat) / 2) - ((b.def + m.def) / 2)" but it only gives me a 1 damage (i'm using mr trivel's minimum damage plugin).