MV Row Formation: Passive that affects allies only in the same row as the user

Hi! I'm trying to create a paladin passive aura skill that increases the defense of allies in the same row as the paladin. I'm using Yanfly Row Formation and Passive Auras/States. I'm working with 3 rows (melee, mid and rear) and I would like wherever I place the paladin it increases the DEF of those on the same row and only that row.

Example: Paladin in row 3, archers and mages get defense boost, paladin changes to row 1: archers loses and melee warriors get it.

I'm trying to code something with <Custom Aura Condition> but I don't know how to write the function "in the same row as the user".
In the state delivered by the aura, give it:
Code:
<Custom Aura Condition>
var originUser;

for (var i=0; i<$gameParty.aliveMembers().length; i++)
{
    if ($gameParty.aliveMembers()[i].isStateAffected(X))
    {
        originUser=$gameParty.aliveMembers()[i];
        break;
    }
}

condition=originUser && originUser.row()==user.row();
</Custom Aura Condition>

where X is the ID of your aura state.
In the state delivered by the aura, give it:
Code:
<Custom Aura Condition>
var originUser;

for (var i=0; i<$gameParty.aliveMembers().length; i++)
{
    if ($gameParty.aliveMembers()[i].isStateAffected(X))
    {
        originUser=$gameParty.aliveMembers()[i];
        break;
    }
}

condition=originUser && originUser.row()==user.row();
</Custom Aura Condition>

where X is the ID of your aura state.
Thank you so much sir, it worked perfectly! Now the paladin is complete

Original thread: https://forums.rpgmakerweb.com/threads/row-formation-passive-that-affects-allies-only-in-the-same-row-as-the-user.145648/