I was looking for damage cap plugins, and of the exactly three things I came across in my search, two are for MV, and the other costs money, but much more importantly neither seemed to have a way to have critical hits bypass the effect, similarly to the metal trait from the battle cats if anyone here actually plays that.
Is there any way to create an effect that can force a cap on damage unless the damage inflicted is a critical?
Preferably without expending funds but simply knowing that there's a way to do it in the first place would be cool regardless.
Yeah, I think throw it at the end of this method with a critical check conditional (change the max):
Game_Action.prototype.makeDamageValue = function(target, critical) {
const item = this.item();
const baseValue = this.evalDamageFormula(target);
let 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 (!critical && value > 1000)
value = 1000;
return value;
};
EDIT: Or are you looking for a state that does this, or something else?
EDIT2: Then you can throw there like checks for target.isStateAffected(X) or BattleManager._subject.isStateAffected(X), I think (edit: or just this.subject().isStateAffected(X))
I- did not expect a response that fast, woah-
I was specifically looking for a way to tie it directly to an actor or enemy, though wouldn't putting it on a state do the same thing? Which number is the cap anyway- is it the 1000? I'm not the most experienced with javascript at all so looking at that blob of code is frying my brain a little bit @-@
Yeah, it's the 1000. If you mean "tie it directly to an actor or enemy" in the way of them being the target of the attack, then replace the current extra 2 lines with something like (use notetags <damageCap> on actor or enemy notes):
if (!critical && value > 1000) {
if ((target.isActor() && target.actor().meta.damageCap) || (target.isEnemy() && target.enemy().meta.damageCap)) {
value = 1000
}
}
If you want the damage caps to be different values, you need extra code.
I'm probably completely stupid, what do I actually do with this code?
I know how to add notetags and change the numbers, but where do I actually put it? Do I slap it into a js file and make it a plugin-? If that's the case then I think I did something wrong(probably edited the code in the wrong spot if anything because I repeat, I'm stupid) because my project did NOT like me doing that at all
Yeah, just copy paste to notepad, save as .js file and add as a plugin. I tested that in base project and it seemed to work (tested hitting an enemy). Do you have other plugins that change that method? You can do that with Yanfly plugins too, I just assumed from your opener that you weren't too fond of existing plugins LOL.
EDIT: Meant VisuStella, not Yanfly
I copied and pasted to notepad, and saved as a js, and attempted to put the alterations to have it come into effect via the notetag in. If you could actually show the proper full thing with that change that might help ^^"
And its less so not super fond of existing plugins and moreso I just couldn't find one that worked.(That and I didn't want to shell out the monies(though that one wouldn't've worked anyway) lmaoo)
I do have a few of the tier 0/1 visustella ones enabled(core, message, items/equips, skills/states and element/status) but I don't really see anything other than those that might screw something up. Although when it errored it went NAN instead of the 0, was the heal color, and.. changed the theoallen healthbar the enemy had to fully red, somehow. Notetagged or not.
it works now!!!! yeah no it was just me inserting the snippet wrong LMAOOOOOO
hell yeah!!!!!!!!!!!!
I did test it and it almost broke a plugin I had to make a noise when crits proc, but all it took was putting this one above that and it was fixed.
thank you so very very much!!!!
though, one more thing- theoretically, could I make a new plugin with the exact code except changing the meta.damageCap into something else(and the number obviously) to make a different notetag and have multiple caps of this nature?
Would it also work with states?
Cool.
For your new question, I think you can check the notetag in everything like this (if you wanted different caps, you need different code):
if (!critical && value > 1000) {
if (target.traitObjects().some(object => object.meta.damageCap)) {
value = 1000
}
}
And you can also make checks for multiple notetags one after the other, but depending on what you want to do with it, you may need extra code.