MZ Possible to push actor into specific slot in the party regardless of number of members?

Hi,

I was wondering if it is possible, when you add a party member, that this party member will occupy a specific slot in the party regardless of the number of party members (instead of pushing and unshifting). So for example, add someone in the fifth slot even if there are only two party members.

Thanks!
It is possible, yes. Though you'd need a plugin that changes the checks done on a party slot so that you don't get a crash from the "blank" slot not existing when it tries to check whether they're alive or not.
Okay, thanks... and yeah changeOrder fails when you try to swap with an empty slot.
This snippet might help you somehow, but it's made based on RMMV because I don't own MZ. 😛
You're free to try it out.

JavaScript:
//==============================================================
// * InsertActor.js
// Call: $gameParty.insertActor(Position, NewActorID);
//==============================================================

Game_Party.prototype.insertActor = function(pos, newActorId) {
  this._actors.splice(pos, 0, newActorId);
}

The first position available is always 0.
This snippet might help you somehow, but it's made based on RMMV because I don't own MZ. 😛
You're free to try it out.

JavaScript:
//==============================================================
// * InsertActor.js
// Call: $gameParty.insertActor(Position, NewActorID);
//==============================================================

Game_Party.prototype.insertActor = function(pos, newActorId) {
  this._actors.splice(pos, 0, newActorId);
}

The first position available is always 0.
This would only work if OP only needs them to be added at the given slot *at the time they're added* rather than having like "party member - blank - blank - party member" with visible spacing in the menus.
A workaround might be to make "blank" actor(s) to fill the space? I think their gauges etc would still show up, though. Depends on why you'd want to put someone in a specific slot like that.

Also, the core script "change formation" method is Game_Party#swapOrder, not changeOrder.

JavaScript:
Game_Party.prototype.insertActor = function(pos, newActorId) {
  this._actors.splice(pos, 0, newActorId);
}
If using this, I would strongly recommend doing the usual round of refreshes afterwards, i.e.

JavaScript:
$gamePlayer.refresh();             // leader/follower sprites
$gameMap.requestRefresh();         // event page conditions
$gameTemp.requestBattleRefresh();  // party status faces

(Cf Game_Party#addActor; requestBattleRefresh is new to MZ.)
A workaround might be to make "blank" actor(s) to fill the space? I think their gauges etc would still show up, though. Depends on why you'd want to put someone in a specific slot like that.

Also, the core script "change formation" method is Game_Party#swapOrder, not changeOrder.


If using this, I would strongly recommend doing the usual round of refreshes afterwards, i.e.

JavaScript:
$gamePlayer.refresh();             // leader/follower sprites
$gameMap.requestRefresh();         // event page conditions
$gameTemp.requestBattleRefresh();  // party status faces

(Cf Game_Party#addActor; requestBattleRefresh is new to MZ.)
Yeah, if you used a blank actor the battle system would still consider them viable targets, you'd still see gauges etc. That's why I didn't suggest that, as it would require more of a plugin investment than just fixing the crash that happens when the system sees a blank party slot.
Thanks all for the input! The context is that I have a raft in the party member. The way it's set up now is that when you engage an enemy on the raft, only two party members will participate in battle, the others will be temporarily removed, and the raft added as the third party member.

The problem obviously is when the protagonist is alone, on a raft, and engages an enemy... so I was looking for a way to fix the position of the raft, and I thought if I'm going to fix it anyway I might just as well push it back to position five, so that it does get a graphic but will not participate in battle (at least I think that's how VS Battle Core works...).
Just thought I'd come back and mention how I've worked around the problem.

This plugin allows you to change the combat party size on the fly:


The plugin command is then used in a pre-combat common event (configured in VS Battle Core), and reset to 4 post-battle. A little crude but it works nicely. The only thing that throws a wrench in things is the auto-save: it apparently saves after the pre-combat common event triggers, but right before the battle. So I need to either disable auto-save, or reset the party to 4 upon save load.

Will probably get rid of auto-save...

Original thread: https://forums.rpgmakerweb.com/threads/possible-to-push-actor-into-specific-slot-in-the-party-regardless-of-number-of-members.159274/