Bubble Wrap (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.


In MMBN, the Bubble Wrap effect will block damage (except for Electric), remove itself, and then come back a few turns later, making it one of the better ways to mitigate damage as a whole! Here’s how we can 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.

You can grab the copy/paste code here:

Insert the following Lunatic Mode code into the Bubble Wrap passive state’s notebox. Change the values to reflect your game’s settings.
<Custom Battle Effect>
// Get the state ID for the bubble wrap effect state
var bubbleWrapId = 295;
// Add that state to the user
user.addState(bubbleWrapId);
// Set the cooldown to 0
user._bubbleWrapCooldown = 0;
</Custom Battle Effect>

<Custom Regenerate Effect>
// Default the bubble wrap cooldown to 0
user._bubbleWrapCooldown = user._bubbleWrapCooldown || 0;
// Check if the cooldown is above 0
if (user._bubbleWrapCooldown > 0) {
  // Decrease the cooldown by 1
  user._bubbleWrapCooldown -= 1;
  // Check if the cooldown has reached 0 or less
  if (user._bubbleWrapCooldown <= 0) {
    // Get the state ID for the bubble wrap effect state
    var bubbleWrapId = 295;
    // Play an animation on the user
    user.startAnimation(82);
    // Add the state to the user
    user.addState(bubbleWrapId);
  }
}
</Custom Regenerate Effect>
Insert the following Lunatic Mode code into the Bubble Wrap effect state’s notebox. Change the values to reflect your game’s settings!
 <Custom React Effect>
// Check if HP damage is dealt
if (this.isHpEffect() && value > 0) {
  // Get the elements used for the effect
  var elements = this.getItemElements();
  // Get the element ID for the lightning element
  var lightningElementId = 9;
  // Check if the lightning element isn't involved
  if (!elements.contains(lightningElementId)) {
    // If isn't involved, set the damage to 0
    value = 0;
  }
  // Play an animation on the target
  target.startAnimation(4);
  // Remove the bubble wrap state from the target
  target.removeState(stateId);
}
</Custom React Effect>

<Custom Remove Effect>
// Set the bubble wrap cooldown to 3 turns
user._bubbleWrapCooldown = 3;
</Custom Remove Effect>

Happy wrapping!