Creating a skill that conditionally strikes again

I'm trying to make a skill that, if it kills an enemy, is used again free of charge. I'm using the yanfly engine plugin Skill Core which gives me an eval that triggers after the skill has completed. This seemed like a good place to start, so I looked up the script equivalent of the force action event and put that in there. What ends up happening is strange:

Why does it not kill the first enemy it hits (instead killing the second enemy)?

Why does it keep going after all enemies are dead?

And most importantly: is there a better way to accomplish this effect?

Here's the skill settings.

2HvrN5w.png
Sorry for the double post, but I figured out what was going wrong and wanted to answer my topic in case someone stumbles upon this problem in the future.

Here is the correct way to create this skill:

Using Yanfly's SkillCore plugin, create the After Eval notetag with the following code:

if(target.hp <= 0 && !$gameTroop.isAllDead()) { $gameVariables.setValue(x, y);} Above, the x is the ID of the variable you want to save to and y is the actor you want to do the attack. Then you need to call a common event in the effects area of the skill editor. The common event should check the variable you set above in the After Eval notetag (represented above as 'x') and then force the skill.

Original thread: https://forums.rpgmakerweb.com/threads/creating-a-skill-that-conditionally-strikes-again.51745/