Tips & Tricks – Roaming Mend (Star Wars: The Old Republic) – RPG Maker MV

Yanfly Engine Plugins is a plugin library made for RPG Maker MV, a wonderful piece of software to help you make that role playing game of your dreams. You can find out more about RPG Maker MV here.

Roaming Mend is a skill used by the Dark Side in Star Wars: The Old Republic. When an ally affected by Roaming Mend is struck, it will heal that ally and then move to another random ally with the same effect. Roaming Mend can heal up to 4 allies this way. Now, you can recreate this effect in RPG Maker MV!

You can grab the copy/paste version of the code here: 

Insert this into the Roaming Mend state’s notebox. Change the values in red to fit your game.

<Custom Apply Effect>
// Set the default charges to 4.
this._roamingMendCharges = 4;
// Calculate the amount of the heal.
this._roamingMendHeal = origin.mat * 4;
// Sets the counter to display the charges.
this.setStateCounter(stateId, 'x' + 4);
</Custom Apply Effect>

<Custom Remove Effect>
// Removes the stored charge information.
this._roamingMendCharges = undefined;
// Removes the stored heal information.
this._roamingMendHeal = undefined;
</Custom Remove Effect>

<Custom Deselect Effect>
// Check if the target took HP damage and has more than 1 HP.
if (this.isHpEffect() && this.isDamage() && target.hp > 0) {
  // Get the stored healing value. If none, it will default to 1.
  var heal = target._roamingMendHeal || 1;
  // Plays an animation on the target.
  target.startAnimation(45);
  // Heals the target's HP.
  target.gainHp(heal);
  // Starts the healing popup on the target.
  target.startDamagePopup();
  // Clears the target's results.
  target.clearResult();
  // Calculates the next charge amount.
  var charges = target._roamingMendCharges - 1;
  // Removes the state from the target.
  target.removeState(stateId);
  // Check if there are more than 0 charges.
  if (charges > 0) {
    // Create an empty array.
    var members = [];
    // Loop through each of the target's alive allies.
    for (var i = 0; i < target.friendsUnit().aliveMembers().length; ++i) {
      // Set the potential variable to the current looped ally.
      var potential = target.friendsUnit().aliveMembers()[i];
      // If the ally doesn't exist, move onto the next.
      if (!potential) continue;
      // If the ally is the same as the target, move onto the next.
      if (potential === target) continue;
      // If the ally is already affected by a different Roaming Mend effect, move onto the next.
      if (potential.isStateAffected(stateId)) continue;
      // If the ally's HP is at zero (hence dead), move onto the next.
      if (potential.hp <= 0) continue;
      // Now that all checks have been cleared, put the potential ally into the members array.
      members.push(potential);
    }
    // Get a random member of the members array.
    var member = members[Math.floor(Math.random() * members.length)];
    // Check if the random member exists.
    if (member) {
      // Play an animation on that random member.
      member.startAnimation(97);
      // Move the Roaming Mend state onto that random member.
      member.addState(stateId);
      // The random member's charges get updated.
      member._roamingMendCharges = charges;
      // The healing amount gets transfered over to the random member.
      member._roamingMendHeal = heal;
      // Sets the charge counter for the random member.
      member.setStateCounter(stateId, 'x' + charges);
    }
  }
}
</Custom Deselect Effect>

Happy mending!

Please wait while you are redirected...or Click Here if you do not want to wait.