MV Problem with untargetable Enemy using Yanfly Selection Control

Hello everyone,

I have a problem with a skill I created and the way the targeting for it works.
Main plugins that probably affect the problem:
Yanfly Battle AI Core
Yanfly Target Core
Yanfly Selection Control

I use a bunch of Yanfly plugins, but the problem only appears if I use the Notetag "Not User" for a skill by Yanfly's Selection Control.
I have an enemy that, if their hp gets low, will kill another enemy and gain some hp back. In order for the enemy to not target itself I had to use the Noteag "Not User".
Skill.PNG


In order for the Skill to only be used when the actors hp are low, I use the following Notetag from Yanfly's Battle AI Core:
<AI Priority>
User HP% param <= 50% +++ Troop Alive Members >= 1: Eat Mouse
</AI Priority>

Now the problem is:
If the Enemy with that skill is the only one left (Either because the other enemies were killed, or if the Enemy was alone from the start) I can no longer use any skills on them. Only skills that target other party members or the user themselves work.
But since the Target Scope of "Not User" is only for the skill, it shouldn't affect the Enemy itself, no?
I tested a couple of fights both in the Battle Test and my game itself, the problem occurs in both cases.

If I remove the skill or take away the Select Condition, it works fine. Though without the Select Condition the Enemy has a chance to use the skill on themselves.. which isn't what I want.

Does anyone have an idea on what I'm missing/doing wrong?

Here's the Plugin List:
Plugin_List.PNG


And here the Selection Control paramters:
Selection_Control.PNG
What on Earth is the point of the Target 0 Random Allies notetag?

Aside from that...your AI condition looks wrong to me. You have it so that the enemy will try to use the skill when the troop has >= 1 alive members...but if there's only 1, it won't have any valid target. It needs at least 2, right? The enemy and someone to use it on.

I bet if you change it to >1, that will sort you. It's locking something up because the enemy was told to do a thing but couldn't find a valid target.
What on Earth is the point of the Target 0 Random Allies notetag?

Aside from that...your AI condition looks wrong to me. You have it so that the enemy will try to use the skill when the troop has >= 1 alive members...but if there's only 1, it won't have any valid target. It needs at least 2, right? The enemy and someone to use it on.

I bet if you change it to >1, that will sort you. It's locking something up because the enemy was told to do a thing but couldn't find a valid target.
Hello,
The code
<Target 0 Random Allies>
was used because I saw another post where someone had troubles without it, so I implemented it without really thinking about it.
I've deleted the line since the Skill itself is already targeting 1 Ally.
New_Moue.PNG


I've also changed the AI to what you suggested:
User HP% param <= 50% +++ Troop Alive Members > 1: Eat Mouse

However, now the Enemy doesn't use the skill at all. Wether it's with one other enemy, or with two or three. I put the AI Level at 100 just to be sure. (Same for Battle Test or in the Game itself)

And the problem with the Enemy with this skill being untargetable is still present.
The interesting thing however:
Party Members that only have Physical Single Target skills can not target the Enemy.
Party Members with a Magic Single Target Skill can target the Enemy BUT only once, and afterwards they have the same isse.
Same with Party Members that have Mutli Target Physical Skills, they can attack once, and then no more.
Any Skill that only targets the User or other Allies still works fine.

Example of a Skill that can never attack the Enemy:
Chop.PNG


Example of Skill that can attack Enemy, but only once:
bonk.PNG


Judgement.PNG



Neither of these three skills have any Notetags in their Notebox.
There's also an error in your Eat Mouse skill's damage formula.

You have it set to restore HP, but instead of providing the value 500 to restore, you've typed a.gainHp(500) which doesn't return any value. Having invalid damage formulae can also cause weird effects in battle.

Please correct that, then show full screenshots of Eat Mouse and the enemy that's using it. When I say full screenshots, I mean don't crop it down to just what you think is useful - let us see the full database screen with all of the IDs and everything involved.
There's also an error in your Eat Mouse skill's damage formula.

You have it set to restore HP, but instead of providing the value 500 to restore, you've typed a.gainHp(500) which doesn't return any value. Having invalid damage formulae can also cause weird effects in battle.

Please correct that, then show full screenshots of Eat Mouse and the enemy that's using it. When I say full screenshots, I mean don't crop it down to just what you think is useful - let us see the full database screen with all of the IDs and everything involved.
Hello,

I tested around a bit more and found something interesting.
First off, I fixed the Skill "Eat Mouse" so the damage formula doesn't get used, for testing purposes.
I'll replace that with a Notetag later on that gives the User a State to regenerate HP or something.
Skill_EatMouse.PNG

It doesn't matter if the Scope of the Skill is, it will always target other enemies.

Now, I tested the following two enemies put together, like how they would appear in the actual game:
Snake.PNG

The AI for the Snake:

User HP% param <= 90% +++ Troop Alive Members > 1: Eat Mouse (Will only eat one Mouse)
Mouse.PNG

Troop.PNG


Now, in the Battle Test the first turn would look like this:
Turn_1_AI.PNG

All Party Members can still select and attack the Snake

Snake turn after taking damage: Use skill "Eat mouse" > targets other enemy and kills them
Second_Turn_AI.PNG

Second_Turn_AI.PNG

Second Turn everything still works fine

Turn_3_AI.PNG

Third turn however, once the Snake is alone, the "Thrust" Attack no longer works. Neither do any other skills that target one enemy.

Example, "Thrust" Skill and "Wide Slice":
Thrust.PNG

Wide_Slice.PNG



Now, the interesting thing is:
If I give the Enemy the skill through the built in "Action Patterns" in the Enemy tab, then the Snake can be targeted again!
However, the snake will also keep using the skill even if no other Enemy is present, which makes sense since it doesn't have the option to only be used if another enemy is alive.
Without_AI.PNG


Turn2_Without_AI.PNG

Attack now works

Emtpy_Attack.PNG

Empty Attack

Another very interesting thing:
If the AI is set to only:
User HP% param <= 90%: Eat Mouse
Then it also works fine, EXCEPT every second turn where skills don't work again..
So the Snake is targetable turn 1 of being alone, then turn 2 no longer, then turn 3 again.. and so on.
In your AI Priority notetag, add a second line that says
Always: Skill 1

Any difference?
In your AI Priority notetag, add a second line that says
Always: Skill 1

Any difference?
Hello,

That worked wonderful!
Now the Snake attacks normally and the Party Members can attack the snake if she's alone.

Thank you very much for your help!

Original thread: https://forums.rpgmakerweb.com/threads/problem-with-untargetable-enemy-using-yanfly-selection-control.160348/