Hi everyone! So I've been trying to solve this really hard and I can't figure it out on my own. I want to change the way evading an attack is handled. I want the battlers to take 50% damage when they evade an attack. How can I achieve this? Thank you in advance!
Take 50% damage when evading
Javascript/Plugin SupportYou will need a plugin changing the evade function.
Do you know how to code yourself? If so, search for this:"result.evaded" in the code. Should give you a good indication of what you need to change around. It isn't as simple as flipping a switch because of the way the engine handles miss/evade.
I don't know how to code but I've been trying to fiddle with the objects.js plugin to make this happen, but I'm not good enough to crack it. I think I should add(?) something between lines 1648 - 1668
Game_Action.prototype.apply = function(target) {
var result = target.result();
this.subject().clearResult();
result.clear();
result.used = this.testApply(target);
result.missed = (result.used && Math.random() >= this.itemHit(target));
result.evaded = (!result.missed && Math.random() < this.itemEva(target));
result.physical = this.isPhysical();
result.drain = this.isDrain();
if (result.isHit()) {
if (this.item().damage.type > 0) {
result.critical = (Math.random() < this.itemCri(target));
var value = this.makeDamageValue(target, result.critical);
this.executeDamage(target, value);
}
this.item().effects.forEach(function(effect) {
this.applyItemEffect(target, effect);
}, this);
this.applyItemUserEffect(target);
}
};
But using result.evaded or result is evaded doesn't work. Anyone that knows javascript, is this doable just by adding something here?
I've moved this thread to Javascript Support. Thank you.
Result.evaded just says it has already dodged it and is used for animations and such. You need to go to where the roll for evasion is decided and change it there, as when it rolls that you evaded, it ignores the damage as well, so you will need to change it so it applies 50% of it instead.
Searching for result.evaded leads to the areas that need to be changed, but it isn't a simple "change a couple lines". The code you listed is one of the areas that needs to be modified - but you'd have to rewrite a section of it to get the results you want (and you'd have to make changes in other places, too, I believe). All in all, if you don't know JS your best bet is to probably wait and see if a plugin designer can help you out.
Original thread: https://forums.rpgmakerweb.com/threads/take-50-damage-when-evading.95815/