Death Injuries (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 Dragon Age, upon dying, characters don’t simply become unable to act. They also acquire injuries that persist even after they’ve been revived. These injuries will stick around until treated. Here’s how you can create such an 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.

Be sure to place this into the noteboxes of your injuries
<Category: Bypass Death Removal>
Place this code into your Death state’s notebox. Change the values to reflect your game.
<Custom Apply Effect>
// Create the pool of possible injuries.
var possibleInjuries = [];
// Add the injury state ID's into the pool.
possibleInjuries.push(89, 90, 91, 92);
possibleInjuries.push(93, 94, 95, 96);
possibleInjuries.push(97, 98, 99, 100);
possibleInjuries.push(101, 102, 103, 104);
// Loop through each of the possible pools and randomize the pool.
for (var i = 0; i < possibleInjuries.length; ++i) {
  var j = Math.floor(Math.random() * (i + 1));
  var temp = possibleInjuries[i];
  possibleInjuries[i] = possibleInjuries[j];
  possibleInjuries[j] = temp;
}
// This is the number of injuries received each time a battler dies.
var received = 2;
// Create a loop until the number received is 0.
while (received) {
  // Check if there are still injuries left in the pool.
  if (possibleInjuries.length > 0) {
    // If there are, get an injury in the randomized pool.
    var stateId = possibleInjuries.shift();
    // If the target is not affected by the injury...
    if (!target.isStateAffected(stateId)) {
      // Then add the injury to the target.
      target.addState(stateId);
      // Reduce the number of received injuries by 1.
      received -= 1;
    }
  // If there are no injuries left...
  } else {
    // Then break the loop.
    break;
  }
}
</Custom Apply Effect>

Happy treating!