Zombie State/Reverse Healing with "Skills" Only?

Hi there,


I have a question but before I begin to explain what I'm trying to accomplish I'd just like to preface this post by saying that I realize there are already at least three Zombie plugins out there that already exist for MV (Here, Here and Here) so major props to the authors of those plugins as they did an awesome job! 


Sadly, the situation I'm creating in my game is a little unique and unlike Final Fantasy where the character is afflicted with a Zombie Status and both all recovery items and recovery magic now deals damage etc. I actually want to create a state (or condition) in my game where a specific party member is damaged by recovery "skills" only but medicine items like potions still recovers them. Anyone have any ideas on how I could go about this?

The reason being is that there is a scenario in my story where a character (and this isn't a short-term thing) is "tainted" and magic associated with things that are "holy" no longer agree with him like the other party members and thus hurts him instead. But things in the physical realm like medicine ignore this rule and should still recover the character fine. I think that's a particularly important aspect as well not just for the story but in a game mechanic sense because whilst I could just use one of the scripts that are available and tweak the story to have items hurt him too, because this effect is going to be irreversible for a good portion of the game it would also be incredibly frustrating as it would mean the player has no way of healing the character at all during this period of time! Whereas if I could get this to work at least excluding items, that then gives them a method to keep this character healthy and a functional member of the party when they have to use them.

So yeah, I'm not sure exactly how I'm going to do this if it can be done at all. Maybe some kind of common event/conditional branch that plays in every battle when the player casts a heal spell perhaps in combination with one of the ordinary zombie scripts would work? But any advice on how to accomplish this from some more experienced game makers would be greatly appreciated! Hopefully I don't have to scrap it.
That isn't hard to do, you just have to put it into your skills damage calculation.


if (b.isStateAffected(17)) {(skill calculation) * -1} else {skill calculation}
That isn't hard to do, you just have to put it into your skills damage calculation.


if (b.isStateAffected(17)) {(skill calculation) * -1} else {skill calculation}

Oh wow. That simple, huh? Well, it's a bit late over here so I'll give it a shot tomorrow and report back. Thanks a lot! =D
Actually, I changed my mind and gave it a shot just now and instead of damaging the character when he was in that state it instead nullified any healing instead? Of course, maybe I didn't type the formula correctly so I'll tell you what I did: The default heal skill had the formula "200 + a.mat" so I changed it to "(b.isStateAffected(17)) {(200) * -1} else {200}". I presume that's what you meant? Let me know if it's something else. 


I also made sure that 17 was the ID of the state and tried removing the gaps in the formula as well and it was the same result. If I healed a character who didn't have the state they were still healed whereas with the afflicted character it's just "0", so part of it's working but I need healing spells to damage the afflicted character rather than nullify healing. 
Alright, so I experimented and ended up resolving this myself. On the off chance that someone that is looking to do the same thing in the future finds this thread in their searches, here's what I did: 

I used the plugin Alistair's "Zombie and Vamparic State/Equipment" and removed this part from the script:


Game_Action.prototype.itemEffectRecoverHp = function(target, effect) {
var value = (target.mhp * effect.value1 + effect.value2) * target.rec;
if (this.isItem()) {
value *= this.subject().pha;
}
value = Math.floor(value);

if (target.zv_Zombie("isZombie")) {
value = -value;
};

if (value !== 0) {
target.gainHp(value);
this.makeSuccess(target);
}
};



This removed the function to have recovery items damage you but keeps the damage from healing spells. I should note that I'm not a scripter, so even though this edit seems to have accomplished what I wanted to do there's a chance it could make other aspects of the plugin not work correctly with further testing.


Thank you Alistair for making the plugin and thanks again Ultimatony, your formula didn't end up doing what I needed in the end but I still appreciate the response very much. And heck, I might still use it even as a gradual buildup from the healing magic being ineffective on the character to it damaging them further through the game.
 

Original thread: https://forums.rpgmakerweb.com/threads/zombie-state-reverse-healing-with-skills-only.55932/