Critical Protect (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.


In some games, certain buffs occur automatically once the user reaches critical HP levels. This Tips & Tricks video will show you how to apply a DEF buff on your battlers when their HP drops to under 25%!

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 get the copy/paste code here:

Place this inside of your state’s notebox. Change the values to fit your game:

<Custom Battle Effect>
// Reset Critical Protect flag each battle.
user._criticalProtect = false;
</Custom Battle Effect>

<Custom Victory Effect>
// Reset Critical Protect flag each battle.
user._criticalProtect = false;
</Custom Victory Effect>

<Custom Escape Effect>
// Reset Critical Protect flag each battle.
user._criticalProtect = false;
</Custom Escape Effect>

<Custom Defeat Effect>
// Reset Critical Protect flag each battle.
user._criticalProtect = false;
</Custom Defeat Effect>

<Custom Respond Effect>
// This is the HP Rate the target has to be under to activate Critical Protect.
var crisis = 0.25;
// Check if the player is in battle, the target is alive, and the HP rate is under the right amount.
if ($gameParty.inBattle() && target.isAlive() && target.hpRate() <= crisis && !target._criticalProtect) {
  // Set the critical protect flag to true.
  target._criticalProtect = true;
  // The number of turns the buff will last.
  var turns = 5;
  // Adds DEF (ID: 3) buff to target.
  target.addBuff(3, turns);
  // Play an animation to indicate it activated.
  target.startAnimation(53);
}
</Custom Respond Effect>

Happy protecting!