Earth Shield (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.


Earth Shield is a skill from World of WarCraft that does a number of things. When used, it will have 9 charges. If the unit takes damage or receives healing, a charge will be consumed. Upon taking damage, the user then receives healing equal to 50% of the caster’s MAT. If the unit is healed, then the healing done is increased by 20%. What a flexible status effect! This video will show you how to recreate this 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.

Warning for RPG Maker MZ Users

Warning.jpg

If you are using RPG Maker MZ and VisuStella MZ, the following code may or MAY NOT work as this Tips & Tricks is made for RPG Maker MV. VisuStella MZ is NOT responsible if this Tips & Trick does not work because the code base for RPG Maker MV and RPG Maker MZ are different and the code base between Yanfly Engine Plugins and VisuStella MZ is even more drastically different.

Instructions

Follow video instructions.

For the copy/paste version of the code, look here:

Place this code inside of your Earth Shield’s notebox. Replace the values to fit your game’s settings.

<Custom Apply Effect>
// Get the current 50% value of the caster's MAT upon the state being applied as the Earth Shield Heal value.
target._earthShieldHeal = Math.floor(origin.mat * 0.50);
// Set the number of charges on the state to 9.
target.setStateCounter(stateId, 9);
</Custom Apply Effect>

<Custom Remove Effect>
// When removed, clear the stored heal value.
target._earthShieldHeal = undefined;
// When removed, clear the number of charges on the state.
target.removeStateCounter(stateId);
</Custom Remove Effect>

<Custom React Effect>
// If the received action is an HP effect and if it's a Heal...
if (this.isHpEffect() && value < 0) {
  // ...then increase the heal by 20%.
  value = Math.floor(value * 1.20);
  // Then reduce the state's charges by -1.
  target.addStateCounter(stateId, -1);
  // If the state's charges reach 0 or less...
  if (target.getStateCounter(stateId) <= 0) {
    // ...then remove the state.
    target.removeState(stateId);
  }
}
</Custom React Effect>

<Custom Deselect Effect>
// Make a copy of the target's results.
var result = JsonEx.makeDeepCopy(target.result());
// Check if the target is alive and if the amount of damage received is above 0.
if (target.isAlive() && result.hpDamage > 0) {
  // Set the amount of HP to heal equal to the stored Earth Shield Heal value.
  var hpHealed = target._earthShieldHeal || 0;
  // Make the target gain that much HP.
  target.gainHp(hpHealed);
  // Show the damage popup on the target.
  target.startDamagePopup();
  // Clear the target's results.
  target.clearResult();
  // Reduce the state's charges.
  target.addStateCounter(stateId, -1);
  // If the state's charges reach 0 or less...
  if (target.getStateCounter(stateId) <= 0) {
    // ...then remove the state.
    target.removeState(stateId);
  }
  // Reset the target's results back to what they were before.
  target._result = result;
}
</Custom Deselect Effect>

Happy shielding!