Help adding and removing actors from party

I have been trying to remove members from the party and adding them after certain battle with another character.
I have tried using
1676234407484.png

to save the info for adding them later but I only face errors.
Using this event to remove the third member of the party doesn't work:
1676234507565.png

And this is the error:
1676234531859.png

I need help with the code to add the member again later using the variable because my idea is to remove all members from the party, adding then one character that wasn't in the group before and after the battle, adding the old actors to the party as it was before the event.
Thanks in advance
My initial guess would be that you don't have 4 actors in your party when you run this.

Is your "new" character going to remain in the party after the battle? If not, you could just set a single variable to $gamParty._actors.clone(), then afterwards, set $gameParty._actors to $gameVariables.value(n).clone() ... I didn't test that, so it might not be quite right.
The error message is exactly right - there's no such member variable in the Game_Actor object as _actorID.

It's _actorId, with a lower case "D".

However, it is also incorrect form to be referencing that in the first place - a getter function is provided for you, so it's more correct to be using that instead.
Code:
$gameParty.members()[0].actorId()

Note this is also case sensitive (as is everything in JavaScript).
The error message is exactly right - there's no such member variable in the Game_Actor object as _actorID.

It's _actorId, with a lower case "D".

However, it is also incorrect form to be referencing that in the first place - a getter function is provided for you, so it's more correct to be using that instead.
Code:
$gameParty.members()[0].actorId()

Note this is also case sensitive (as is everything in JavaScript).
I made it work with this, thank you so much.

Original thread: https://forums.rpgmakerweb.com/threads/help-adding-and-removing-actors-from-party.154920/