Enemy Thieves Remade (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.

Previously when we made enemy thieves, we made it where the enemies are capable of stealing items from the player party. This time, if the items got stolen, the player is now able to steal them back! Here’s how to create the effect!

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.


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.


Follow video instructions.

You can grab the copy/paste code here:

Place the following code into your Steal Item skill’s notebox. Change the value to reflect the settings to match your game.
<After Eval>
// Check if the user is an enemy
if (user.isEnemy()) {
  // Calculate the success rate
  var successRate = 0.50;
  // Check if the success rate passes
  if (Math.random() < successRate) {
    // Make an empty item pool
    var items = [];
    // Get the party's item total
    var total = $gameParty.items().length;
    // Loop through each item
    for (var i = 0; i < total; ++i) {
      // Get the currently looped item
      var item = $gameParty.items()[i];
      // Check if the item type ID isn't a key item
      if (item.itypeId !== 2) {
        // Add the item to the pool
    // Check if the item pool is larger than 0
    if (items.length > 0) {
      // Get a random index
      var random = Math.floor(Math.random() * items.length);
      // Get a random item
      var item = items[random];
      // The party loses 1 of that item
      $gameParty.loseItem(item, 1);
      // Make the text stolen for the item
      var text = user.name() + ' stole ' + item.name + ' from the party!';
      // Play a sound effect
      // Create the stolen item with a 50% rate to steal it back
      var stealableItem = {
        type: 'item',
        id: item.id,
        rate: 0.50,
        isStolen: false,
        isDrop: false
      //  Add the stealable item to the enemy's pool
  // Otherwise
  } else {
    // Make a failed message
    var text = user.name() + ' failed to steal an item!';
    // Play a sound effect
  // Get the wait time
  var wait = 90;
  // Center the text
  text = '<CENTER>' + text;
  // Display the text.
  BattleManager.addText(text, wait);
</After Eval>