Collect & Inject Ailments (MV Plugin Tips & Tricks)

From Yanfly.moe Wiki
Revision as of 14:52, 9 July 2019 by Yanfly (talk | contribs) (Created page with "{{Yanfly Tips & Tricks MV |preview = <youtube>https://www.youtube.com/watch?v=ybbZFDOcvic</youtube> |desc = Today’s Tips & Tricks is rather interesting. It is split betwee...")
(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.


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.

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 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!