Tips & Tricks – Minion Barrier – 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.

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!

You can grab the copy/paste code here: 


Insert the following code into your boss’s passive state’s notebox. Change the value in red 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!

Happy RPG Making!


These plugins and Tips & Tricks ideas are made possible thanks to our creative patrons on Patreon! The majority of our Tips & Tricks, Plugins, and Lunatic Pack ideas are placed within the Patreon-exclusive Sample Project for quick and easy access! If you'd like to make a Plugin Suggestion, Yanfly's Patreon-based Suggestion Box a visit here:


If you have any bugs to report, visit the following link:


If you have any questions about Action Sequences, visit the following link:



Thank you!