How to add party member to second slot?

Hello all,

My game implements humans and animals battling alongside each other in battles. There are instances where I want the player to be able to talk to an NPC and invite them to come along with them, but I want this to bump them to the second spot (or occasionally the third or fourth spot if they already have other NPC followers) in front of the animal party members. Is there an easy script call or something that can do this?
1703704372409.png

Is this what you're looking for? You'd first have to make a character of what you're adding in database, of course.
Oh no, I'm sorry, I should've been more clear. I'm talking about instances where I already have 3 party members. The player's character and two other party members already. I'm looking for a way that when I add a party member by the method you posted, instead of placing the new party member in the fourth slot by default, I'm looking for some way to force that party member into the second slot and bump the other two down to third and fourth.
You would use the swapOrder method.

In the event, after you add the party member, use the Script command:
Code:
$gameParty.swapOrder(1, 3)

The party members are numbered starting with 0, so that will swap the second actor in line with the fourth that you just added.
Oh, I understand now. I'm not sure if there's a way to do this, actually. I think that should be a feature!
Oh, I understand now. I'm not sure if there's a way to do this, actually.
Worst case scenario, you could remove all the other party members then add them back in the order you want, if you needed to just stick to event commands.

But there's the simple script call I provided above (which you may have been typing during and not seen).
Worst case scenario, you could remove all the other party members then add them back in the order you want, if you needed to just stick to event commands.

But there's the simple script call I provided above (which you may have been typing during and not seen).
I was going to recommend that, but I didn't because I assumed they wanted it to be more flexible
Excellent, thank you!! Ultimately, I think it'll work but I'm finding it hard to ultimately achieve what I want to do. Essentially trying to make a game similar to Pokemon in some ways in which the player characters can build a team of animals/monsters, but the NPCs also have a team of characters. The idea is that you can have up to three NPCs (if you have built enough friendship with them) join you and they will battle alongside you with one of their animals/monsters. I also plan to have the human characters battle with the monsters instead of just sending them out to fight. The battles will look something like this (this is a very rough idea with some very rough placeholder assets for now while I test everything):


SummonBattle.png


It worked for that image because I manually added the actors in the order I wanted them. The problem I'm envisioning now is how I can control that the human actors are in the back and the animals are in the front. It's easy when I can say "actor 1 needs to be in this SV position" with a plugin I have, "Actor 2 needs to be here", etc. but in order for it to work, I need to find a way to control that positions 1-4 are only human characters and 5-8 are only animal/monsters when both human and animal characters are getting added/removed throughout the game. I'm fiddling around with Visustella's Party System plugin seeing if it can do everything I want, but I haven't gotten to anything conclusive with it yet.
The problem I'm envisioning now is how I can control that the human actors are in the back and the animals are in the front.
What is the problem with the script call I provided you?

Any time you're adding an actor to the party you have to know whether it's a person or a monster, so why can't you swap them into the appropriate position?
What is the problem with the script call I provided you?

Any time you're adding an actor to the party you have to know whether it's a person or a monster, so why can't you swap them into the appropriate position?

Oh, I think it'll work, I just have to figure out how to best implement it efficiently. I would have to figure out how to make the game find out what position the newly added actor is in once they're added and swap them accordingly. The player starts out the game with just themselves in the party. From then, they can "capture" animals/monsters to join their party and battle with them. So they could be trying to have an NPC join them when they have two total party members or 50 (if they've captured 49 animals). Being able to tell the game to figure out whether or not to run $gameParty.swapOrder(1, 3) or $gameParty.swapOrder(1, 49) to put the newly added member into the second slot is what I'm trying to sort through in my head.
Just have two variables that you increment/decrement when you add/remove party members that tracks how many humans and how many monsters.
Yeah, that's where I started! I've been trying to set up to where it runs a conditional that checks:

If HumanActors = 1
$gameParty.swapOrder(1, ___)
Else If HumanActors = 2
$gameParty.swapOrder(2, ___)
etc.

Right now I'm getting stuck on how to best tell the game what to use as that second number because it would be dependent on how many animals the player has added to their party over time. There are around 100 or so animals/monsters planned that the player can add to their party throughout the course of the game via capture. My first thought was to create a variable that gets the party size, then subtract 1 from that to get the party index of where that new character is going to be added.
Right now I'm getting stuck on how to best tell the game what to use as that second number because it would be dependent on how many animals the player has added to their party over time.
Why? When you add a new party member, they are always the last one in the party, so if you're swapping them in, you must reference that number or it won't be swapping that actor. It's not a choice.

I think the part that's confusing you (and me) is if you have these butt-tons of actors, and you're saying when you get a new one they're automatically shoved into your battle party, what should the default result be for the ones who were already in there?

Logically, you may need to make a series of swaps in order to achieve the specific order you want.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-add-party-member-to-second-slot.164205/