Undo (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.

Undo is a skill effect from the Exorcist class of Bravely Default. It lets you revert the HP or MP values of a target to what it was a turn (or a few) ago! If the target had more HP, it will become exactly that. If the target had less, it will also become exactly that!

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.

Warning for RPG Maker MZ Users


If 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.


Follow video instructions.

You can grab the copy/paste code here:

Insert the following code into the Undo Global state.
<Custom Battle Effect>
// When a new battle starts, up to three turns of information regarding the HP of the actor will be stored.
user._undoHp0 = user.hp;
user._undoHp1 = user.hp;
user._undoHp2 = user.hp;
user._undoHp3 = user.hp;
</Custom Battle Effect>

<Custom Turn End Effect>
// At the end of each turn, apply the information of the previous turn to keep it up to date.
user._undoHp3 = user._undoHp2;
user._undoHp2 = user._undoHp1;
user._undoHp1 = user._undoHp0;
user._undoHp0 = user.hp;
</Custom Turn End Effect>
Insert the following code into your Undo HP skill’s notebox. Change the values as needed.
<Before Eval>
// This is the state ID of the Undo Deux state.
var undo2 = 202;
// This is the state ID of the Undo Trois state.
var undo3 = 203;
// Check if the user is affected by Undo Trois.
if (user.isStateAffected(undo3)) {
  // Then get the range of the target's HP 3 turns ago.
  var range = target._undoHp3;
// Check if the user is affected by Undo Deux.
} else if (user.isStateAffected(undo2)) {
  // Then get the range of the target's HP 2 turns ago.
  var range = target._undoHp2;
// Otherwise...
} else {
  // Get the range of the target's HP 1 turn ago.
  var range = target._undoHp1;
// Get the difference of the target range and the target's current HP.
var hp = range - target.hp;
// Alter the target's HP.
// Start the damage popup.
// Check if the target is dead.
if (target.isDead()) {
  // If the target is dead, make the target collapse.
// Clear the target's results.
</Before Eval>