MV Help with Yanfly Poach please.

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>
If you only want items, then you only add those $dataItems[X], not $dataWeapons[X] or $dataArmors[X]

Enemy Id comes from your database enemy section. If you don't want all enemies to be able to give something, remove the lines where it talks about a 'global pool'. Then just continue copy/pasting those else if segments for all the enemy ids you want.
If you only want items, then you only add those $dataItems[X], not $dataWeapons[X] or $dataArmors[X]

Enemy Id comes from your database enemy section. If you don't want all enemies to be able to give something, remove the lines where it talks about a 'global pool'. Then just continue copy/pasting those else if segments for all the enemy ids you want.
Thank you!! I believe that answers my question.

Okay, just to be sure I have this correct, if I want 200 enemies poachable, as an example, I have to make 200 lines of code with each individual ID? Want to have all the info I need before I have this closed.
Okay, just to be sure I have this correct, if I want 200 enemies poachable, as an example, I have to make 200 lines of code with each individual ID
yep.
it can be adjusted to look at notetags on the enemy instead and imo would be better that way, but if you have a small number of poachable enemies, putting all of it into the skill will do
yep.
it can be adjusted to look at notetags on the enemy instead and imo would be better that way, but if you have a small number of poachable enemies, putting all of it into the skill will do
Sorry to have to ask this then, but how would I adjust it to look at notetags? Cause that does sound easier and less of a chore to check.
Sorry to have to ask this then, but how would I adjust it to look at notetags?
so heres an adjusted version. for any enemy that has poachable stuff, youll give them notetags and youll just put the ids of the item inside the notetags.
<PoachItems:[x,y,z]>
<PoachWeapons:[x,y,z]>
<PoachArmors:[x,y,z]>

so if you want an enemy to be able to leave behind item 4, item 18, or weapon 13, youd give the enemy the notetags
<PoachItems:[4,18]>
<PoachWeapons:[13]>

Spoiler
Code:
<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)) {
    // 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]);
    //  get the target enemy's database entry
    var enemy = target.enemy();
    // add enemy's notetag information to the pool
    if (enemy.meta.PoachItems)
        JSON.parse(enemy.meta.PoachItems).forEach(item=> pool.push($dataItems[item]))
    if (enemy.meta.PoachWeapons)
        JSON.parse(enemy.meta.PoachWeapons).forEach(weapon=> pool.push($dataWeapons[weapon]))
    if (enemy.meta.PoachArmors)
        JSON.parse(enemy.meta.PoachArmors).forEach(armor=> pool.push($dataArmors[armor]))
    // 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>
so heres an adjusted version. for any enemy that has poachable stuff, youll give them notetags and youll just put the ids of the item inside the notetags.
<PoachItems:[x,y,z]>
<PoachWeapons:[x,y,z]>
<PoachArmors:[x,y,z]>

so if you want an enemy to be able to leave behind item 4, item 18, or weapon 13, youd give the enemy the notetags
<PoachItems:[4,18]>
<PoachWeapons:[13]>

Spoiler
Code:
<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)) {
    // 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]);
    //  get the target enemy's database entry
    var enemy = target.enemy();
    // add enemy's notetag information to the pool
    if (enemy.meta.PoachItems)
        JSON.parse(enemy.meta.PoachItems).forEach(item=> pool.push($dataItems[item]))
    if (enemy.meta.PoachWeapons)
        JSON.parse(enemy.meta.PoachWeapons).forEach(weapon=> pool.push($dataWeapons[weapon]))
    if (enemy.meta.PoachArmors)
        JSON.parse(enemy.meta.PoachArmors).forEach(armor=> pool.push($dataArmors[armor]))
    // 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>
Oh my god! You are a literal life saver!! Thank you so freakin' much!!!

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/help-with-yanfly-poach-please.175505/