Actors rows

I'm fully prepared to get laughed at for this as it seems really simple, but i just can't figure out how to do it nor can i find a guide.

Basicly i have a game with 8 actors and instead of 1 large row i want to place them in 2 smaller rows of 4 one in the front and one in the back, I'm using visustella battle core which seems to have a built in way to do this, but again. Can't figure it out. Thank's for listening, you may laugh at me now.
It's not super simple, because you have to know some JavaScript expressions to pull this off.

I don't know whether you want those all in order - e.g. 1-4 in front then 5-8 in back, or if you want them alternating with 1, 2 behind, then 3 in front, 4 behind, etc.

I'll give you the first way. In JS Home Positions you'd put:
Code:
// Declare Constants
const sprite = this;
const actor = this._actor;
const index = arguments[0];

// Make Calculations
let x = Math.round((Graphics.width / 2) + 192)

x -= Math.floor((Graphics.width - Graphics.boxWidth) / 2);

x += (index > 3 ?  (index - 4) * 32 : index * 32);

// This line pushes the second row back
if (index > 3)
    x += 60;

let y = (Graphics.height - 200) - ($gameParty.maxBattleMembers() * 48);

y -= Math.floor((Graphics.height - Graphics.boxHeight) / 2);

y += (index > 3 ? (index - 4) * 48 : index * 48);

// Home Position Offsets
const offsetNote = /<SIDEVIEW HOME OFFSET:[ ]([\+\-]\d+),[ ]([\+\-]\d+)>/i;
const xOffsets = actor.traitObjects().map((obj) => (obj && obj.note.match(offsetNote) ? Number(RegExp.$1) : 0));
const yOffsets = actor.traitObjects().map((obj) => (obj && obj.note.match(offsetNote) ? Number(RegExp.$2) : 0));
x = xOffsets.reduce((r, offset) => r + offset, x);
y = yOffsets.reduce((r, offset) => r + offset, y);

// Set Home Position
this.setHome(x, y);

Also, there's a little tutorial thread by @NaosoX that might be generally useful:
It's not super simple, because you have to know some JavaScript expressions to pull this off.

I don't know whether you want those all in order - e.g. 1-4 in front then 5-8 in back, or if you want them alternating with 1, 2 behind, then 3 in front, 4 behind, etc.

I'll give you the first way. In JS Home Positions you'd put:
Code:
// Declare Constants
const sprite = this;
const actor = this._actor;
const index = arguments[0];

// Make Calculations
let x = Math.round((Graphics.width / 2) + 192)

x -= Math.floor((Graphics.width - Graphics.boxWidth) / 2);

x += (index > 3 ?  (index - 4) * 32 : index * 32);

// This line pushes the second row back
if (index > 3)
    x += 60;

let y = (Graphics.height - 200) - ($gameParty.maxBattleMembers() * 48);

y -= Math.floor((Graphics.height - Graphics.boxHeight) / 2);

y += (index > 3 ? (index - 4) * 48 : index * 48);

// Home Position Offsets
const offsetNote = /<SIDEVIEW HOME OFFSET:[ ]([\+\-]\d+),[ ]([\+\-]\d+)>/i;
const xOffsets = actor.traitObjects().map((obj) => (obj && obj.note.match(offsetNote) ? Number(RegExp.$1) : 0));
const yOffsets = actor.traitObjects().map((obj) => (obj && obj.note.match(offsetNote) ? Number(RegExp.$2) : 0));
x = xOffsets.reduce((r, offset) => r + offset, x);
y = yOffsets.reduce((r, offset) => r + offset, y);

// Set Home Position
this.setHome(x, y);
If i understand correctly, the way you provided here should work the way i’d prefer it. Thanks so much for your help again!
Do you already have something for increasing the number of battle members? As you may know, the standard is four.
Do you already have something for increasing the number of battle members? As you may know, the standard is four.
Yes the game starts with 4 party members and there are 4 super rare items which each increase party size by 1
It's not super simple, because you have to know some JavaScript expressions to pull this off.

I don't know whether you want those all in order - e.g. 1-4 in front then 5-8 in back, or if you want them alternating with 1, 2 behind, then 3 in front, 4 behind, etc.

I'll give you the first way. In JS Home Positions you'd put:
Code:
// Declare Constants
const sprite = this;
const actor = this._actor;
const index = arguments[0];

// Make Calculations
let x = Math.round((Graphics.width / 2) + 192)

x -= Math.floor((Graphics.width - Graphics.boxWidth) / 2);

x += (index > 3 ?  (index - 4) * 32 : index * 32);

// This line pushes the second row back
if (index > 3)
    x += 60;

let y = (Graphics.height - 200) - ($gameParty.maxBattleMembers() * 48);

y -= Math.floor((Graphics.height - Graphics.boxHeight) / 2);

y += (index > 3 ? (index - 4) * 48 : index * 48);

// Home Position Offsets
const offsetNote = /<SIDEVIEW HOME OFFSET:[ ]([\+\-]\d+),[ ]([\+\-]\d+)>/i;
const xOffsets = actor.traitObjects().map((obj) => (obj && obj.note.match(offsetNote) ? Number(RegExp.$1) : 0));
const yOffsets = actor.traitObjects().map((obj) => (obj && obj.note.match(offsetNote) ? Number(RegExp.$2) : 0));
x = xOffsets.reduce((r, offset) => r + offset, x);
y = yOffsets.reduce((r, offset) => r + offset, y);

// Set Home Position
this.setHome(x, y);

Also, there's a little tutorial thread by @NaosoX that might be generally useful:
I did a playtest and all the characters appeared in the top right corner rather than the usual positions
HMOOVnW - Imgur.png
But it is making the rows correctly. I see the error.

Replace the line that starts with let y with this:
Code:
let y = Graphics.height - 392;
But it is making the rows correctly. I see the error.

Replace the line that starts with let y with this:
Code:
let y = Graphics.height - 392;
This fixed it. Everything works perfectly now. thank you!
you can check this also for 8 and 12 actors to make rows

Original thread: https://forums.rpgmakerweb.com/threads/actors-rows.170675/