[Request] MV_UnstealableEquipment

RK DracoRoy

Fire Emblem RPG Gamer
Veteran
Joined
Jun 29, 2017
Messages
267
Reaction score
81
First Language
English
Primarily Uses
RMMV
Hello there. I wanted to find a way that would make certain equipment unstealable, but with YEP_StealSnatch, no such feature is there. http://yanfly.moe/2016/02/05/yep-66-steal-snatch/

I'm mainly using this "Enemy Thieves" script below that will allow the enemy to steal not just items, but also weaponry, armory, and gold when they use the skill on the player.

Enemy Thieves - Weapons, Armor, Items, Gold
----------------------------------------------------
Code:
<After Eval>
if (user.isEnemy()) {
var successRate = 0.50;
if (Math.random() < successRate) {
var items = [];
var weapons = [];
var armors = [];
var gold = 0;
var kind = Math.randomInt(4);
if (kind === 0) {
var total = $gameParty.items().length;
for (var i = 0; i < total; ++i) {
var item = $gameParty.items()[i];
if (item.itypeId !== 2) {
items.push(item);
}
}
} else if (kind === 1) {
var total = $gameParty.weapons().length;
for (var i = 0; i < total; ++i) {
var weapon = $gameParty.weapons()[i];
var isEquipped = false;
for (var j = 0; j < $gameParty.members().length; j++) {
if ($gameParty.members()[j].isEquipped(weapon)) {
isEquipped = true;
break;
}
}
if (!isEquipped) weapons.push(weapon);
}
} else if (kind === 2) {
var total = $gameParty.armors().length;
for (var i = 0; i < total; ++i) {
var armor = $gameParty.armors()[i];
var isEquipped = false;
for (var j = 0; j < $gameParty.members().length; j++) {
if ($gameParty.members()[j].isEquipped(armor)) {
isEquipped = true;
break;
}
if (!isEquipped) armors.push(armor);
}
}
} else if (kind === 3) {
gold = $gameParty.gold();
}
if (items.length > 0) {
var random = Math.floor(Math.random() * items.length);
var item = items[random];
$gameParty.loseItem(item, 1);
var text = user.name() + ' pilfered ' + item.name + ' from ' + target.name() + '!';
obj = { name: "FE_WeaponBreak", pan: 0, pitch: 120, volume: 100 };
AudioManager.playSe(obj);
var stealableItem = {
type: 'item',
id: item.id,
rate: 0.50,
isStolen: false,
isDrop: false
}
user._stealableItems.push(stealableItem);
} else if (weapons.length > 0) {
var random = Math.floor(Math.random() * weapons.length);
var weapon = weapons[random];
$gameParty.loseItem(weapon, 1);
var text = user.name() + ' pilfered ' + weapon.name + ' from ' + target.name() + '!';
obj = { name: "FE_WeaponBreak", pan: 0, pitch: 120, volume: 100 };
AudioManager.playSe(obj);
var stealableItem = {
type: 'weapon',
id: weapon.id,
rate: 0.50,
isStolen: false,
isDrop: false
}
user._stealableItems.push(stealableItem);
} else if (armors.length > 0) {
var random = Math.floor(Math.random() * armors.length);
var armor = armors[random];
$gameParty.loseItem(armor, 1);
var text = user.name() + ' pilfered ' + armor.name + ' from ' + target.name() + '!';
obj = { name: "FE_WeaponBreak", pan: 0, pitch: 120, volume: 100 };
AudioManager.playSe(obj);
var stealableItem = {
type: 'armor',
id: armor.id,
rate: 0.50,
isStolen: false,
isDrop: false
}
user._stealableItems.push(stealableItem);
} else if (gold > 0) {
var stolengold = Math.min(gold, Math.floor(user.atk * Math.random()));
$gameParty.loseGold(stolengold);
var text = user.name() + ' pilfered ' + stolengold + ' ' + TextManager.currencyUnit + ' from ' + target.name() + '!';
obj = { name: "FE_WeaponBreak", pan: 0, pitch: 120, volume: 100 };
AudioManager.playSe(obj);
var stealableItem = {
type: 'armor',
id: stolengold,
rate: Yanfly.Param.StealGoldRate * 100,
isStolen: false,
isDrop: false
}
user._stealableItems.push(stealableItem);
} else {
var text = user.name() + ' failed to pilfer an item from ' + target.name() + '!';
obj = { name: "FE_Buzzer", pan: 0, pitch: 100, volume: 100 };
AudioManager.playSe(obj);
}
var wait = 60;
text = '<CENTER>' + text;
BattleManager.addText(text, wait);
}
}
</After Eval>
To explain, I have certain special weaponry, armory, and certain items that are essential story-wise, weapons that are solely bound to main characters.

With the enemy thieves skill, the enemy would successfully steal that weapon or armory that wasn't equipped, leaving the protagonist with no hope of getting that special weapon / armor / item back, let alone be able to finish a certain mission, enemy, etc.

The idea to resolve this would be the use of notetags like:
- <Steal Resist> - Actors (Makes the actor resistant against stealing. Can apply to his / her inventory of weapons, armor, gold).
- <Unstealable> - Weapons / Armor / Item (Prevents the weapon, armor, and item in the player's inventory from being stolen).

I would be very grateful if this was manageable, as I would no longer have to worry about the story-essential weapons / armor / items being stolen by enemies.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,051
Messages
1,018,549
Members
137,837
Latest member
Dabi
Top