Subjugate (MV Plugin Tips & Tricks)

From Yanfly.moe Wiki
Revision as of 15:07, 9 July 2019 by Yanfly (talk | contribs) (Created page with "{{Yanfly Tips & Tricks MV |preview = <youtube>https://www.youtube.com/watch?v=oGS0L5ilysQ</youtube> |desc = The Subjugate ability is used by Trundle in League of Legends. It...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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 Subjugate ability is used by Trundle in League of Legends. It drains a percentage of the target’s HP as well as drains DEF/MDF from the target and for the next few seconds, continues draining HP. We’ll be modifying this effect to fit the turn-based structure for RPG Maker MV! Here’s how we’ll go about it!

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.

Warning for RPG Maker MZ Users

Warning.jpg

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.

Instructions

Follow video instructions.

You can grab the copy/paste code here:

Insert the following Lunatic Mode code into your Subjugate skill’s notebox. Change the values to reflect your game’s settings.
<Pre-Damage Eval>
// Set the damage to cap at 9999
value = Math.min(value, 9999);
</Pre-Damage Eval>

<Post-Damage Eval>
// Set the turn duration for buffs
var turns = 4;
// Add DEF buff to user
user.addBuff(3, turns);
// Add MDF buff to user
user.addBuff(5, turns);
// Check if the target was dealt HP damage
if (target.result().hpDamage > 0) {
  // Make the user gain the damage dealt
  user.gainHp(target.result().hpDamage);
  // Start a damage popup on the user.
  user.startDamagePopup();
  // Clear the results
  user.clearResult();
}
// Check if the target's HP is above 0
if (target.hp > 0) {
  // Get the Subjugate Drain state's ID
  var drainStateId = 251;
  // Debuff the target's DEF
  target.addDebuff(3, turns);
  // Debuff the target's MDF
  target.addDebuff(5, turns);
  // Add the drain state to the target
  target.addState(drainStateId);
  // Default the target's subjugate damage to 0.
  target._subjugateDmg = target._subjugateDmg || 0;
  // Set the damage to be dealt across subjugate's duration
  target._subjugateDmg += target.result().hpDamage;
}
</Post-Damage Eval>
Insert the following Lunatic Mode code into your Subjugate Drain state’s notebox. Change the values to reflect the settings of your game.
<Custom Regenerate Effect>
// Default the subjugate damage to 0.
user._subjugateDmg = user._subjugateDmg || 0;
// Check if the user is alive and the subjugate damage is above 0.
if (user.isAlive() && user._subjugateDmg > 0) {
  // Get the current turn count for this state.
  var turns = Math.max(1, user.stateTurns(stateId));
  // Calculate the damage to be dealt.
  var dmg = Math.ceil(user._subjugateDmg / turns);
  // Reduce the stored subjugate damage.
  user._subjugateDmg -= dmg;
  // Make the user take the damage.
  user.gainHp(-dmg);
  // Play an animation
  user.startAnimation(4);
  // Show the damage popup
  user.startDamagePopup();
  // Check if the user is dead
  if (user.isDead()) {
    // Then collapse the user
    user.performCollapse();
  }
  // Clear the user's results
  user.clearResult();
  // Check if the origin isn't the user and the origin is alive
  if (origin !== user && origin.isAlive()) {
    // Make the origin gain the HP from subjugate
    origin.gainHp(dmg);
    // Start an animation on the origin
    origin.startAnimation(46);
    // Show a damage popup
    origin.startDamagePopup();
    // Clear the results
    origin.clearResult();
  }
}
</Custom Regenerate Effect>

<Custom Remove Effect>
// Reset the subjugate damage
user._subjugateDmg = 0;
</Custom Remove Effect>

Enjoy!