MV Enemy skills that only target dead actors?

Per the title, I'm wondering if it's possible through some plugin or other to create skills for enemies that only target dead actors.
By default there is no scope involving "dead opponents", so I think this'll need a plugin.

I've moved this thread to JS Plugin Requests. Thank you.

YEP_TargetCore and YEP_X_SelectionControl.

And in skill "note" field put following:
Code:
<Custom Select Condition>
var enemy = target.isActor();
var isDead = target.isDead();
var isEnemy = !target.isFriend();
if ((enemy) && (isDead) && (isEnemy)){
condition = true;}
else
{ condition = false; }
</Custom Select Condition>

not tested, but should work
YEP_TargetCore and YEP_X_SelectionControl.

And in skill "note" field put following:
Code:
<Custom Select Condition>
var enemy = target.isActor();
var isDead = target.isDead();
var isEnemy = !target.isFriend();
if ((enemy) && (isDead) && (isEnemy)){
condition = true;}
else
{ condition = false; }
</Custom Select Condition>

not tested, but should work
First of all, thanks for the reply! I have both plugins active and in the correct order, so I tested this.

Here are my test results:

I applied the listed code as-is to the note section of a skill. I first tested having an enemy use the skill normally, but as expected, this just resulted in them targeting live actors since the skill doesn't seem to discriminate naturally. Using Yanfly's Battle AI Core, I then tried only allowing the enemy to use the skill on targets with the Knockout status. Unfortunately, this resulted in the enemy never acting at all, even with dead actors on the field.

Unless I'm misunderstanding some aspect of how to correctly apply this code to a skill, I don't think this works.
The problem with Soulrender's code (aside from the isEnemy part, which is not a problem, per se, but completely unnecessary as far as I can think) is that selection only kicks in once you have a target list.

That means you have to use target core functionality to get the targets of dead actors before the selection can do anything, as there is no default scope that allows you to target dead enemies.

So you'd need to do:
Code:
<Custom Target Eval>
targets=$gameParty.members().filter(member => member.isDead());
</Custom Target Eval>

And that should eliminate any need for a selection notetag.

If you still have any trouble, this thread that came up when I Googled "Yanfly target dead" might help:
The problem with Soulrender's code (aside from the isEnemy part, which is not a problem, per se, but completely unnecessary as far as I can think) is that selection only kicks in once you have a target list.

That means you have to use target core functionality to get the targets of dead actors before the selection can do anything, as there is no default scope that allows you to target dead enemies.

So you'd need to do:
Code:
<Custom Target Eval>
targets=$gameParty.members().filter(member => member.isDead());
</Custom Target Eval>

And that should eliminate any need for a selection notetag.

This works! Thank you for the help.

Original thread: https://forums.rpgmakerweb.com/threads/enemy-skills-that-only-target-dead-actors.145734/