Formula for hero position needed.

Hi friends! Hoping one of you can help me. I'm using Yanfly's BattleCore Engine and set it up to tweak the basic Front View Battle System a bit.

Here's my issue/request; I'd like the hero sprites to be centered and evenly spaced, flexibly positioned based on how big the party is. See below quick mockup for reference.

UryRxnL.png


All I need is a formula that determines the x position.

Currently I'm playing with the thought of maximizing the active party to 3 members, but for the sake of possibly changing my mind later let's say it needs to support up to 5 members.

Thanks in advance to anyone who can help me!

If this kind of request is supposed to be placed in another section of the forum, please forgive me.
In the Battle Core's 'Front Position X' parameter, input the following formula:

Code:
(Graphics.boxWidth * (index + 1)) / (partySize + 1)

This should do what you're trying to do.

I've moved this thread to Plugin Support. Thank you.

Thanks for fixing the location mlogan, will keep it in mind!

@ Naveed Nice work, thanks man! Is there a way I can tweak the formula to decide how much space I want to be between actors?
@masterp If you want to specify the space between each hero, use this formula instead:

Code:
(Graphics.boxWidth + x * (1 + 2 * index - partySize)) / 2

In the formula, replace x with the number of pixels you want between each hero.


For example, if you wanted the space between each hero to be 100 pixels, the formula would be:

Code:
(Graphics.boxWidth + 100 * (1 + 2 * index - partySize)) / 2

You get the point 🙂
Thanks man, that's exactly what I needed. Always trust a guy with a SSJ4 Gogeta avy!

You're getting credited in my project when it finally rolls out. It might seem like a minor detail to some, but to me it's crucial to get this right.

Thanks again!
You're welcome, glad I could help 🙂

Original thread: https://forums.rpgmakerweb.com/threads/formula-for-hero-position-needed.79856/