MZ dynamic sv actor position based on class (visustella battle core)

About a year ago I was able to get help with how to position my sv actors the way that I wanted. What I'm wondering now is if I can put in some code to achieve this effect: basically, some classes that I assign will have their sv battler be moved a little bit further "back" (like wizards, priests, rangers), and some classes will be further "up" (like knights, barbarians, etc.).

I'm wondering if I can change the X offset (It's X, right? horizontal position) based on the sv actor's class.

I should also add - I tried using the tags from the plugin, but they don't seem to work. I tried putting in <Sideview Home Offset: +50> under a class, for example, but an actor with the class doesn't move.

Thank you in advance for the help!

If it helps, here is what I'm currently using:



// Declare Constants

const sprite = this;

const actor = this._actor;

const index = arguments[0];



// Make Calculations

let x = Math.round((Graphics.width / 2) + 336)

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

x += index * 2;

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

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

y += index * 96;



// 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);
You could add a check for the class in your formula, but
I should also add - I tried using the tags from the plugin, but they don't seem to work. I tried putting in <Sideview Home Offset: +50> under a class, for example, but an actor with the class doesn't move.
That's the wrong syntax.

1731284315072.png


It's expecting two values, comma-separated.
You could add a check for the class in your formula, but

That's the wrong syntax.

View attachment 322666

It's expecting two values, comma-separated.

omg. For some reason my dum dum brain thought you just chose if you wanted to only include X or Y. THANK YOU

Original thread: https://forums.rpgmakerweb.com/threads/dynamic-sv-actor-position-based-on-class-visustella-battle-core.173132/