// Declare Constants
const sprite = this;
const actor = this._actor;
const index = arguments[0];
const columnIndex = parseInt(index / 3);
const rowIndex = parseInt(index % 3);
// Make Calculations
const diffX = 16, columnDX = 64;
let x = Math.round((Graphics.width / 2) + 250)
x -= Math.floor((Graphics.width - Graphics.boxWidth) / 2);
x += columnIndex * columnDX + rowIndex * diffX;
const columnDiffY = 20, rowDY = 64, columnMaxMembers = 3;
let y = (Graphics.height - 120) - (columnMaxMembers * rowDY);
y -= Math.floor((Graphics.height - Graphics.boxHeight) / 2);
y += rowIndex * rowDY + (columnIndex % 2) * columnDiffY;
// 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);