Substitute For Specific Character

I've been struggling with this issue for a while, hopefully someone here can help provide a solution.


What I'm looking to do is have "Character A" use the substitute mechanic (preferably with 100% chance to do so) specifically for "Character B" when they are in the party together. Little clue how to do this myself, despite my googling.


Thank you for reading, have a nice day.
I've got something for you. you'll only need Yanfly's damage core plugin and a text editor.

  1. Create two states, let's call them, 'safeguarded' and 'protector'. Safeguarded does not contain anything special, and Protector has the substitue attribut on. Preferably make both states be removed at the same time.
  2. Make the 'human shield' skill, set the scope to '1 Ally', and make it always add the Safeguarded state. Then add this code in the skills notebox:  
    Code:
    <After Eval>
       user.addState(x);
    </After Eval>

    Where x is the state ID for the Protector state.
  3. Lastly, you'll need to open the js file called rpg_managers.js in your projects files (search for the js folder) and search for this line:
    Code:
    BattleManager.checkSubstitute = function(target) {
        return target.isDying() && !this._action.isCertainHit();
    };

    You will change it for this one:

    Code:
    BattleManager.checkSubstitute = function(target) {
        return target.isStateAffected(y) && !this._action.isCertainHit();
    };

    Where y is the ID state for the Safeguarded state.

This way, the protector will always take any damage the safeguarded ally should, and no one elses. The sad thing is, you will not be able to use the other type of substitue (the one that protects everyone with HP below 20%), but sacrifices had to be made.


Test it and if it's all god then good luck with your proyect!  😀  
Thanks, it all seems to be working. I wasn't using the default substitute functionality, so it's no big loss. Thanks again.

Original thread: https://forums.rpgmakerweb.com/threads/substitute-for-specific-character.70983/