MV Help with yanfly's Row Formation

Hello, I'd like some help regarding Yanfly's Row Formation plugin.

I am trying to make a battle system that has only 2 rows that can fit 4 units each. That's pretty much it. Although I am having problems to how to make row ONLY fit 4.

I also have a question regarding on how to execute this: For example, both of the first and second row is full. If a targeted unit from the first row is forced to change rows by a skill, I want it so that it will randomly pick a unit from the second row to replace the targeted unit. vice versa. My plan is to use script call .rowSize(x) and the plugin command SetPartyRow/SetEnemyRow but I have no idea how to do it. Thanks.
I am having problems to how to make row ONLY fit 4.
The plugin does not support this by default.

Without learning/commissioning someone to code you a plugin extension, I can only think of two things:
1 - you predefine which row each actor is and lock them there, but that would make you unable to force the changing rows by skills, either.

2 - you leave it unlocked and at the beginning of the battle check whether either row has more than 4 actors and push extras into the other row. I think this would look crummy from a user interface perspective.

If a targeted unit from the first row is forced to change rows by a skill, I want it so that it will randomly pick a unit from the second row to replace the targeted unit.
Code:
<Custom Target Row>
let tarRow = target.row();
let swapRow = tarRow == 1 ? 2 : 1;

target.friendsUnit().rowAliveMembers(swapRow)[Math.randomInt(target.friendsUnit().rowAliveMembers)].setRow(tarRow);
target.setRow(swapRow);
</Custom Target Row>

That, in the notetag of a skill, will cause the target to swap rows with a random living member.

If you only want to do that if the number of actors in that row would be > 4, that's simple to add, but I'll wait until you decide whether you're rethinking the 4-person limit.
2 - you leave it unlocked and at the beginning of the battle check whether either row has more than 4 actors and push extras into the other row. I think this would look crummy from a user interface perspective.
Thank you! But yeah, that would be awful... I was thinking that I could just remove the row formation menu and instead have an event that changes their default values to make it so like I could pick the first four actors picked to go in the front or to have the main actor and its followers be the front row. Then the rest would be at the back row since I don't really plan into being able to recruit more than 8 actors. Although again I'm not sure how to do but if you do have other opinions that comes to mind, please do tell me!
That, in the notetag of a skill, will cause the target to swap rows with a random living member.
Again, thank you so much! It's perfect! Although I want to ask how can I make it so that if the target row is less than 4, it will just be pushed/pulled into that row rather than exchanging places. Should I just put an "if tarRow < 4: <Push Back/Pull Forward Target row:1>" statement in the first line? I'm quite new to this so I'm just taking a shot in the dark hahaha. Again, thank you very much.
I was thinking that I could just remove the row formation menu and instead have an event that changes their default values...I'm not sure how to do
If you're not allowing access to the Formation menu, then you can just use the included notetags to set the actors' default rows.

Then, in case they get moved around during combat, you'd put a parallel event on every map that has encounters which uses the script calls to reset their positions then does Erase Event.

how can I make it so that if the target row is less than 4, it will just be pushed/pulled into that row rather than exchanging places.
Code:
<Custom Target Row>
let tarRow = target.row();
let swapRow = tarRow == 1 ? 2 : 1;

if (target.friendsUnit().rowAliveMembers(swapRow).length == 4)
    target.friendsUnit().rowAliveMembers(swapRow)[Math.randomInt(target.friendsUnit().rowAliveMembers(swapRow).length].setRow(tarRow);
target.setRow(swapRow);
</Custom Target Row>
Hello @ATT_Turan , I've tried the notetags you've provided but it did not work for me.
There was a typo in my code, I've fixed it. Re-paste it in.

Original thread: https://forums.rpgmakerweb.com/threads/help-with-yanflys-row-formation.166052/