New account registration is temporarily disabled.

[RMMV] HOW TO ALWAYS DEAL AT LEAST 1 HP DAMAGE? SOLVED

Posts

Pages: 1
I want to make a damage formula that ensures every hit that lands does at least 1 HP damage, rather than no damage at all, but I can't seem to find a way to do that. Every change I've tried to make has resulted in EVERY attack only doing 1 damage, completely bypassing anything else in the formula. Would anyone out there be able to help me with this? I can't seem to find a guide for how to write these formulas out, so I tried everything I could think of. I've tried all of the following and none have worked:

a.atk * 2 - b.def + 1
a.atk * 2 - b.def, 1
a.atk * 2 - b.def ; 1
(a.atk * 2 - b.def) + 1
(same thing but replace the parentheses with brackets)
{a.atk * 2 - b.def} + 1
I'm a bit confused, so you want to do 1HP damage? For that you simply type 1 in the damage box.

If you want it to get close to 1HP you could just use a variable and have it pick a random number between 1 and 3 (or whatever number you wish to use.)

As for the formulas those depend a lot on what the user's attack power is compared to the enemy's defense.
No no no, I want to make it so that it's not possible for a damaging attack to deal 0 HP damage. Like how in Pokemon, every time you try to deal damage it always does at least 1?
I never played pokemon. Well, it could be your Variance is set to a number. That would need to be set to 0%

Well...I have played pokemon but not enough to care about the damage output.
I've tested these formulas extensively enough to know it's not the variance. Every single one of those formulas changes the damage dealt to 1 every single time, regardless of anything else. The opponent's defense and the attacker's strength no longer matter; it always deals 1 damage even in a case where it should be dealing a much higher number.

What I'm trying to do is make the minimum damage for every attack 1 instead of 0. I don't want it to be possible for attacks to deal a damage of 0. I want even the weakest possible attack against the strongest possible enemy to deal 1 HP damage, without changing anything else. Everything else should still work the same. I can't seem to make a formula that does that. Just adding +1 on the end, for some reason, makes it so that every attack always just does 1 damage like mentioned above. That is the issue.
Use Math.max to set a floor value, Math.max will pick the bigger of the two numbers you give it so if your damage algorithm goes below 1 it'll use 1 instead. ex:

Math.max(a.atk * 2 - b.def, 1)

Documentation of Math.max

e: There should be a way to make it easier as a script/plugin instead of having to do this for every skill but I don't have mv's backend handy atm.
author=GreatRedSpirit
Use Math.max to set a floor value, Math.max will pick the bigger of the two numbers you give it so if your damage algorithm goes below 1 it'll use 1 instead. ex:

Math.max(a.atk * 2 - b.def, 1)


Documentation of Math.max

e: There should be a way to make it easier as a script/plugin instead of having to do this for every skill but I don't have mv's backend handy atm.


Thank you so much! That's exactly how I wanted it to work.
Pages: 1