SVActorPositionMZ: Can i use multiple IF statements to reposition my actors in battle?

I pretend to make a Front view battle system, but with visible actor sprites. However, i want them repositioned according to the number of party members the player has a the time.

i.e.: If i have only one party member, have them at the center, but if i have two, put them side to side and so on.

Is it possible?

Thanks in advance...
You might not need any if statements. A simple math formula can work. Character position on the x axis should be equal to

(character index) * (Width of screen) / (party size + 1)
I'll try this, but in advance, before anything...
I LOVE YOU!

Nah, seriously, thanks for answering!

I'll report back with results...
I'm trying to adapt the formula. But i can't for the life of me find the correct library that returns the current number of party members.

I tried using $gameParty.battleMembers()
And $gameParty.members()

None of these work...

Which one should i use?

Thanks in advance! D:
I'm trying to adapt the formula. But i can't for the life of me find the correct library that returns the current number of party members.

I tried using $gameParty.battleMembers()
And $gameParty.members()

None of these work...

Which one should i use?

Thanks in advance! D:
try $gameParty.size() for party size, and actor.index() for character index. Whatever this code needs to be is context-sensitive so I'm not entire sure where you're using it
I'm using it here on this plugin (that's supposed to come with MZ by default)

Screenshot.png
Interesting, then you might try this for actor 1
Code:
Graphics.boxWidth / ($gameParty.size() + 1)

For actor 2 it would be
Code:
2 * Graphics.boxWidth / ($gameParty.size() + 1)

For actor 3:
Code:
3 * Graphics.boxWidth / ($gameParty.size() + 1)
I got this error...

I have no idea what could be causing it.

If you happen to reply to this again, thank you for your patience.
Screenshot.png


EDIT: As additional info, I tried running this into a new proyect, and it gave the exact same error.

Is there a library list for RPG Maker MZ?

I even tried a workaround method of assigning the number of party members to a variable and using that, but it also returns an error...
I got this error...

I have no idea what could be causing it.

If you happen to reply to this again, thank you for your patience.
View attachment 309657

EDIT: As additional info, I tried running this into a new proyect, and it gave the exact same error.

Is there a library list for RPG Maker MZ?

I even tried a workaround method of assigning the number of party members to a variable and using that, but it also returns an error...
This one stumps me because $gameParty shouldn't be null unless you're only just booting your game and I have no idea why that plugin is trying to solve for actor positions when booting.

You could add a check to prevent a crash if $gameParty is null, so for actor 2 the formula for x position should be

Code:
2 * Graphics.boxWidth / (($gameParty ? $gameParty.size() : 4) + 1)
That way if $gameParty is null for any reason, it pretends that there's a 4-member party
I have no idea why that plugin is trying to solve for actor positions when booting.
Because it does.
1719455845640.png


I think that's a very weird way to do it. It also means your solution won't work, because the plugin parameter isn't recalculated later.

It also, as far as I can think, means the included example of using a game variable (misspelled) shouldn't work either, so the whole thing is kind of weird.

@FugitiveAngus
You can get around it by letting the game start and then using the included plugin commands to change the values.

Or just use a different plugin.

Edit: You can try this. Edit the top, from line 333, to look like this (take out the eval() ).
1719456175945.png

for all of them, through line 340. Then edit lines 476 and 477:
1719456329019.png
I'll try using plugin commands then.
What a shame it does such a thing :\
Regardless, you two are the best. Thanks for all your help. I'll report back how i went.
I'll try using plugin commands then.
You might have been writing your post while I was editing mine - I gave you some edits to try in the plugin.
Ok!
Not only it worked but it also now let me use many other formulas!

I appreciate this help! Could not have done it without you all! :>

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/svactorpositionmz-can-i-use-multiple-if-statements-to-reposition-my-actors-in-battle.169827/