This is more of a question/request for clarification because every source I could find seemed to imply the process was straightforward. I have an actor who can select an ally to drain a percentage of HP from, even outside of battle. However, when selecting the target ally from the skills scene, the skill does nothing. It just fails.
I messed around with formulas, elements, and parameters, but ultimately only HP/MP recover would work when used on an ally. So I looked into how damage is calculated in rpg_objects.js and found this:
...which confirms that, outside of battle, friendly fire skills appear to fail automatically. When I added this.isForFriend() in there, my HP drain skill did start working, but I would like to know if there's a reason for this default behavior that I should be aware of. I don't want to mess anything up by altering the wrong piece of code, but I would like the HP drain effect to be visible to the player (as it shows from the skills scene natively) rather than taking place inside a common event. Any information is appreciated.
I messed around with formulas, elements, and parameters, but ultimately only HP/MP recover would work when used on an ally. So I looked into how damage is calculated in rpg_objects.js and found this:
JavaScript:
Game_Action.prototype.testApply = function(target) {
return (this.isForDeadFriend() === target.isDead() &&
($gameParty.inBattle() || this.isForOpponent() ||
(this.isHpRecover() && target.hp < target.mhp) ||
(this.isMpRecover() && target.mp < target.mmp) ||
(this.hasItemAnyValidEffects(target))));
};
...which confirms that, outside of battle, friendly fire skills appear to fail automatically. When I added this.isForFriend() in there, my HP drain skill did start working, but I would like to know if there's a reason for this default behavior that I should be aware of. I don't want to mess anything up by altering the wrong piece of code, but I would like the HP drain effect to be visible to the player (as it shows from the skills scene natively) rather than taking place inside a common event. Any information is appreciated.