MV Replace one heroes group with another one.

I'm messing with party code and for scenario plots, I'm trying to replace one heroes group with another one and here's my approach to my problem:

Firt, define an array of heroes in second group
Code:
const secondParty = [15, 20, 21,22,23,24]

Second, clear $gameParty._actors and put const secondParty in its place:
Code:
const secondParty = [15,20,21,22,23,24,25]
$gameParty._actors = secondParty
$gameMap.requestRefresh()
$gameParty.refreshMembers()
$gamePlayer.refresh();

While this code works fine, because I see all new heroes in party in all Scenes, the default ones from previous array are not changed on game map. How can I swiftly switch between my defined arrays to make playable parties without a need of using party manager plugins?

I know I can event it, but using script call in my case would be a more efficient way of switching between parties.
I think you just need to call $gameMap.refresh()

I'm not sure what requestRefresh is, but it sounds like it isn't immediate. You might also try switching up the order, refreshing the map after the player.
@ATT_Turan - as you told me, changing order didn't work.

@Andar - The plugin looks fine and it actually solves the main problem as well the problem of storing items and weapons.

Thank you both for help.
Hello,
I'm not sure what requestRefresh is
It will refresh the map, so that's not part of the problem.

Second, clear $gameParty._actors and put const secondParty in its place:
Code:
const secondParty = [15,20,21,22,23,24,25]
$gameParty._actors = secondParty
$gameMap.requestRefresh()
$gameParty.refreshMembers()
$gamePlayer.refresh();
But $gameParty.refreshMembers() is not a default function. Probably come from a plugin and might be what cause the problem. Because it does work as you want when I test your code without that line.

Hope that help.
How can I swiftly switch between my defined arrays to make playable parties without a need of using party manager plugins?

The (Party Manager) plugin looks fine and it actually solves the main problem as well the problem of storing items and weapons.
...so confused 😛🤣
...so confused
yanfly and tsukihime have different definition for the name "party manager".

what yanfly calls a party manager manages the content of a single party (the actors)
what tsukihime calls a party manager is for managing multiple parties with their external properties like position, inventory and so on.
yanfly and tsukihime have different definition for the name "party manager".
I wasn't criticizing your response. I'm familiar with both of their party manager plugins, I just figured that Soulrender also was, for how long he's been making and reading posts here, and was specifically asking not to use them.

No criticism to anyone all around, it just was an amusingly contradictory situation to me.

Original thread: https://forums.rpgmakerweb.com/threads/replace-one-heroes-group-with-another-one.150750/