Targeted Substitute

My question is twofold:


How do I make it so Substitute is a targeted skill


And


How do I change the parameter it triggers on?


Currently I know how to modify the isDying modifier in Objects.js but I would rather just have Substitute always work. I'd rather just be able to select the person I want to take damage for and have it work regardless of HP.


Thank you for any assistance!
To change the condition for a substitute, change the checkSubstitute function to return true. 


To make substitute a target skill, you need a Plugin.
To change the condition for a substitute, change the checkSubstitute function to return true. 


To make substitute a target skill, you need a Plugin.

I have no idea how to change checksubstitute to return true.
I figure I need to change


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


but I don't know to what
Change the checkSubstitute function to this:


BattleManager.checkSubstitute = function(target) {
return true;
};


This means the condition for a substitute is always true.


But I would suggest that you put this code in a new .js file and import it as a new plugin, rather than chaning the sourcecode of RPG Maker. Then you have a better overview what you've changed.
Thank you that made it work 90% like what I wanted
Except now substitute works on blocking states as well as damage.

Original thread: https://forums.rpgmakerweb.com/threads/targeted-substitute.70391/