How to heal the party when using a damage-dealing attack?

Discussion in 'Javascript/Plugin Support' started by Cinnamon, Jul 31, 2017.

  1. Cinnamon

    Cinnamon Veteran Veteran

    Messages:
    605
    Likes Received:
    209
    First Language:
    English
    I've got a magic attack set up to call a Common Event. The magic attack deals damage to all enemies. I'd like it to then also heal the entire party. However, I have two problems with this:

    - I don't know how to check which actors are currently in the battle. I'm using Yanfly's Party script, so technically I can have more than 4 actors in the party. How do I know which 4 are the ones in the battle?

    - When using "Change HP" on an actor, they don't get a damage popup. How can I add one?
     
    #1
  2. Gamefall Team

    Gamefall Team Nebula Games Leader Veteran

    Messages:
    336
    Likes Received:
    410
    Location:
    Italy
    First Language:
    Italian
    Primarily Uses:
    RMMV
    Well, I think we can try an approach using a sort of "fake skill" combined with some coding:

    • In the database creates a fake skill like that:
    upload_2017-7-31_13-16-13.png

    • SCOPE 1 ALLY;
    • NO MP COST (Or if you want set it);
    • IN BATTLE;
    • EFFECT --> Set as effect the recovery of HP (100% or what you want);
    • ANIMATION: Set your animation;
    • MESSAGE: Set a message for the log (Maybe something not related to the user of the skill!)
    • NO TP GAINING (Or if you want you can set a value)

    In your common event, set this script:

    Code:
    var party = $gameParty.battleMembers().filter(function(member) { return member.isAlive() });
    party.forEach(function(member) {
    var action = new Game_Action(member, true)
    action.setSkill(skillId)
    return action.apply(member) })
    BattleManager.refreshStatus();
    party.forEach(function(member) { member.startDamagePopup() })
    SceneManager._scene._logWindow.startAction(BattleManager.actor(), action, party)
    SceneManager._scene._logWindow.clear()
    So, you will create a var where you store all the battleMembers and in particular filtering the one alive;
    For each of them you create a new action that will use the fake skill you created;
    We will push the damage popup for the recovery;
    Update the log window!
     
    #2
  3. Naveed

    Naveed Veteran Veteran

    Messages:
    314
    Likes Received:
    142
    First Language:
    English
    Primarily Uses:
    RMMV
    You don't need it to be so complicated. If you have Yanfly Skill Core, you can do this instead (no need to call a common event either):

    Code:
    <Post-Damage Eval>
    var heal = VALUE; // Replace with how much hp you want to heal
    
    var members = $gameParty.battleMembers();
    
    for (var i = 0; i < members.length; i++) {
    var ally = members[i];
    if (ally.isDead()) continue;
    ally.gainHp(heal);
    ally.startDamagePopup();
    ally.clearResult();
    }
    </Post-Damage Eval>
     
    #3
    Gamefall Team likes this.
  4. Gamefall Team

    Gamefall Team Nebula Games Leader Veteran

    Messages:
    336
    Likes Received:
    410
    Location:
    Italy
    First Language:
    Italian
    Primarily Uses:
    RMMV
    @Naveed Oh, yeah! I forget about the skill core lol ! Good try! :kaojoy:
     
    #4
  5. Cinnamon

    Cinnamon Veteran Veteran

    Messages:
    605
    Likes Received:
    209
    First Language:
    English
    Thanks, guys! Both work like a charm. Very useful to learn this. :)
     
    #5
    Gamefall Team likes this.

Share This Page