Quick question here. I'm using low numbers for my project, and am running into the problem of hits doing zero damage. I'd like to have the damage set at a minimum of one, but either I'm not remembering how I did it correctly in VX Ace, or the method I used then doesn't work with the change in programming language. Can anyone tell me what I need to add to the damage formula to make the minimum damage always equal 1?
Minimum Damage
● ARCHIVED · READ-ONLY
-
-
Well, a common problem is the hit rate not being set right. Have you been doing that?
-
This is something you'll have to change in the damage formula within either a plugin or rpg_objects.js
Game_Action.prototype.makeDamageValue = function(target, critical) { var item = this.item(); var baseValue = this.evalDamageFormula(target); var value = baseValue * this.calcElementRate(target); if (this.isPhysical()) { value *= target.pdr; } if (this.isMagical()) { value *= target.mdr; } if (baseValue < 0) { value *= target.rec; } if (critical) { value = this.applyCritical(value); } value = this.applyVariance(value, item.damage.variance); value = this.applyGuard(value, target); value = Math.round(value); if (value <= 0 && baseValue > 0) { value = 1; } return value;};The last part is what I've added. -
@Silent Darkness: The issue isn't with them connecting, it's with them literally doing "0" damage with the skill.
@Yanfly: I added that script bit you showed me in rpg_objects.js, but it's still returning the occasional 0 value on damage. >_<
For the record, the damage formula I'm using right now is [a.atk * 3 - b.def * 2], and the only plugins I have installed are YEP_CoreEngine, YEP_BattleEngineCore, YEP_VictoryAftermath, and YEP_RegionRestrictions. -
That code would return 0 if the base value was initially 0, which would occur with your stats (in fact, all it stops is the damage dropping to 0 due to element resistances or variance). If you change the last if to read
if(value <= 0 && basevalue >= 0)
Then it should do what you want it to do. -
@bgillisp: That appears to have done the trick! Thanks to both of you. :cutesmile:
On a related note, if I wanted to have it set so only certain skills would do at least a minimum amount of damage, is there anyway to do that right from the skill damage formula, or would I need to mess around in the rpg_objects.js more? -
What would you replace the "1" with, if you wanted the minimum damage to equal the attacker's level?if (value <= 0 && baseValue >= 0) { value = 1; } -
I may offer a simple solution for your skills formula..
Typically, I use really small numbers for my algorithms as well. On trick I use is to put your dmg formula in ( )'s and finish with a +1.
Example:
(a.atk - b.def) +1
Deals a minimum of 1 dmg. Which you could modify for each skill if you wanted. No plug-in/scripting necessary.
Good Luck!! :) -
I love how the RPG Maker community has a solution to literally every problem. I was searching for changing the minimum damage, found this thread and all my problems are solved. You guys are angels!
-