Resetting rows at the beginning of combat.

I am using Yanfly's Row formation plugin. I am trying to make it so every battle, the entire party starts in row 3. I can use 


SetPartyRow 1 3


SetPartyRow 2 3


etc to set a person to a certain row, using BaseTroopEvents plugin to make it occur during all battles. My problem is that if I use just those two lines, then only the first two party members reset. If I have 


SetPartyRow 3 3


when there are only two people in the party, the game crashes.


Is there some way to have SetPartyRow occur a number of times equal to the number of party members I have? 


Or is there a better way to do this entirely that I'm overlooking?
You can detect the number of party members and set the number to a variable (in this case 15) with this script. Then you can use an if conditional to do row resets. 🙂

 

Code:
$gameVariables.setValue(15, $gameParty.members().length);

Original thread: https://forums.rpgmakerweb.com/threads/resetting-rows-at-the-beginning-of-combat.61979/