Difference between revisions of "Poach (MV Plugin Tips & Tricks)"

From Yanfly.moe Wiki
Jump to navigation Jump to search
(Created page with "{{Yanfly Tips & Tricks MV |preview = <youtube>https://www.youtube.com/watch?v=9A3BFGVoN6M</youtube> |desc = In Final Fantasy Tactics, Thieves can gain the ability: Secret Hu...")
 
 
Line 13: Line 13:
 
Get the copy/paste code here:  
 
Get the copy/paste code here:  
  
Place this code inside of your Poach skill’s notebox. Change the values in red to fit your game’s settings.
+
Place this code inside of your Poach skill’s notebox. Change the values to fit your game’s settings.
  
 
<pre>
 
<pre>

Latest revision as of 20:26, 9 July 2019

Welcome to the wiki! This is where you can find resources from Yanfly.moe, Ækashics.moe,
VisuStella, Caz Wolf, Fallen Angel Olivia, Atelier Irina, and other affiliated content creators.


In Final Fantasy Tactics, Thieves can gain the ability: Secret Hunt, which effectively lets them Poach enemies. Poached enemies, when killed by a character with Secret Hunt, will give extra item(s) to the player. Here’s how you can create this effect for RPG Maker MV!

Required Plugins

The 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.

About

This 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 Plugins

This 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 Users

Warning.jpg

If 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.

Instructions

Follow video instructions.

Get the copy/paste code here:

Place this code inside of your Poach skill’s notebox. Change the values to fit your game’s settings.

<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>

Happy poaching!