Trying to make a "Cover" skill.

I'm trying to make a skill for my tank character called Cover. The skill would make it so Adam (the tank) will use the skill, and then for the next turn, he will be given any damage meant to go towards other allies that have lower hp. I created a State for it with the Substitute flag, and made the skill apply the state. When he uses the Cover skill in battle, it shows the state icon, indicating that he is in fact put in that state, but the substitution doesnt work.

I don't know if its because the other party members hp arent low enough, since I know in Ace it would only work if their hp were below 25%, but there were scripts to fix that.

If possible, I'd like to make it so that he cover's the other party members hp regardless of if it's lower or not, But i'm not sure that's possible. If I could get it to work at all, in any form, I'll be ok with that.

Here's some screenshots of what I have set up. I'm still learning about setting up skills and states, so the problem may be obvious.

6hozr7.png

 

2qith54.png


Thanks in advance for any help you guys can offer.
rpg_manager.js

BattleManager.checkSubstitute = function(target) {  return target.isDying() && !this._action.isCertainHit();};The 'isDying()' is the part you are talking about?  You can just make a new function, remove it, do whatever to it.

The function is defined in 

rpg_objects.js

Code:
Game_BattlerBase.prototype.isDying = function() {    return this.isAlive() && this._hp < this.mhp / 4;};
The best way I can think of to achieve the effect you want is through Yanfly's Taunt script, check this video out. You can have your character taunt the enemy targets into only attack him.
Well that's actually going to be really useful for another character later on who's more of a warrior type.. But for this guy I wanted all of his skills to specifically focus around defending/guarding. Cover is essentially the same thing I guess.. It's still him taking damage instead of another party member.

Maybe i'll just do that then. I'll have him use a skill that gives him the taunt effect, but use the shield icon and the shield buff animation. Same effect.

Thank you for the help. :]
Glad to help!
rpg_manager.js




BattleManager.checkSubstitute = function(target) {  return target.isDying() && !this._action.isCertainHit();};


The 'isDying()' is the part you are talking about?  You can just make a new function, remove it, do whatever to it.

The function is defined in 


rpg_objects.js




Game_BattlerBase.prototype.isDying = function() {    return this.isAlive() && this._hp < this.mhp / 4;};

How can I change it so Knights can't protect allies from magical attacks, either?
Same thing with Yanfly's Taunt plugin ^
I'm trying to make a skill for my tank character called Cover. The skill would make it so Adam (the tank) will use the skill, and then for the next turn, he will be given any damage meant to go towards other allies that have lower hp. I created a State for it with the Substitute flag, and made the skill apply the state. When he uses the Cover skill in battle, it shows the state icon, indicating that he is in fact put in that state, but the substitution doesnt work.

I don't know if its because the other party members hp arent low enough, since I know in Ace it would only work if their hp were below 25%, but there were scripts to fix that.

If possible, I'd like to make it so that he cover's the other party members hp regardless of if it's lower or not, But i'm not sure that's possible. If I could get it to work at all, in any form, I'll be ok with that.

Here's some screenshots of what I have set up. I'm still learning about setting up skills and states, so the problem may be obvious.

6hozr7.png



2qith54.png


Thanks in advance for any help you guys can offer.
Did you get this to work?
Idk if this will help anyone because it has been a long time....
But this idea actually worked for me: (using Yanfly's Passive Auras http://yanfly.moe/2016/10/08/yep-117-passive-aura-effects-rpg-maker-mv/)

Make your cover skill, that grants you the state with the Substitute Flag, and also gives a Passive aura to all allies but the user, like so:
"Total Cover" State:
<Ally Aura: 195> and Substitute Flag Trait ------------ > grants State named "Covered 100%, with nothing special on it

As they say before, edit "rpg_objects.js" in this line
Code:
Game_BattlerBase.prototype.isDying = function() {    return this.isAlive() && this._hp < this.mhp / 4;};

Edit it so now the the game checks if the battler has the state needed for the substitute to work:
Code:
Game_BattlerBase.prototype.isDying = function() {
  if(this.isStateAffected(195)){
      return this.isAlive() && this._hp <= this.mhp;
  } else if(this.isStateAffected(196)){
      return this.isAlive() && this._hp < this.mhp / 4 * 3;
  } else if(this.isStateAffected(197)){
      return this.isAlive() && this._hp < this.mhp / 2;
  } else if(this.isStateAffected(198)){
      return this.isAlive() && this._hp < this.mhp / 4;
  }
};

So now, if your allies have the aura state 195, they will be set as "dying" and therefore will be covered, even if they are full health.
If you give your allies the aura 196, they will be covered if they have 75% hp or less.
Aura 197 will be covered if they are 50% or less, and so on.

You can get very creative with this conditions, so I hope this works for you or anyone that reads this!!
Using Yanfly's Buffs & States Core plugin, I get the cover skill effect with:

<Custom Respond Effect>
if (this.isHpEffect() && value > 0){
origin.gainHp(-value);
origin.startDamagePopup();
target.gainHp(value);
target.startDamagePopup();
target.clearResult();
}
</Custom Respond Effect>

Original thread: https://forums.rpgmakerweb.com/threads/trying-to-make-a-cover-skill.50010/