Enemy Thieves Remade (MV Plugin Tips & Tricks)
|
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 PluginsThe 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. AboutThis 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 PluginsThis 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 UsersIf 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. InstructionsFollow video instructions. You can grab the copy/paste code here:
<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! |








