Is it possible to implement Guard Actor with lowest HP skill?

Hello everyone,
I wonder if it is possible to have the following effect added to an equipment.

If the item is equipped the actor will become some sort of 'tank' to the player with the lowest HP during a battle.
So whenever the the actor with the lowest HP in battle is attacked, the actor that has that item equipped will take the
damage instead.
(How) could this feature implemented in a game?
I've never used it, but have you tried the "Substitute" Trait (in Other -> Special Flag) ? The description says it does exactly that.

EDIT : after a closer look at the code, Substitute actually works only if the target HP are less than 1/4 (dying) and the attack isn't a Certain Hit.
If you're ok with that, it works fine.
I've bashed together a quick plugin that will overwrite the Substitute Traits checks making it check for the ally with the lowest hp to protect instead. You can download it here.

Use it commercially, non-commercially, edit it, do what you like with it.

Original thread: https://forums.rpgmakerweb.com/threads/is-it-possible-to-implement-guard-actor-with-lowest-hp-skill.106253/