MZ Melee Skills limited to the first alive row (Row Formation/Target Core/Selection Control)

So I am currently making a project using FOSSIL, Yanfly's Row Formation and assorted targeting and selection plugin. One of my characters has a ranged weapon with a bayonet, therefore he also has a melee skill. I'd like him to be able to use that melee skill only if he is currently in the front row, regardless of the actual row number (eg. he is currently in the fifth row but there is no alive ally in the preceding rows)

I have tried quite a few things but none seem to work as intended, so any help is appreciated.
bump

Original thread: https://forums.rpgmakerweb.com/threads/melee-skills-limited-to-the-first-alive-row-row-formation-target-core-selection-control.138126/