Tips & Tricks – Collect & Inject Ailments – RPG Maker MV

Yanfly Engine Plugins is a plugin library made for RPG Maker MV, a wonderful piece of software to help you make that role playing game of your dreams. You can find out more about RPG Maker MV here.

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!

You can grab the copy/paste code here: Insert the following Lunatic Mode code into your Collect Ailment skill’s notebox. Change the values in red 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!

Please wait while you are redirected...or Click Here if you do not want to wait.