Void Shift (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.


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!

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.

Get the copy/paste version of the code here:

Replace the values to 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!~