Mending (MV Plugin Tips & Tricks)

From Yanfly.moe Wiki
Jump to navigation Jump to search

Welcome to the wiki! This is where you can find resources from Yanfly.moe, Ækashics.moe,
VisuStella, Caz Wolf, Fallen Angel Olivia, Atelier Irina, and other affiliated content creators.


The Mending skill from Guild Wars will allow the target ally to regenerate HP. However, this skill is sustained by the original caster and will regularly take away MP from the original caster to maintain its upkeep. Here’s how you can recreate the effect in RPG Maker MV!

Required Plugins

The following plugin(s) is required to create this Tips & Tricks effect:

For help on how to install plugins, click here.

For help on how to update plugins, click here.

About

This is a Tips & Tricks effect created for RPG Maker MV. Tips & Tricks are not to be confused with plugins. Instead, they are usually customized code created for the sake of producing unique features/effects that do not require an entire plugin to do.

Yanfly Engine Plugins

This Tips & Tricks effect is made possible due to the Yanfly Engine Plugins library.

Click here if you want to help support Team Yanfly on Patreon.

Instructions

Follow video instructions.

Get the copy/paste versions of the code here:

Place this inside of your Mending state’s notebox. Replace the parts with what fits your game best.
<Custom Regenerate Effect>
// Determine the Upkeep cost.
var mpUpkeep = 5;
// Check if the original caster is alive and has enough MP to sustain the effect.
if (origin.isAlive() && origin.mp >= mpUpkeep) {
  // If the caster does, make the caster lose MP.
  origin.gainMp(-mpUpkeep);
  // Display the MP lost.
  origin.startDamagePopup();
  // Clear the caster's results.
  origin.clearResult();
  // The formula for the regeneration effect.
  var regen = Math.floor(origin.mdf / 2);
  // Make the user gain HP.
  user.gainHp(regen);
  // Show the HP healed.
  user.startDamagePopup();
  // Clear the user's results.
  user.clearResult();
 // If the original caster doesn't have enough MP...
} else {
  // Then remove the state from the user.
  user.removeState(stateId);
}
</Custom Regenerate Effect>
Place this inside of your Mending skill’s notebox. Replace the parts with what fits your game best.
<Actor or Enemy Select>

<Before Eval>
// This is the state ID of Mending.
var stateId = 84;
// Check if the target is affected by Mending.
if (target.isStateAffected(stateId)) {
  // If the target is, remove Mending.
  target.removeState(stateId);
 // If the target isn't...
} else {
  // Add Mending to the target.
  target.addState(stateId);
}
</Before Eval>

Happy Mending!