Yanfly Mid Range Weapon

I'm trying to create a mid range weapon but I'm having difficulty figuring out how to do it. I'm using the Row formation script and have 2 rows. A mid range weapon should be able to attack 2 rows away. For Example, if the user is in the front row, they can attack the enemy front and back row but if the user is in the back row, they can only attack the enemy front row.

Melee weapons working on front row only while in the front row work and so do ranged weapons from any row targeting any row but I'm not sure how to make an in-between.

I tried this but it didn't give me the desired results:

<Custom Target Eval>

if (battler.row() = 1) {Any Row}

else {Front Row Only;}

</Custom Target Eval>

I also tried vartiations of what another user tried but have not had luck with that either:

https://forums.rpgmakerweb.com/inde...control-and-row-formations.89273/#post-813904

I'm willing to pay someone for help at this point. I tried asking Yanfly on his Patreon but it seems he doesn't answer direct questions.

Row/Formation Plugin:
http://yanfly.moe/2016/01/02/yep-54-row-formation/

Target Core:
http://yanfly.moe/2016/02/26/yep-74-target-core/

Plugin that lets you decide a skill's range:
http://yanfly.moe/2016/04/22/yep-94-selection-control/

Plugin that lets you assign different skills to weapons
http://yanfly.moe/2015/12/26/yep-51-weapon-unleash/
bump
Bump
Bump
I think the rows are organized like this -
(your side) 3 - 2 - 1 --- 1 - 2 - 3 (enemy side)

So between you and your target is a mathematically constant amount of rows equalling to (my row) + (their row) - 1
So if you're at row 3 in the back and they're at row 2 in the middle, the distance between you is (3) + (2) - 1 = 4

So using this mathematical formula, you can write a condition on the skill notetag.
Code:
<Custom Select Condition>
var distance = user.row() + target.row() - 1;
condition = distance <= 2;
// target is selectable if distance is 2 or less
</Custom Select Condition>
Oh my god. Thank you so much. That works!

I'm actually only using two rows for each side but that tag still works perfectly fine since the distance between the player back row and the enemy back row is still greater than 2.

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-mid-range-weapon.94339/