How to force a party change without automaticly filling the party to it's capacity?

In my game, the main character is locked to slot 1. It's something thats fundemental and cant be changed. However, in some special screens you can interact with other party members. You can also interact AS other party members here to allow for all party members to converse with all party members, this feature is also linked to a friendship system i implemented.
To achieve this, i used this code

$gameParty.swapOrder($gameActors.actor(2).index(), $gameActors.actor(1).index())

To swap the desired party member (in this case #2) with the main character (1), and subsequently turn off player followers.
However when doing this the game fills up the party with recruited members up to it's capacity. And since a party member doesn't spawn in the map if they are active in the party, this causes issues. most notably in the early game where the party isnt full or if the player decides to remove members from the party using the visustella party system.
In simpler terms, when using the code. and only actor 1 and 2 are in the party. actor 3 is forcefully added. and i don't want this. Does anyone know if there is something wrong with my code, or if there is some kind of fix? thank you.
However when doing this the game fills up the party with recruited members up to it's capacity.
this is not regular behaviour, which means something has messed up the handing of the party.

So the solution to your problem is removing or bughunting the plugin that causes this wrong behaviour
this is not regular behaviour, which means something has messed up the handing of the party.

So the solution to your problem is removing or bughunting the plugin that causes this wrong behaviour
Alright, i'll run a few playtests with my plugins dissabled to narrow down whats causing the issue, thank you.
Your code is incorrect - at least, according to your description.

To achieve this, i used this code
$gameParty.swapOrder($gameActors.actor(2).index(), $gameActors.actor(1).index())
To swap the desired party member (in this case #2) with the main character (1)

That code does not swap party member 2 with party member 1.

It swaps actor ID 2 with actor ID 1, wherever they may be. And if they're not in the party, that could cause unexpected behavior.

To swap party members 2 and one, you would simply do
Code:
$gameParty.swapOrder(1, 0)
Your code is incorrect - at least, according to your description.



That code does not swap party member 2 with party member 1.

It swaps actor ID 2 with actor ID 1, wherever they may be. And if they're not in the party, that could cause unexpected behavior.

To swap party members 2 and one, you would simply do
Code:
$gameParty.swapOrder(1, 0)
Im sorry if i wasnt clear, but you are actually supposed to swap actor id 1 and 2, actor 1 is locked to party slot 1 so wheter its index or actor 1 doesnt matter in this case, but swapping with a different index is not thr intended behavior. The mechanic requires swapping with a spacfic actor and not one anyone in a spacific slot
the main character is locked to slot 1. It's something thats fundemental and cant be changed
You can also interact AS other party members here to allow for all party members to converse with all party members,
You kinda have to choose one here. you cant really say "under no circumstances can actor 1 not be the leader" and then follow it up with "you can make other actor the leader in order to interact to others"

how is the actor locked to the leader slot? if the script call isnt working as intended presumably because actor 1 is locked, are you able to undo the lock? does it work correctly when actors arent locked?
you said its specific screens, so it could be a matter of undoing the lock when you need to be able to swap and then once the player leaves the screen, set the actor back to the leader slot and lock them again no?

otherwise, youll have to find out why swapping the actors in that way adds actors to the party and resolve that or find another way of doing the interactions that dont infolve moving party members around. like some kind of menu
You kinda have to choose one here. you cant really say "under no circumstances can actor 1 not be the leader" and then follow it up with "you can make other actor the leader in order to interact to others"

how is the actor locked to the leader slot? if the script call isnt working as intended presumably because actor 1 is locked, are you able to undo the lock? does it work correctly when actors arent locked?
you said its specific screens, so it could be a matter of undoing the lock when you need to be able to swap and then once the player leaves the screen, set the actor back to the leader slot and lock them again no?

otherwise, youll have to find out why swapping the actors in that way adds actors to the party and resolve that or find another way of doing the interactions that dont infolve moving party members around. like some kind of menu
Ive done a lot of playtesting yesterday and i do think i’ve actually found a solution. Though if it does not work, i’ll take your suggestion and simply unlock the character on the spacific screens.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-force-a-party-change-without-automaticly-filling-the-party-to-its-capacity.171986/