Custom code in multi-target skills

So I'm the process of making the various spells and skills I want, and I intend for many of them to have apply a set of effects to the enemies and a different set of effects to allies. For example, one skill damages an enemy and heals the most injured ally. Works like a charm.

However!

Things go completely pear shaped when I try to do this with multi-target abilities because the effects fire off once per target. Example:

unknown.png


This skill is supposed to deal water damage enemies, apply the "wet" ailment to them, and heal the party for a small amount. For the most part, it works, however as you can see, the healing portion (my custom code) fires off 4 times in this case--once per target.

So I guess my question is this: How can I force a skill to execute my custom code only once per use instead of once per target?
not possible with the damage formula

theoretically you might be able to do this by using a switch and conditional checks inside the damage formula (is switch on? if no apply effect and turn switch on), but that is complex and needs a way to turn off the skill switch after the skill is complete (which is another problem in itself and prevents double use of the same skill on the same battle turn by different actors).

so the best option is to look for a plugin that allows you to execute code per skill use instead of per target.
Bummer, that's what I was afraid of. I couldn't get it to work with either the damage formula (actually didn't even try because I already figured that gets executed once per target) or any of the yanfly skill core eval options. Probably easiest to just write my own plugin for it.

Thanks for taking the time to confirm my fears. 😀
Bump.

Doing a follow-up to this because I found a way to pull it off without needing to make my own plugin. Yanfly's Action Sequence packs allow for javascript-based if statements, which is of course useful for creating conditional action sequences, but you can also use the system to inject a function call to your own code:

Code:
<follow action>
if (function(user){ yourFunctionHere.call(this, user); return true; }).call(this, user)
</follow action>

Since "follow action" only seems to be executed once, the custom code will only be executed once. Hurray!

Victory screenshot:

OX0XMTL.png


(I of course dealt with the lack of rounding in the previous shot, too)

Original thread: https://forums.rpgmakerweb.com/threads/custom-code-in-multi-target-skills.96219/