Moody (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 Pokémon, the Moody passive is a fun passive trait which causes its user to randomly gain buffs and debuffs. In the latest version of the game, the buffed stat goes up quite a bit while the debuffed stat goes down once. The randomly buffed stat and debuff stat will always be different from one another. 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.

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 Moody passive state’s notebox. Change the values to reflect your game’s settings.
<Custom Regenerate Effect>
// This is the number of turns the buffs and debuffs will last
var turns = 5;
// Create a pool for the parameters that can be changed
var allowedParams = [];
// Insert Param ID's you want to randomly add here:
allowedParams.push(2, 3, 4, 5, 6, 7);
// Make a copy of the pool
var result = allowedParams.slice();
// Initialize the parameter ID
var paramId;
// Loop through each of the copied pool's parameters
while (result.length > 0) {
  // Get a randomly looped parameter
  paramId = result[Math.floor(Math.random() * result.length)];
  // Remove it from the copied pool
  result.splice(result.indexOf(paramId), 1);
  // Check if the user isn't at max buffs for that stat
  if (!user.isMaxBuffAffected(paramId)) {
    // Buff the user twice for that stat
    user.addBuff(paramId, turns);
    user.addBuff(paramId, turns);
    // Break the loop
    break;
  }
}
// Make a copy of the pool again
var result = allowedParams.slice();
// Check if the previously initialized parameter has a value
if (paramId !== undefined) {
  // Get the index of the parameter
  var index = result.indexOf(paramId);
  // If it is 0 or greater
  if (index > -1) {
    // Then remove it from the pool
    result.splice(index, 1);
  }
}
// Loop through the copied pool once more
while (result.length > 0) {
  // Get a randomly looped parameter
  paramId = result[Math.floor(Math.random() * result.length)];
  // Remove the looped parameter from the pool
  result = result.splice(result.indexOf(paramId), 1);
  // Check if the user isn't at max debuffs for that parameter
  if (!user.isMaxDebuffAffected(paramId)) {
    // Then add a debuff to that parameter
    user.addDebuff(paramId, turns);
    // Break the loop
    break;
  }
}
</Custom Regenerate Effect>

Enjoy!