Tips & Tricks – Void Shift (World of WarCraft) – 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.

The ability, Void Shift, from World of WarCraft allows the user and the target to swap HP percentages. If the lower of the percentages is below 25%, raise it to 25%. You can now recreate this effect in RPG Maker MV!

Get the copy/paste version of the code here: 

Replace the values in red with values that fit your game.

// Instant Cast
<Instant>

// Selection Control
// Prevent User from selecting itself
<Select Conditions>
Not User
</Select Conditions>

// Skill Core
<After Eval>
// Gets the HP% of the user.
var hpRate1 = user.hpRate();
// Gets the HP% of the target.
var hpRate2 = target.hpRate();
// Animation ID for dropping HP.
var aniLower = 58;
// Animation ID for raising HP.
var aniUpper = 46;
// Check which is the lower of the two %.
if (hpRate1 > hpRate2) {
  // Set minimum % of lower rate to 0.25%.
  hpRate2 = Math.max(0.25, hpRate2);
} else {
  // Set minimum % of lower rate to 0.25%.
  hpRate1 = Math.max(0.25, hpRate1);
}
// Check if user's HP% will be lowered.
if (user.hpRate() > hpRate2) {
  // Play dropping HP animation on user.
  user.startAnimation(aniLower);
} else {
  // Play raising HP animation on user.
  user.startAnimation(aniUpper);
}
// Check if target's HP$ will be lowered.
if (target.hpRate() > hpRate1) {
  // Play dropping HP animation on target.
  target.startAnimation(aniLower);
} else {
  // Play raising HP animation on user.
  target.startAnimation(aniUpper);
}
// Calculate what HP user's HP should become.
var hp1 = Math.ceil(hpRate2 * user.mhp);
// Calculate what HP target's HP should become.
var hp2 = Math.ceil(hpRate1 * target.mhp);
// Set user's HP to calculated amount.
user.setHp(hp1);
// Set target's HP to calculated amount.
target.setHp(hp2);
</After Eval>

Happy shifting!~

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