Script call for Party Position ID and retaining it for removal.

Hello, I have a possibly simple question. Basically I'm trying to get the script call language needed to grab the ID of an actor in a party position, and then use a second script call to reference that new number.

So first I'd be using:
$gameParty.members()[p]._actorId

To find any actor ID in position p. But then what kind of value would I use in order to retrieve that newly acquired number? I see expressions like "newActor.id" exist when pulling instanced actors, so sure there must be one I can pair with this script for n :

$gameParty.removeActor(n)

My goal is to have a system similar to Persona/SMT games where the reserve capacity is limited, so being able to get rid of actors in a convenient way is necessary.
I'm not sur if it's what you're asking, but why not do it all in a simple call like this :
Code:
$gameParty.removeActor($gameParty.members()[p]._actorId);
If you want to do something like remove the last member of a party when you have too many members, remember that adding an actor adds them to the end of the party lineup, so you can't just remove the last member, as you'd be removing the person you just added.

You could do something like this when you want to add a new member:
Use control variables to get the party size into a variable
Use a conditional branch to see if the party size is equal to the maximum size, and if it is, a script call to remove the last party member.

In that case, it would be
Code:
$gameParty.removeActor($gameParty.members()[$gameParty.members().length - 1])
to remove the last person in the party

And then add the new party member (this would be done outside the conditional branch, so the new member would be added to the end of the lineup if it were already full and one person removed, or if there was still room for more)
I'm not sur if it's what you're asking, but why not do it all in a simple call like this :
Code:
$gameParty.removeActor($gameParty.members()[p]._actorId);

This one did the trick! Thanks a lot.

@Shaz Your method is also super helpful! I'm still toying around with how I want the event to play out. So having this also be available for reference is amazing!

Thanks a ton ya'll!
@KingKraken
For the first part there would have been no need for a script call at all.
That (ID of actor on party position) is one of the many options available in the default control variable command under game data.
I suggest you check that option (it default to "map id" if you have problems seeing it, but that map id can be changed to other options) for future needs, because a lot of things can be done without scripts.
@KingKraken
For the first part there would have been no need for a script call at all.
That (ID of actor on party position) is one of the many options available in the default control variable command under game data.
I suggest you check that option (it default to "map id" if you have problems seeing it, but that map id can be changed to other options) for future needs, because a lot of things can be done without scripts.

I needed the script, because the game data variable stops at 8 party positions. Whereas I'm using about 12+.

Original thread: https://forums.rpgmakerweb.com/threads/script-call-for-party-position-id-and-retaining-it-for-removal.93500/