Erratic Deflector (MV Plugin Tips & Tricks)
|
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 PluginsThe 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. AboutThis 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 PluginsThis 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 UsersIf 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. InstructionsFollow video instructions. You can grab the copy/paste code here:
<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
member.gainHp(-redirectedDamage);
// Display a popup
member.startDamagePopup();
// Show an animation
member.startAnimation(2);
// Check if the member is dead
if (member.isDead()) {
// Collapse the member
member.performCollapse();
}
// Clear the member's results
member.clearResult();
}
}
}
}
}
</Custom React Effect>
Enjoy! |








