Minion Barrier (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 Minion Barrier is a passive effect for a boss where the boss will redirect any direct damage towards minions if there are minions present. This effect can be achieved using various Yanfly Engine Plugins and here’s how!

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 the following code into your boss’s passive state’s notebox. Change the value to reflect your game’s settings.
<Custom Passive Condition>
// The passive effect will only be true if there's more than 1 member on the field
condition = user.friendsUnit().aliveMembers().length > 1;
</Custom Passive Condition>

<Custom React Effect>
// Check if this dealt HP damage
if (this.isHpEffect() && value > 0) {
  // Get the current group of alive allies
  var allies = target.friendsUnit().aliveMembers();
  // Calculate the amount of damage dealt spread across the allies
  var dmg = Math.ceil(value / Math.max(1, allies.length - 1));
  // Check if the number of allies is greater than 0
  if (allies.length - 1 > 0) {
    // If it is, reduce the direct damage to 0
    value = 0;
  }
  // Loop through each of the allies
  for (var i = 0; i < allies.length; ++i) {
    // Get the currently looped ally
    var ally = allies[i];
    // Check if the ally exists and isn't the target
    if (ally && ally !== target) {
      // Make the ally take damage
      ally.gainHp(-dmg);
      // Show the damage popup
      ally.startDamagePopup();
      // Display an animation on that ally
      ally.startAnimation(12);
      // If the ally is dead
      if (ally.isDead()) {
        // Then make the ally collapse
        ally.performCollapse();
      }
      // Clear the ally's results
      ally.clearResult();
    }
  }
}
</Custom React Effect>

Enjoy!