Formation Party Leader help

I recently made a section of the map where I'd like to force players to only have access to the main protagonist. But removing the rest of the members from the party breaks some events in world. While in the maps in question formation changing has been disabled.

Is there any simple method to detect which character is the active leader then switch it? I scrolled through some similar board questions but those had codes for swapping specific party members, they didnt cover detecting whos in what position. I just want to make sure the initial character is the party leader. Im unsure how to do that.
You can use Change Party Members to remove actor 1. Then instead of Change Party Members to add them back (which would put them last in line), just do a script call:

Code:
$gameParty._actors.push(1);
$gamePlayer.refresh();
$gameMap.requestRefresh();
You can use Change Party Members to remove actor 1. Then instead of Change Party Members to add them back (which would put them last in line), just do a script call:

Code:
$gameParty._actors.push(1);
$gamePlayer.refresh();
$gameMap.requestRefresh();
Hey, thank you very much, youve answered a few of my questions and I appreciate it!
You can use Change Party Members to remove actor 1. Then instead of Change Party Members to add them back (which would put them last in line), just do a script call:

Code:
$gameParty._actors.push(1);
$gamePlayer.refresh();
$gameMap.requestRefresh();
Hmm, I've tested it but no dice. he just gets added back into the fourth slot. Is there a way to detect which character is in which spot? I could just make a few 'If' conditions. and swap character positions that way maybe. Again appreciate the response.
I recently made a section of the map where I'd like to force players to only have access to the main protagonist.

Is there any simple method to detect which character is the active leader then switch it?
So I'll trust that you have something in mind, but you know these are saying two different things, right? Unless you remove the other actors (which you were saying somehow break events?), your player will not "only have access to the main protagonist."

Anyhow.

You can see who's at the front of the party by looking at $gameParty.battleMembers()[0] or $gameParty.leader(). You can then swap the places of two actors in the party via swapOrder().

So here's a script that should put a specific actor in the front of the party, if he isn't already:
Code:
if ($gameParty.leader().actorId()!=X)
{
    $gameParty.swapOrder(0, $gameParty.find(member => member.actorId()==X));
    $gamePlayer.refresh();
    $gameMap.requestRefresh();
}
where both instances of X are the actor ID you want to be in front.
I'm sorry - push will add it to the end. I even looked it up to see what the correct command was, and then I wrote the wrong one.

Please try this instead:

Code:
$gameParty._actors.unshift(1);
$gamePlayer.refresh();
$gameMap.requestRefresh();

Original thread: https://forums.rpgmakerweb.com/threads/formation-party-leader-help.140975/