Run plugin command when enemy dies

I'm trying to set it up so that a plugin command runs when an enemy dies.
Its working fine, unless its a single enemy, or the last enemy where there is more than one enemy.

I have it setup as below.

Does anyone know a way to get this work work

Screenshot 2023-07-17 at 22.28.51.png
The most popular workaround for that is to make your enemies resist the KO state and have battle events that remove their KO resist at 0% HP after doing whatever else.

Though obviously that causes issues for instant death skills, so it may be better to give your enemy a far higher HP than the actual HP it has and use a percentage to determine when it's dead.
This lets you have parallel common events running during battle. Maybe you can use it to run a common event once everyone is dead? The plugin file has English instructions
Is the battle against the enemy random or created by events?

This is how I do it with event generated battles.


Screenshot_11.png
Is the battle against the enemy random or created by events?
It’ll be against both
Does Hime's End Phase Triggers not work in MZ? With or without FOSSIL?
Another question.
Will all enemies drop cards at the end of the battle?
Another question.
Will all enemies drop cards at the end of the battle?
All enemies will have a chance at dropping cards, I've just not added the chance bit yet until I got the dropping part working.

I've also noticed another issue, I have the comments setup on two formations. The first is working fine, but the second is also running the commands for the first
You can try putting your plugin command in a common event and then have it trigger on the "X is slain" message with this plugin

Edit: You have to use both plugins I posted and the setup I posted below
You can try putting your plugin command in a common event and then have it trigger on the "X is slain" message with this plugin
How would I identify the monster that’s defeats to ensure the correct card is given? I’m not on my pc to check what commands are available currently
How would I identify the monster that’s defeats to ensure the correct card is given? I’m not on my pc to check what commands are available currently
Hmm, I'm not really well versed on battle scripts but theoretically you could get the last targeted enemy's id, look up that enemy id in the database, and get the value of a notetag, e.g. <cardId: 5> from the notebox. But that is assuming the enemy that just died is the same as the one that was last targeted.

Also I'm not entirely sure running a common event on the battle screen from that text message will work or not, which is why it was a suggestion to try.

Edit: Ok, after testing it myself Eli's Message Actions plugin can't run a common event on the battle scene, but it CAN toggle switches in battle. The Japanese plugin I posted above CAN run common events in battle. So, set up a parallel common event with your plugin command, with a switch EnemyDied, and have Eli's Message actions toggle the switch from the "is slain" message.

The below setup will run a common event every time the "is slain" message is displayed, i.e. an enemy died.
I seem to be having some issues setting it up, I have the message set as "%1 is slain!\CSW[3, true]" but the switch isn't being changed to true. The is slain isn't be shown at all

Edit: That seems to be because of the visustella battle plugin I'm using for enemy hp bars. If I disable that its showing the is slain message, but is showing the [3, true] in the text and still not triggering the switch
Edit: That seems to be because of the visustella battle plugin I'm using for enemy hp bars. If I disable that its showing the is slain message, but is showing the [3, true] in the text and still not triggering the switch
Ok, the MZ version follows a different format. I assumed it was the same as the MV

You need to follow the instructions in the MZ file for how to toggle a switch
\CSw[Id, value]

Also, set up the Japanese plugin with the common events you're using in battle.
Ok, the MZ version follows a different format. I assumed it was the same as the MV

You need to follow the instructions in the MZ file for how to toggle a switch
\CSw[Id, value]

Also, set up the Japanese plugin with the common events you're using in battle.
I've tried both versions, its still the same
Are you sure the switch is not being toggled? How are you monitoring the switch?

Also what happens if you remove the quotation marks from the message?
The quotes aren’t in the actual database.
I’ve tried running the same in a normal event message window and get the same. Then I check using f9 and the switch is still off.

The common event isn’t triggering as I’m getting no text from there either

F12 is showing an error from the plugin, unexpected end of json input.

I can see someone else has reported the same error on the page
F12 is showing an error from the plugin, unexpected end of json input.
That means there's something wrong with what was put inside the plugin parameters, like a missing comma, quotation mark, curly braces, etc
That means there's something wrong with what was put inside the plugin parameters, like a missing comma, quotation mark, curly braces, etc
I’ve not changed the parameters , they are as default
I’ve not changed the parapets, they are as default
Then you may need to set up the settings as I recall that was an issue with another one of his MZ plugins, the settings aren't set up by default.
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

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