Tips & Tricks – Enemy Thieves Remade – 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.

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!

You can grab the copy/paste code here: 


Place the following code into your Steal Item skill’s notebox. Change the value in red 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
        items.push(item);
      }
    }
    // 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
      SoundManager.playEquip();
      // 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
      user._stealableItems.push(stealableItem);
    }
  // Otherwise
  } else {
    // Make a failed message
    var text = user.name() + ' failed to steal an item!';
    // Play a sound effect
    SoundManager.playBuzzer();
  }
  // Get the wait time
  var wait = 90;
  // Center the text
  text = '<CENTER>' + text;
  // Display the text.
  BattleManager.addText(text, wait);
}
</After Eval>

Enjoy!

Happy RPG Making!


These plugins and Tips & Tricks ideas are made possible thanks to our creative patrons on Patreon! The majority of our Tips & Tricks ideas are placed within the Patreon-exclusive Sample Project for quick and easy access! If you'd like to make a Plugin Suggestion, Yanfly's Patreon-based Suggestion Box a visit here:


If you have any bugs to report, visit the following link:


If you have any questions about Action Sequences, visit the following link:



Thank you!