RMMV Damage Formula - ideas and help

D.L. Yomegami

Sanely Insane
Veteran
Joined
Jan 22, 2017
Messages
190
Reaction score
250
First Language
English
Primarily Uses
RMMZ
I'm currently working on the base damage formula for my game, and having some issues.

At the moment, my game's stats are roughly within the same parameters as the default database. Non-Max HP and MP stats cannot exceed 240 through leveling alone, and even then the player would have to level to 99 to even get their stats that high in a game where the intended finishing level is around 50 (and could still be finished at around half that). That being said, the player can still reach this "cap" through equipment or buffs at level 50.

The intended starting damage range is around 50 for basic attacks at level 1, which goes up to around 500 for basic attacks at level 50. Skills can go up to twice that at level 50 for element neutral, non-critical damage.

Buffs and debuffs are a big part of the battle system. At the moment they're set to the default levels, which halves the stat at -2 stacks and boosts the stat by 1.5 at 2 stacks. While I'd still like to make sure that removing debuffs is important to not getting wiped, I'd also like to make sure that debuffed units aren't completely useless (especially on the enemy's end), and maybe see if I can address that through the damage formula itself rather than messing with the buff/debuff formula (though if I do have to resort to that I'd make it so debuffs divide the stat by 1.5, or reduce it by roughly ~33%).

I'm also aiming for the actors and enemies to have similar stats and use the same damage formula for their skills, just to make things easier for myself. Furthermore, physical and magical attacks also use the same formula.

So with all that said, I'm currently playing around with a rough adaptation of XP's damage formula to MV's stats:

(base power - b.def / 2) * (80 + a.atk * multiplier) / 80

The main reason I'm using both a base power and a multiplier is in service to buffs/debuffs and also to leveling. The base power is a fixed value completely unaffected by buffs and debuffs, which means that it's less likely the player will be able to completely neuter incoming damage simply by debuffing the enemy and buffing their defense. The multiplier, meanwhile, is there to ensure skills keep damage scaling even as the player's attacking stats eclipse the skill's base power. The multiplier's 1 for basic attacks and can go up to 2 for the game's strongest skills.

At an offensive stat of 240 and a multiplier of 1, the rate equals 4, which is around as high as I want it to go. As far as buffs and debuffs go, full debuffs reduce the final damage by around 40% and full buffs increase it by around 30%. Ideally, I'd like a fully defensively buffed target to take no less than 1/4 damage from a fully offensively debuffed target, but this is still an improvement over what the default a.atk * 4 - b.def * 2 would give me.

And now for the problems I'm having:
*Base power works for skills...but I don't want basic attacks to have a fixed base power. While it'd still be nice for basic attacks to have some fixed value that buffs and debuffs won't affect, the only way I can think to do that is with a plugin that allows for weapon power, which I really don't want to do (it feels rather complicated). The other alternative I can think of is simply to make basic attacks affected by the rate only, but then I run headlong into the issue of debuffs neutering basic attacks into oblivion.
*While I like the damage at 240 offense, the damage at the starting offensive stat (which is around 30; again similar to the default database) is considerably higher than I would like. In fact it's roughly three times as high as I would like. I could give the starting enemies a high enough defense stat to reduce the damage back down, but it's a lot. So instead I think an exponential rate would work better than the linear rate I have now.

In case it wasn't already obvious, I'd rather work with what default MV gives me rather than needing plugins for anything (so nothing like enemy levels, extra stats, or weapon powers). It's partly to keep things simple for myself and partly out of a sense of challenge.

I'm not too attached to using an additive formula; I'm just using one now because that's what XP used, because my other inspirations for this particular formula (Final Fantasy V and Octopath Traveler) also used an additive formula, and because it's just easier for me to wrap my brain around right now. If there's a multiplicative formula that might do the job better, I'm equally open to hearing about it.
 

Another Fen

Veteran
Veteran
Joined
Jan 23, 2013
Messages
608
Reaction score
320
First Language
German
Primarily Uses
Hey there,

I'm not sure if you are trying to generally avoid enemy levels and extra stats or are just trying to avoid using an extra plugin. If the latter is the case and you don't want to sacrifice one of your other stats for "weapon power" there may still be ways around the restriction using the damage formula, for example:
One way to create a makeshift weapon power stat could be to use an unused element rate:

40 * a.elementRate(20)

Since all element rate bonuses would be multiplicative this might screw up numbers for dual wielders though, and you'd probably have to use the "unarmed" weapon power as a basis.
(In the damage formula, a.elementRate(20) equals 1.0 at 100% trait rate.)
You can also use an element rate as a fallback for enemy levels:

(a.level || (100 * a.elementRate(20)))


If you don't want to use element rates you could also use the battlers base parameter value without percentual buffs. The number is the parameter index (0: MHP ... 7: LUK):

a.paramBase(2)
(class/enemy database value)

a.paramBase(2) + a.paramPlus(2)
(database value plus flat bonuses from equipment and permanent sources)


Alternatively, you could use note tags for "weapon power", although this might blow up the damage formula even more:

a.traitObjects().reduce((r, o) => r + Number(o.meta["weapon power"] || 0), 0)

The code adds up the numbers from <weapon power: 12> tags from any database entry that provides traits for the battler (states, equip, classes and the battlers own database entry by default).

As for the formula question, I haven't done much experimentation with formulas, so the suggestions might not actually be that good...

I also don't know which numbers you used for your example. Assuming that "base power" has about the same value as ATK / DEF I would expect the damage at 30 points to be ~20, which would actually be less than the 50 you proposed so I'm a bit confused about that part.


Reducing early "base power" (or increasing enemy defense) would have probably been my first suggestion too.


Alternatively you could maybe try to modify this factor:
(80 + a.atk * multiplier)
80 is constant and does not scale with ATK while a.atk * multiplier scales linearly, so the partial impact of the 80 goes down as ATK rises. One way to reduce the damage early might thus be to reduce/scrap the 80 and increase the multiplier to compensate at the higher ATK values:

(base power - b.def / 2) * (0 + a.atk * multiplier) / 60

This would of course also increase the bonuses/maluses from offensive buffs, particularly at low ATK values.


Increasing the exponent might work too of course.
 

Bwoltz

Veteran
Veteran
Joined
Apr 16, 2013
Messages
31
Reaction score
2
First Language
english
Primarily Uses
Hey, I've got a formula question too. Is there a way to cap the damage an attack can do? For example an attack goes up by level but only to a certain point ex. 5 + a.level - b.def ...
Thanks!
 

ScorchedGround

Blizzards most disappointed fan
Veteran
Joined
Apr 12, 2020
Messages
539
Reaction score
752
First Language
German
Primarily Uses
RMMV
@Bwoltz yes, you can.

Using Math functions inside the damage formula, you can do something like this:

Math.min(X, Y)

Replace X with the damage formula you want to use (something like 5 + a.level - b.def)
Replace Y with the damage cap (maximum damage)

The result could look like this:

Math.min(5 + a.level - b.def, 500)

This would cap the damage at 500.
 

Bwoltz

Veteran
Veteran
Joined
Apr 16, 2013
Messages
31
Reaction score
2
First Language
english
Primarily Uses
When I do that, it always makes the damage the max amount, instead of a semi random number. My formula is

(((Math.randomInt(4) + 1) * a.level) - b.mdf, 20) when I put math.min in front it does zero. Thank you though!
 
Last edited:

ScorchedGround

Blizzards most disappointed fan
Veteran
Joined
Apr 12, 2020
Messages
539
Reaction score
752
First Language
German
Primarily Uses
RMMV
@Bwoltz You probably made a mistake somewhere then, like a missing " ( " somewhere.

Try this, instead:

Math.min((Math.randomInt(4) + 1) * a.level - b.mdf, 20)
 

Bwoltz

Veteran
Veteran
Joined
Apr 16, 2013
Messages
31
Reaction score
2
First Language
english
Primarily Uses
Worked like a charm, thanks!
 

emelian65

Veteran
Veteran
Joined
Sep 13, 2015
Messages
195
Reaction score
64
First Language
Spanish
Primarily Uses
Hello, it may be weird to ask, but is there an actual way to use, something like the Evation rate in the damage formula, I was thinking in something simple as a.eva, but I think is not a flat number but a percentage (if the system actually has a way of finding the eva value for actor and enemy), I don't want to to be a hit or miss just simple damage, is it possible?
 

AelphysTerra

Villager
Member
Joined
Oct 28, 2020
Messages
8
Reaction score
18
First Language
English
Primarily Uses
RMMV
Something I've been toying with (and this includes MDR/PDR manipulation, not for the faint-hearted):

A damage formula similar to, and inspired by, Fallout New Vegas, using both Damage Threshold (with Def as a stand-in) and Damage Reduction (using PDR).

Let: Damage Reduction be a percentage number from 0% to 85%.
Let: PDR = 100% - Damage Reduction (i.e. values range from 100% to 15%).

Basic physical damage formula: Min(0, a.atk - b.def) * PDR. Note that unlike New Vegas, Damage Threshold (in this case, Defense) is factored in first before Damage Reduction.

We're doing something similar for MDR, with Magic Reduction also following the same principles. However, we're NOT using a Magic Damage Threshold stat (MDF will be repurposed) so all magic attacks are essentially a.mat * MDR.

I have three armor classes in the game: heavy, light, and mystic. All three armor types have varying values of DT (with heavy armors getting the highest, and light and mystic armors similar amounts of DT) and DR (with heavy armors, again, having the highest DR, while mystic armors have the highest Magic Reduction).
 

XPKobold

Veteran
Veteran
Joined
Mar 14, 2012
Messages
274
Reaction score
111
First Language
English
Primarily Uses
RMXP
Question someone mentioned additive formulas for low stat gains but what happens if you want stat gains to gradually reach high levels/numbers but want to keep the additive formula to balance things.
How would something like this would work.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
1,168
Reaction score
640
First Language
English
Primarily Uses
RMMV
Question someone mentioned additive formulas for low stat gains but what happens if you want stat gains to gradually reach high levels/numbers but want to keep the additive formula to balance things.
How would something like this would work.
Look at post 25 of this thread for logarithmic stuff, which will help you with asymptotic curves. Also, I just want to double check that you're in the right place - your profile says you use RPG Maker XP, but this is for MV formulas, so any JavaScript functions being referenced won't work in XP.
 

XPKobold

Veteran
Veteran
Joined
Mar 14, 2012
Messages
274
Reaction score
111
First Language
English
Primarily Uses
RMXP
Look at post 25 of this thread for logarithmic stuff, which will help you with asymptotic curves. Also, I just want to double check that you're in the right place - your profile says you use RPG Maker XP, but this is for MV formulas, so any JavaScript functions being referenced won't work in XP.
While i use XP the most myself i've also have been using mv as well too, and wanted to figured this out since from reading the default formula tends to have issues with low stat gains since i wanted to ask.
 

brendonx

Veteran
Veteran
Joined
Oct 30, 2015
Messages
88
Reaction score
6
First Language
English
Hi all. Is there a way with damage formulas to make an attack that does ”formula 1” if target is state affected else “formula 2”?

I’m trying to make a skill that sets all incoming attacks damage to 1 while the defender has a state active. I’m setting it up this way because I want to use yanflys absorption barrier plug in but I don’t want damage to go through the shield onto the targets hp when the shield breaks. I‘m also using the plug in to create a trigger for a shield break animation so that the player has a visual clue when attack damage on that target goes back to normal.
If that’s outside the scope of the plug in I’d be happy to use a work around if you have any ideas?
 

AelphysTerra

Villager
Member
Joined
Oct 28, 2020
Messages
8
Reaction score
18
First Language
English
Primarily Uses
RMMV
Hi all. Is there a way with damage formulas to make an attack that does ”formula 1” if target is state affected else “formula 2”?
If you have Yanfly's Damage Core plugin:

<damage formula>
if(user.isStateAffected(insert your state id here)){
value = formula 1;
} else {
value = formula 2;
}
</damage formula>

Change parameters accordingly.
 

brendonx

Veteran
Veteran
Joined
Oct 30, 2015
Messages
88
Reaction score
6
First Language
English
If you have Yanfly's Damage Core plugin:

<damage formula>
if(user.isStateAffected(insert your state id here)){
value = formula 1;
} else {
value = formula 2;
}
</damage formula>

Change parameters accordingly.
Thank you. I actually feel really dumb now because I was already trying exactly what you wrote but I was typing “if (b.isStateAffected...” as it’s the target that I need the check for.
I’m guessing it didn’t work because “b.“ isn‘t JS . I’ll give it a shot soon with “target“ instead of “user” and let you know how I go.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
1,168
Reaction score
640
First Language
English
Primarily Uses
RMMV
Thank you. I actually feel really dumb now because I was already trying exactly what you wrote but I was typing “if (b.isStateAffected...” as it’s the target that I need the check for.
I’m guessing it didn’t work because “b.“ isn‘t JS . I’ll give it a shot soon with “target“ instead of “user” and let you know how I go.
You should be able to do this directly in the damage formula (I'm 90% sure this is already mentioned earlier in this thread): (b.isStateAffected(x) ? formula 1 : formula 2)
 

Latest Threads

Latest Posts

Latest Profile Posts

Figured I would start posting what I am working on here. Anyways, a quest system plugin I have been working on:
20mgjmZ.png


What features would yall like to see in a quest system?
Playing my game to improve my game. (Totally not procrastinating)
Hope he recovers fast :|
Looks like it's functional:
It's a common thing to forget eating &drinking while you are working concentrated, right?
If I had discovered RPG-Maker before moving together with my girlfriend, I'd have died of dehydration a long time ago.

Forum statistics

Threads
112,500
Messages
1,068,723
Members
146,176
Latest member
Spooky_frog
Top