Get position of party member within battle party?

Hi,

I was wondering if there was a script call or way to retrieve the value of an individual party member's battle position. I know you can return info about the whole battle party using $gameParty.battleMembers(), but basically I'm trying to get the current actors position within the battle party (1st, 2nd, 3rd or 4th) and store that value in a variable to then call a switch - so I can make different things occur depending on which battle member is identified.
to get the position of the party members position, use simply those:
$gameParty.members()[0] - 1st Member or Leader
$gameParty.members()[1] - 2nd Member
$gameParty.members()[2] - 3rd member
$gameParty.members()[3] - 4th Member
Thanks, would there be any way to find this dynamically, for example:

var activeMember = ???

switch(activeMember) {
case "0":
case "1":
etc...

So that on every turn, depending on who the active party member is in the battle, something different will happen based on the results on the switch? If that makes sense? 🙂
While, so far JS code goes, im not that good, but the above mention is the most simple position,
there is another scriptcall for the actor's ID, like if you have actorID 3, and switch with actor 1, that stays actor 3.
but on the part you want and what you like to achieve, explain it a bit more, so ppl with more js knowledge can
help you out on it (if not needing for a plugin) but you can event some as well in a commen event that you can call.

if you use discord, join the the lunatic discord server, where you get faster help 🙂
No worries, thanks for your help 🙂 I'm new to MV and not amazing with JS so it's all a learning exercise for me too!

Basically what I'm trying to achieve is this:

Say I have a party with Harold, Therese, Martha and Lucius as my battle party. On every turn, I need to find the party member's position within the battle party, and then run a JS switch to determine an action, so if my party shows as follows in battle:

Harold HP 100/100 MP 100/100
Therese HP 100/100 MP 100/100
Martha HP 100/100 MP 100/100
Lucius HP 100/100 MP 100/100

So on Harold's turn, the script finds his position in the battle party and would return "0" - then the switch executes and does what it needs...
Then it's say Martha's turn, the script finds her position and returns "2" - then the switch executes and does what it needs and so on...

Hopefully this makes more sense to anyone that can help!
but basically I'm trying to get the current actors position within the battle party (1st, 2nd, 3rd or 4th) and store that value in a variable
absolutely no need for a script call for this.

just use control variable command and go to "game data" (the one that defaults to map id). This part of the command le't you load dozens of different values into the variable, including the actor IDs of the actors in specific party positions.
Thanks, I've looked into that but I don't think it's what I'm looking for, it's so I can change the colours of the HP/MP/TP bars for a battle party member depending on other things within a battle, so I need the position (not the actor ID) in the battle party of the active character on their turn, regardless of which actor that is.

So to expand on my example above, if Harold is the first battle party member, when it's his turn, it would return "0", but if he was the second battle party member, when it was his turn it would return "1", and so on...

So for example: $gameParty.members().getPosition() ...which would return 0, 1, 2 or 3
I'm also in need of this, how do I know that the actor of id database 1 is the leader of the group?
I've tried everything and I can't execute the scriptcall correctly 🙁
$gameParty.members().indexOf(BattleManager._currentActor)

Original thread: https://forums.rpgmakerweb.com/threads/get-position-of-party-member-within-battle-party.109858/