Battle AI Buff extension not selecting valid Targets

Trying to get buff extension to yanfly battle ai core working but there is an issue when selecting valid targets.
The 'highest' and 'lowest' keywords do not work as it always returns a -1 for selecting valid targets making it use the skill on a random target.
Ex.
Buff ===1 Buff 3: Skill 1, Highest HP
This will target all actors with a +1 buff to def, not the actor with the highest HP.
However if I use the first keyword it will always target the first target in the list.
Buff ===1 Buff 3: Skill 1, first

Any thoughts on how to trouble shoot this?
This will target all actors with a +1 buff to def, not the actor with the highest HP.
That sounds like an error in the scope of your skill. If it's set to One Ally/Enemy, it should be impossible for it to be triggering on all applicable actors.

Conversely, if your scope is something like All Enemies, then yes, using the AI core can't change that to only apply it against one target.

Or do you actually mean it appears to select a random target instead of the one with highest HP?

Any thoughts on how to trouble shoot this?
Disable that buffs extension and use a different criteria. That will tell you whether there's some error with the "Highest HP" targeting or if it's a conflict with the buff extension.
Thanks for the response.
It's selecting a random target instead of the one with the highest hp, but only the one's that meet the buff criteria of +1.
Also it seems that turning off the extension and changing the criteria has the targeting working correctly.
I guess I can turn off that extension and use eval for related buffs.
What would be the syntax for checking certain buffs between troops and the player party in this situation?
Something along the lines of

<AI Priority>
Eval user._buffs[3] >= 0: Skill 21, Highest HP
</AI Priority>

Update the above code worked.

Original thread: https://forums.rpgmakerweb.com/threads/battle-ai-buff-extension-not-selecting-valid-targets.155141/