Hello forum friends!
I've been trying to make so that having a 120 fire element rate is not a 20% damage reduction against fire, but instead a flat -20 fire damage.
Between lines 1670 and 1690 in the objects.js file I found this:
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);
return value;
};
and thought that if I changed var value = baseValue * this.calcElementRate(target); to var value = baseValue -this.calcElementRate(target); the game would treat that "percentage number" as flat, but I'm sure I must be confused and this is not the line where that is handled. Does anyone know how to do this?
Thank you in advance!
How to make the element rates flat instead of percetile
● ARCHIVED · READ-ONLY
-
-
Actually the problem is the math. An element Rate of 120% would mean the game is going to multiply 1.2 to the number, so if you just change it to - it will now subtract 1.2 from the damage. Try it as such:
var value = baseValue + (this.calcElementRate(target) * 100 - 100)
The * 100 will covert the decimal back to a percent, and the minus 100 will mean only the amount of increase is added on (and if it is negative, it will be the amount of decrease). -
Actually the problem is the math. An element Rate of 120% would mean the game is going to multiply 1.2 to the number, so if you just change it to - it will now subtract 1.2 from the damage. Try it as such:
var value = baseValue + (this.calcElementRate(target) * 100 - 100)
The * 100 will covert the decimal back to a percent, and the minus 100 will mean only the amount of increase is added on (and if it is negative, it will be the amount of decrease).
I changed it and I don't spot any difference :asad: I'm using Yanfly's element core so I tried both with that on and of but nothing. Shouldn't the +`be a - so it gets decreased? -
Element Core also calculates the rates, so it is probably overwriting it. Best check there. And yes, if you want it decreased at 120% then change it to -.
Also for testing sake you should probably use a skill that does a flat damage and has no variance. So maybe set your skill that you will test this with to just do 100 damage, 0 variance. That will make it easier to see if it is working or not. -
I tried it now and it works! Thank you so much! The only problem I found is that when paired with Yanfly's damage core, a 100 power skill with 0% variance against 120 elemental rate deals 99 damage... I don't know why, I even changed this: baseDamage -= this.calcElementRate(target); to be minus. :aswt2:Element Core also calculates the rates, so it is probably overwriting it. Best check there. And yes, if you want it decreased at 120% then change it to -.
Also for testing sake you should probably use a skill that does a flat damage and has no variance. So maybe set your skill that you will test this with to just do 100 damage, 0 variance. That will make it easier to see if it is working or not.
BIG EDIT: Forget what I said, I just pasted what you told me there and now it works. I'm so dumb :kaoswt: Thank you so much bgillisp! You are a true hero :MV1:
Also I think this thread can be closed, as our amazing mod helped me with the issue :rhappy:. -
Glad it worked. There is a chance odd things might happen with really high element rates, and keep in mind element rates can't go below 0% as well.
Also if you use any code to absorb elements, keep a close eye on those, as those might work oddly too. If that happens open a thread for that and someone can look at it.
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.