MV Yanfly Battle AI Core Script help

Hi All,

I think this might be a simple one. But I am looking for a condition to check for a specific skill. I have a skill that needs 2 or more of the same enemy to activate and I got that working with "Troop Alive Members > 1", but the issue I run into is if one enemy of that kind is alive with a different enemy it will still try and do that skill. What I need to check for is if more than 1 of the same enemy ID is alive.

Does anyone know if that is possible with an Eval, and if so, what would be the eval?
I was thinking something along the likes of:
alive enemyId(XX) > 1 : Skill XX, Highest HP%

But, you know, actually correct.

As always, any help is greatly appreciated.
I would try something along those lines in the EVAL (sorry, I am not at home, so I can't actually test it):
let result=false; $gameTroop.aliveMembers().forEach(m => {if (user != m && user.enemyId() == m.enemyId()) result = true;}); result;
Just to offer a slightly shorter option (not any better, as far as I know!):
Code:
$gameTroop.aliveMembers().filter(member => member.enemyId()==user.enemyId()).length>1

Both of these solutions are presuming that the enemy you want two of is the enemy using the skill. If that's not the case (the boss needs two henchmen to use a thing), then replace user.enemyId() with the ID of the desired enemy.
Thank you to both of you! That got me to what I was looking for!

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-battle-ai-core-script-help.150309/