Spell that can only be cast on low health enemies

I'm trying to make a spell that can only be cast on enemies with low health, say, less than 10%, but I have no idea how to do it. None of the tutorials or threads I have looked at have been able to help, and I am not using any plugins.
You'll need a targeting plugin. Visustella MZ Battle Core will do it.
Then put something like this in the Note of the skill.
Code:
<JS Targets>
targets = user.opponentsUnit().aliveMembers().filter(member => member.hpRate() < 0.10);
</JS Targets>
Then put something like this in the Note of the skill.
Code:
<JS Targets>
targets = user.opponentsUnit().aliveMembers().filter(member => member.hpRate() < 0.10);
</JS Targets>
so, if I install Visustella MZ Battle Core and put this code into the note of the skill, the skill in question will only target enemies that have less than 10% of their health left?
Right?
It's worth trying, since VisuStella's core plugins are all free! However...I might be wrong, but based on what I've heard I think that notetag determines the targets that the skill/item hits when used, rather than the targets eligible for selection?

If it doesn't do what you want, I have a plugin named Cae_OnUseEffects, found here:
It offers a <target filter: SCRIPT> notetag for skills/items. E.g. to limit a skill so it can only be aimed at targets with less than 10% HP, you could put this in the skill's Note box:

<target filter: return target.hp < target.mhp / 10;>
Small problem, Visustella MZ Battle Core doesn't seem to work alongside the SRPG plugin. I keep getting error messages
Yet to try Cae_OnUseEffects as of yet, so I'll give that one a go
I am not using any plugins.
Small problem, Visustella MZ Battle Core doesn't seem to work alongside the SRPG plugin.
A complete battle system overhaul like SRPG will probably be incompatible with most standard battle plugins. You'll likely need something specific to that system instead.
Yea that's a key piece of info lol I have no idea with that plug in.

Original thread: https://forums.rpgmakerweb.com/threads/spell-that-can-only-be-cast-on-low-health-enemies.179611/