[RPG MV]Damage in Cure State by Yanfly

Discussion in 'Javascript/Plugin Support' started by Aandel, Jul 7, 2019.

  1. Aandel

    Aandel Villager Member

    Messages:
    16
    Likes Received:
    1
    First Language:
    Portugues
    Hello people!

    I'm creating a skill called Reverse using the Yanfly plugins.
    It is a state where Damage causes healing.
    I'm trying to use this note in the State:

    <Custom React Effect>

    // Check if the action is a damage skill.

    if (this.isHpDamage()) {

    // If it is, let's convert the value into cure!

    var heal = Math.floor(target.mhp * rate);

    }

    </Custom React Effect>


    But it does not work, can you help me solve. Thank you!
     
    #1
  2. bgillisp

    bgillisp Global Moderators Global Mod

    Messages:
    11,748
    Likes Received:
    11,781
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMVXA
    What do you do with the variable heal? You store a value there, but I don't see where you use it anywhere in that code snippet.
     
    #2
  3. Aandel

    Aandel Villager Member

    Messages:
    16
    Likes Received:
    1
    First Language:
    Portugues
    Hi bgillisp!

    I used as base the code of "Undead" of Yanfly

    <Custom React Effect>
    // Check if the action is a recovery skill.
    if (this.isHpRecover()) {
    // If it is, let's convert the value into damage!
    value = Math.abs(value);
    }
    </Custom React Effect>

    So it seems I do not know what I'm doing ... XD Could you help me with that?
     
    #3
  4. bgillisp

    bgillisp Global Moderators Global Mod

    Messages:
    11,748
    Likes Received:
    11,781
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMVXA
    I know little Javascript, but the code you used as a base worked as value is already returned by the system. But you stored it as heal, which is not used by the system on a damage skill, which is why it is doing nothing. You'll have to add code to have it actually heal you the amount of what you stored, but I don't know enough Javascript to help with that code. Though it might be included in one of the other tips/tricks videos, check the one on poison or so as I remember seeing one in 2015/2016 that had code for how to do damage or heal inside the react effect.
     
    #4
  5. Lexincarnum

    Lexincarnum Warper Member

    Messages:
    1
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMMV
    try this:

    <Custom React Effect>
    // Check if the current action deals HP damage.
    if (this.isHpEffect() && value > 0) {
    // Heal the target for equal amount.
    target.gainHp(value*2);
    // Display the damage popup.
    target.startDamagePopup();
    // Clear the results.
    target.clearResult();
    }
    </Custom React Effect>
     
    #5
    Wavelength likes this.

Share This Page