MV Is it possible for RMMV to remember who was in a player's party before removing them and then adding the remembered members them back in?

I want to know if this can be done with out a plugin first. If one is needed or if you know of any that can do this please say so and what plugin, if any. Thanks in advance.

Importantly I only need this to be answered for Scenario 1; Scenario 2 is more so for curiosity's sake.
Scenario 1:
Say there are 10 actors in the game total, and a party can only have 3 actors in combat at a time.
The player has Actor 1, X, Y, and Z in their party. (X/Y/Z are just any non-duplicate combination of Actors 2-10)
What I want to happen is for the game to Remove the Actors from the party who aren't Actor 1 (assuming this Actor is always in the party for now), then add the same Actors X, Y, and Z that were removed back in (preferably in the same party order) without adding the Actors that weren't there before being removed. How would this be done?

Scenario 2:
This time let's assume that Actor 1 is no longer guaranteed to be in the party and is now Actor H. So any combination of Actors H, X, Y, Z are in a party, is it possible to remember who was in the first party slot and remove the rest, then add them back in without adding the Actors that weren't there before being removed?
Sure! Make an event that does 10 conditional branches (one for each actor).
1758708097637.png

If true, you could turn on a switch "Dunstan is in party".

Now you have a set of switches based on who is in the party and can reversely use those switches to add them back in. This would not take previous party order into account, but it's the most basic way of doing it.

With some variables and scripts it would also easily be possible to consider order, but I'm clueless on how to write those. Neither method requires a full on plugin.
yah, just use the script to store the actor id in a variable everytime, have it stored in an array. i dont think you can make global variables via script.

Code:
// Get the current party members
var partyMembers = $gameParty.members();

// Save all actors except Actor 1
var savedActors = partyMembers.filter(function(actor) {
    return actor.actorId() !== 1;
});

// Clear the party entirely
$gameParty.removeAllActors();

// Add Actor 1 back first
$gameParty.addActor(1);

// Add back the saved actors in the same order
savedActors.forEach(function(actor) {
    $gameParty.addActor(actor.actorId());
});

Code:
// Get the current party members
var partyMembers = $gameParty.members();

// Remember the first slot actor
var firstActor = partyMembers[0];

// Save everyone else (the ones we’ll remove and restore later)
var savedActors = partyMembers.slice(1);

// Clear the party completely
$gameParty.removeAllActors();

// Add back the first slot actor
$gameParty.addActor(firstActor.actorId());

// Add back the saved actors in order
savedActors.forEach(function(actor) {
    $gameParty.addActor(actor.actorId());
});
This is what I do to save the party order:

Screenshot 2025-09-24 160647.png
Probably irrelevant here, but for the sake of completion, you can check which actor is in a certain party member position through "Control Variables" (Game Data -> Party).

Saving and restoring the party this way is likely more complicated than using xabileugs or Piyan Glupaks solutions, and mostly useful if you want to avoid Javascript commands for some reason:
You can just clone the array into a variable and then call it back when you want it restored:
JavaScript:
$gameVariables.setValue(1, $gameParty._actors.clone());
It will save your current configuration as an array in control variable 1 (or which ever you specify in the .setValue).

To restore that specific party, you do:
JavaScript:
for (const id of $gameVariables.value(1)) $gameParty.addActor(id);

This will restore your original party. You can also make changes to the array if needed. For a more direct approach for when you've made changes to the array (say you had actors 1, 3, 2, and 4 saved to variable 1 but you only wanted actors 3, 2, 4 - so no actor 1), you need to do:
JavaScript:
$gameVariables.value(1).shift();
$gameParty._actors = $gameVariables.value(1);
$gamePlayer.refresh();
$gameMap.requestRefresh();
Thank you everyone for your help! Only thing I have to figure out now is how to use the scripts. The solutions that don't use script have also been very useful, I appreciate it
If you are happier avoiding codes (which tend to be a little harder to debug), here is another way to do it. I stopped at saving 4 party members, but you can easily extend it to whatever you need:
Screenshot 2025-09-25 061839.png
If you are happier avoiding codes (which tend to be a little harder to debug), here is another way to do it. I stopped at saving 4 party members, but you can easily extend it to whatever you need:
View attachment 350101
Thank you greatly! Will be making use of this in the future!

Original thread: https://forums.rpgmakerweb.com/threads/is-it-possible-for-rmmv-to-remember-who-was-in-a-players-party-before-removing-them-and-then-adding-the-remembered-members-them-back-in.180276/