Any way to change party formation through event?

I want the main hero of the game to leave the party before every battle, and rejoin the party at the end of battle. Basically a main hero who does not fight. It shouldn't be hard to do that part in events with every monster battle. 


The part that gets me most is when he rejoins the party, he will always be the last in the party, is there a way I can automatically switch him to the top of the party?
Could've sworn Hime did something similar to what you're expecting to do, but I can't remember the name of the plugin. Try browsing around her site? 


http://himeworks.com/
After adding him to the end of the party, do the following in a script call:


$gameParty._actors.unshift($gameParty._actors.pop())


This will remove the last element from the array (the actor you just added) and insert it at the front of the array.
After adding him to the end of the party, do the following in a script call:


$gameParty._actors.unshift($gameParty._actors.pop())


This will remove the last element from the array (the actor you just added) and insert it at the front of the array.



I knew I could count on you Shaz, thank you so much! I can't even express how much I appreciate the help you always give!


Thank you!!!
After adding him to the end of the party, do the following in a script call:


$gameParty._actors.unshift($gameParty._actors.pop())


This will remove the last element from the array (the actor you just added) and insert it at the front of the array.



Actually I have found a problem with it. It changes the formation of the party so he is in slot 1. The issue is the walking animation stays the same. Is there a way to fix this? I removed party followers, but it still has the image of the member that was originally in the 1st slot. It fixes when I teleport to another location, but I'm wondering if there's a way to fix it before having to teleport to another area?
ah!


$gameParty._actors.unshift($gameParty._actors.pop())
$gamePlayer.refresh()


I always forget that bit!
ah!



$gameParty._actors.unshift($gameParty._actors.pop())
$gamePlayer.refresh()


I always forget that bit!



Thank you! <3

Original thread: https://forums.rpgmakerweb.com/threads/any-way-to-change-party-formation-through-event.67203/