Changing Party Leader with Eventing

I was wondering if there was a way to change your party's leader when you are eventing. The reason why I ask is because the main character has the ability to change to a different actor or alter ego by pressing a button. I want them to stay as the party leader when you switch from one actor to another.

When I have party members other than the main character they become the last member of the party as that is natural in MV's code.
Try this as a script call:
Code:
lastindex = $gameParty.members().length - 1
$gameParty.swapOrder(0, lastindex)
This will cause the party member with the highest index (i.e. the last actor added to the party) to swap places with the party member with index 0 (i.e. the party leader).
Try this as a script call:
Code:
lastindex = $gameParty.members().length - 1
$gameParty.swapOrder(0, lastindex)
This will cause the party member with the highest index (i.e. the last actor added to the party) to swap places with the party member with index 0 (i.e. the party leader).

Thanks, it worked like a charm.

Original thread: https://forums.rpgmakerweb.com/threads/changing-party-leader-with-eventing.111173/