MV YEP Battle AI Core

This is for MV.

So, I have another question. I'm using Yanfly's Battle AI Core. Works great. I'm attempting to give an enemy (slime) a skill to apply a buff to an ally enemy (non-slime) when their HPs are less than 50%. In addition, I'm using Yanfly's Target Core as well. The problem I'm encountering is that all HP conditions I'm using also pull from the user. So, when the slime's HP falls below 50%... they apply the buff to a healthy ally, which I don't want happening.

Here's what I'm doing...

1)
I have this tag in the skill's Note field from the Target Core: <Target: All Allies But User>
The skill with this tag is the one assigned to the slime (so they don't use it on themself)

2)
I have tried 2 conditions for the Enemy AI. Both still check the user's HP %:

<AI Priority>
HP% param <= 50%: Skill 74
&
User HP% param <= 50%: Skill 74
</AI Priority>

I thought I could just change "user" in the 2nd one to ally, etc. But the plugin only shows the below list as Targets. I guess my question... Is there a way to have it target NON-slime monsters? Or anyone know a way to pull this off? Some of my battles have 2 slimes, and I basically don't want them to ever target each other, or prompt the skill to be used when a slime's HP falls below 50%.

Spoiler: List of Targets
<<nothing>> Selects a random member of the valid target group.
First Selects first member of the valid target group.
User Selects the user itself.
Highest MaxHP Selects highest MaxHP valid target.
Highest HP Selects highest HP valid target.
Highest HP% Selects highest HP% valid target. *Note1
Highest MaxMP Selects highest MaxMP valid target.
Highest MP Selects highest MP valid target.
Highest MP% Selects highest MP% valid target. *Note1
Highest MaxTP Selects highest MaxTP valid target.
Highest TP Selects highest TP valid target.
Highest TP% Selects highest TP% valid target. *Note1
Highest ATK Selects highest ATK valid target.
Highest DEF Selects highest DEF valid target.
Highest MAT Selects highest MAT valid target.
Highest MDF Selects highest MDF valid target.
Highest AGI Selects highest AGI valid target.
Highest LUK Selects highest LUK valid target.
Highest Level Selects highest Level valid target. *Note2
Lowest MaxHP Selects lowest MaxHP valid target.
Lowest HP Selects lowest HP valid target.
Lowest HP% Selects lowest HP% valid target. *Note1
Lowest MaxMP Selects lowest MaxMP valid target.
Lowest MP Selects lowest MP valid target.
Lowest MP% Selects lowest MP% valid target. *Note1
Lowest MaxTP Selects lowest MaxMP valid target.
Lowest TP Selects lowest MP valid target.
Lowest TP% Selects lowest MP% valid target. *Note1
Lowest ATK Selects lowest ATK valid target.
Lowest DEF Selects lowest DEF valid target.
Lowest MAT Selects lowest MAT valid target.
Lowest MDF Selects lowest MDF valid target.
Lowest AGI Selects lowest AGI valid target.
Lowest LUK Selects lowest LUK valid target.
Lowest Level Selects lowest Level valid target. *Note2

So, I want something that will check if any enemy (except the slime/user) is below 50%. The target core takes care of the slime not using the skill on itself.
Code:
eval $gameTroop.aliveMembers().filter(enemy => enemy.enemyId()!=X && enemy.hpRate()<=.5) : Skill 74
where X is the ID of the slime.
Code:
eval $gameTroop.aliveMembers().filter(enemy => enemy.enemyId()!=X && enemy.hpRate()<=.5) : Skill 74
where X is the ID of the slime.
Thanks for getting back to me. It appears to be targeting any enemy still at random. Plus, it's doing this the first turn, when the enemy's HP would still be above 50%.

This is how I have the Battle AI set up within the enemy's note field. My slime enemy ID is 5:

Spoiler: AI Priority
<AI Priority>
Spoiler: AI Priority
eval $gameTroop.aliveMembers().filter(enemy => enemy.enemyId()!=5 && enemy.hpRate()<=.5) : Skill 74
Always: Skill 41
Always: Skill 59
</AI Priority>


And here's a screenshot of the skill I'm using to apply that state:

Spoiler: Screenshot
1673070766782.png

Video Example
In the video... it shows the slimes only using it on each other, but I've done multiple tests, and they have randomly done it to the Grunt, as well. Just an FYI.

ALSO... is there a way to script in to check for a state? Like... when the Grunt has the state applied to them, the other slime won't use that skill? That way both slimes don't perform the same skill on that enemy on the same turn.

Thanks again and let me know if you need anything else. Screenshots, etc.
Hm. Sorry, I'm not sure. I tested the line of code and it works as expected, so it should be making the condition return false.

ALSO... is there a way to script in to check for a state? Like... when the Grunt has the state applied to them, the other slime won't use that skill? That way both slimes don't perform the same skill on that enemy on the same turn.
This depends on your battle system. By default, the actions are all chosen at the beginning of the turn, so both slimes would be choosing to do the action while the target doesn't have the state...so looking for the state wouldn't help.

If you're using a different battle system with non-simultaneous actions, then yes, you can add that condition in.
Hm. Sorry, I'm not sure. I tested the line of code and it works as expected, so it should be making the condition return false.


This depends on your battle system. By default, the actions are all chosen at the beginning of the turn, so both slimes would be choosing to do the action while the target doesn't have the state...so looking for the state wouldn't help.

If you're using a different battle system with non-simultaneous actions, then yes, you can add that condition in.
No problem. I'll keep messing around with it. I'm sure I'll figure it out... even if it's me just stumbling on it LOL That tends to happen a lot for me sometimes haha

Original thread: https://forums.rpgmakerweb.com/threads/yep-battle-ai-core.153840/