Absorb Ailments (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.


Today, we have an effect that can be used to remove all status effects of a certain type and place it onto the user instead, then healing each ally for each ailment removed. This effect is immensely useful for supporting characters.

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.

You can grab the copy/paste code here:

Insert this into your Absorb Ailments damage formula box
this._absorbHeal || 0
Insert the following code into the Absorb Ailments skill’s notebox. Alter the values to fit your game’s settings.
<Before Eval>
// Check if the absorption hasn't begun yet.
if (!this._absorbedAllStates) {
  // Enable the absorption flag.
  this._absorbedAllStates = true;
  // Initialize the amount to be healed.
  this._absorbHeal = 0;
  // This is how much healing each absorbed state will do.
  var heal = user.mdf;
  // Create a list of all the states that can be absorbed.
  var absorbedStates = [];
  // Put all the states that will get absorbed here.
  absorbedStates.push(21, 22, 23, 24, 25, 26, 27, 28, 29, 30);
  absorbedStates.push(31, 32, 33, 34, 35, 36, 37, 38, 39, 40);
  // Get the group of alive allies
  var group = user.friendsUnit().aliveMembers();
  // Loop through each member in the group
  for (var i = 0; i < group.length; ++i) {
    // Get the currently looped member
    var member = group[i];
    // Check if the member exists and isn't the user
    if (member && member !== user) {
      // Loop through each of the absorbable states
      for (var j = 0; j < absorbedStates.length; ++j) {
        // Get the currently looped state's ID
        var id = absorbedStates[j]
        // Check if the state exists and if the member is affected by it
        if ($dataStates[id] && member.isStateAffected(id)) {
          // Get the turns on the state
          var turns = member.stateTurns(id);
          // Remove the state from the member
          member.removeState(id);
          // Add the state to the user
          user.addState(id);
          // Set the turns of it to the user
          user.setStateTurns(id, turns);
          // Increase the amount healed
          this._absorbHeal += heal;
        }
      }
    }
  }
}
</Before Eval>

Enjoy!