Collect & Inject Ailments (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.


Today’s Tips & Tricks is rather interesting. It is split between two skills. One skill is used to collect ailments. The other skill is used to inject the collected ailments onto enemies! Here’s how you can create 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 your Collect Ailment skill’s notebox. Change the values to reflect your game’s settings.
<Custom Select Condition>
// Can only select targets that are affected by an ailment.
condition = target.isStateCategoryAffected('ailment');
</Custom Select Condition>

<Before Eval>
// Get the ailment category.
var category = 'ailment';
category = category.toUpperCase();
// Get all of the target's states.
var states = target.states();
// Loop through each state.
for (var i = 0; i < states.length; ++i) {
  // Get the currently looped state.
  var state = states[i];
  // Check if the state exists and if the state's category matches the ailment.
  if (state && state.category.contains(category)) {
    // Store the collected ailment's ID.
    user._collectedAilment = state.id;
    // Remove the state from the target.
    target.removeState(state.id);
    // Create a message and wait time.
    var text = '<CENTER>\\c[6]' + user.name() + '\\c[0] collects \\c[4]' + state.name + '\\c[0] ailment!';
    var wait = 90;
    // Display the message.
    BattleManager.addText(text, wait);
    // Break the current loop.
    break;
  }
}
</Before Eval>
Insert the following Lunatic Mode code into your Inject Ailment skill’s notebox.
<Custom Requirement>
// Default the current collected ailment for the user.
user._collectedAilment = user._collectedAilment || 0;
// Make sure the ailment ID is above 0.
value = user._collectedAilment > 0;
</Custom Requirement>

<Before Eval>
// Get the user's current collected ailment.
var stateId = user._collectedAilment;
// Add that ailment to the target.
target.addState(stateId);
// Remove the collected ailment from the user.
user._collectedAilment = 0;
</Before Eval>

Enjoy!