Erratic Deflector (MV Plugin Tips & Tricks)

From Wiki
Jump to navigation Jump to search

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

The Erratic Deflector is an interesting effect. It deflects damage equal to 4x the user’s DEF/MDF, whichever is higher. The amount deflected will be split evenly across random allies. And the Deflector has a 20% chance of failure while active. It’s a rather random way of defense, but it can certainly keep things interesting! Here’s how we can make 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.


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.


Follow video instructions.

You can grab the copy/paste code here:

Insert the following code into your state’s notebox. Change the values to reflect your game’s settings.
<Custom React Effect>
// Check if this action deals HP damage
if (this.isHpEffect() && value > 0) {
  // The success rate of the deflector
  var successRate = 0.80;
  // Check if the success rate passed
  if (Math.random() < successRate) {
    // Get the target's alive allies
    var allies = target.friendsUnit().aliveMembers();
    // Check if the ally count is more than 1
    if (allies.length > 1) {
      // Remove the target from the allies
      allies.splice(allies.indexOf(target), 1);
      // Set the maximum amount of total targets
      var max = Math.min(allies.length, 4);
      // Set the minimum amount of total targets
      var min = 1;
      // Get a random number between them
      var totalTargets = Math.floor(Math.random() * (max - min + 1) + min);
      // Loop the amount
      while (allies.length > totalTargets) {
        // Remove random allies from the pool
        allies.splice(Math.floor(Math.random() * allies.length), 1);
      // Calculate the redirected damage
      var redirectedDamage = Math.min(value, Math.max(target.def * 4, target.mdf * 4));
      redirectedDamage = Math.ceil(redirectedDamage / totalTargets);
      // Reduce the value of the damage
      value = value - redirectedDamage;
      // Loop through the remaining allies
      while (allies.length > 0) {
        // Get the currently looped ally
        var member = allies.shift();
        // Check if the ally exists
        if (member) {
          // Make that member take damage
          // Display a popup
          // Show an animation
          // Check if the member is dead
          if (member.isDead()) {
            // Collapse the member
          // Clear the member's results
</Custom React Effect>