Tips & Tricks – Undo (Bravely Second) – 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.

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!

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 in red 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.
target.gainHp(hp);
// Start the damage popup.
target.startDamagePopup();
// Check if the target is dead.
if (target.isDead()) {
  // If the target is dead, make the target collapse.
  target.performCollapse();
}
// Clear the target's results.
target.clearResult();
</Before Eval>

Enjoy!

Please wait while you are redirected...or Click Here if you do not want to wait.