Run plugin command when enemy dies

Turns out that although the plugin pages doesn't state anything, you need an additional plugin to use it.
I've also added HIME's formula effect which allows me to set the enemies ID to a variable when using an attack/skill
If you're able to do that you should be able to use in your plugin command
Plugin Command: tripleTriad, Add Card
cardId = [$dataEnemies[$gameVariables.value(16)].meta.cardId]

Replace 16 with the variable you're storing the enemy ID in

Then in the enemy database in the enemy's notebox
<cardId: 5>


The only issue is this is all assuming that the enemy that died was the target of your skill, and I don't know what would happen if you targeted or killed multiple enemies at once.
Thanks, while I wasn't able to use it directly in the plugin command, I was able to script it instead
The only issue is this is all assuming that the enemy that died was the target of your skill, and I don't know what would happen if you targeted or killed multiple enemies at once.

Its not going to be a guaranteed chance of getting the card, so this isn't too much of an issue


How would I get the name for the enemy so I can use it in the gained message

Edit:

Never mind, got the name using
enemy = $dataEnemies[$gameVariables.value(5)]
enemyName = enemy.battlerName
$gameMessage.add(enemyName + " card gained")

Original thread: https://forums.rpgmakerweb.com/threads/run-plugin-command-when-enemy-dies.159428/