I'm using Yanfly's Poach skill and I want the only thing poachable to be items, not equipment. Can someone explain to me how to set this up so I don't make any mistakes in the code, please? I'm sure it's simple but I'm scared of messing something up. Really what's tripping me is what to replace and what enemy ID means and affects this note.
Any help is greatly appreciated!!
<After Eval>
// Check if the user is an actor, target is an enemy, and the target has been slain.
if (user.isActor() && target.isEnemy() && (target.isDead() || target.hp <= 0)) {
// Get the ID of the target.
var id = target.enemyId();
// Create an empty pool for the list of possible items.
var pool = [];
// Add items to the global pool.
pool.push($dataItems[1]);
pool.push($dataItems[2]);
pool.push($dataItems[3]);
// If the enemy ID is 1...
if (id === 1) {
// ...then add unique items to the possible pool.
pool.push($dataWeapons[1]);
// If the enemy ID is 2...
} else if (id === 2) {
// ...then add unique items to the possible pool.
pool.push($dataWeapons[2]);
pool.push($dataWeapons[3]);
// If the enemy ID is 3...
} else if (id === 3) {
// ...then add unique items to the possible pool.
pool.push($dataArmors[1]);
pool.push($dataArmors[2]);
pool.push($dataArmors[3]);
}
// Get a random item from the pool.
var item = pool[Math.floor(Math.random() * pool.length)];
// Make sure the item is valid.
if (item) {
// Play an animation on the target.
target.startAnimation(2);
// Remove the target's immortality.
target.removeImmortal();
// Play a sound effect.
SoundManager.playShop();
// Make the player party gain the said item.
$gameParty.gainItem(item, 1);
// Create a message indicating the item has been poached.
var msg = '<CENTER>' + user.name() + ' acquired \\i[' + item.iconIndex + ']' + item.name + ' from ' + target.name() + '!';
// Set the wait frames to 60.
var wait = 60;
// Make the BattleManager display the text.
BattleManager.addText(msg, wait);
}
}
</After Eval>
Any help is greatly appreciated!!
<After Eval>
// Check if the user is an actor, target is an enemy, and the target has been slain.
if (user.isActor() && target.isEnemy() && (target.isDead() || target.hp <= 0)) {
// Get the ID of the target.
var id = target.enemyId();
// Create an empty pool for the list of possible items.
var pool = [];
// Add items to the global pool.
pool.push($dataItems[1]);
pool.push($dataItems[2]);
pool.push($dataItems[3]);
// If the enemy ID is 1...
if (id === 1) {
// ...then add unique items to the possible pool.
pool.push($dataWeapons[1]);
// If the enemy ID is 2...
} else if (id === 2) {
// ...then add unique items to the possible pool.
pool.push($dataWeapons[2]);
pool.push($dataWeapons[3]);
// If the enemy ID is 3...
} else if (id === 3) {
// ...then add unique items to the possible pool.
pool.push($dataArmors[1]);
pool.push($dataArmors[2]);
pool.push($dataArmors[3]);
}
// Get a random item from the pool.
var item = pool[Math.floor(Math.random() * pool.length)];
// Make sure the item is valid.
if (item) {
// Play an animation on the target.
target.startAnimation(2);
// Remove the target's immortality.
target.removeImmortal();
// Play a sound effect.
SoundManager.playShop();
// Make the player party gain the said item.
$gameParty.gainItem(item, 1);
// Create a message indicating the item has been poached.
var msg = '<CENTER>' + user.name() + ' acquired \\i[' + item.iconIndex + ']' + item.name + ' from ' + target.name() + '!';
// Set the wait frames to 60.
var wait = 60;
// Make the BattleManager display the text.
BattleManager.addText(msg, wait);
}
}
</After Eval>