How to detect if certain party members?

Hi, I've been taking a crack at this for a while but can't seem to wrap my head around how. I want to create a party selection mechanic where you can only have 3 (excluding the main character) members in your party at all times, but you can switch out with unselected members like in Persona 5.

So far I've managed to logic my way around how this would be done. In the hub world, I have all possible party members (7 in total excluding the mc) standing around and when you interact with them you can chose to add them to the party.

I made it so that when your party has 5 or more members, it will prompt you to remove one of these 5 (again, excluding the mc). I did this by making a Conditional Branch with "$gameParty.members().length>=5" in the Script option.

The part that I am having trouble with is everything afterword. I want to make it to where the game will make you choose one of the currently added members you want to remove, but I can't seem to figure out how to go about that. Firstly, how exactly would you detect which members are added? Like what code/conditional statement would I have to do for the game to say "partymemberA is in the party"? And secondly, how can I made it so that whichever party members are detected show up in the choice options? Would I have to make like 49 versions of the choice box but with different names or is there a simpler way of doing this?

I'm not super good with coding, I only figured out the "$gameParty.members()" thing because someone else posted something similar in this forum and I have beginner level Java knowledge.

Any help would be appreciated!
To check how many actors are in the party without scripting, you can use a variable:
  • Store: Control Variables -> Game Data -> Other -> Party Members
  • Check: Conditional Branch -> Variable
To check if a party member is in the party at the moment, you can use Conditional Branch -> Actor.


For variable choices...making one Show Choices command for each potential combination is feasible, especially if you don't have too many different choices, but it is by far the most tedious option!

You could potentially use the Select Item command: have one Hidden Item per actor, add the appropriate items based on who is (not) in the party, then have the player pick 1 of them via Select Item and respond based on the selected Item ID.

Alternatively you could try a plugin like Himeworks Hidden Choice Conditions:
This lets you assign conditions for showing each choice. If you have more than 6 choices in total then you'd probably also want Hime's Large Choices plugin, which is linked on that page.

In theory another alternative would be to build the choices manually using a script call:
However, I think plugin(s) would be simpler in your case.

(Quick note: the scripting language used by RPG Maker MV's core scripts is JavaScript, or more formally ECMAScript. Java is an entirely different language.)


If you want to make a map event (e.g. recruitable NPC) disappear when a specific actor is in the party, you can use page conditions. Conditions are the checkboxes seen to the left of an event's Contents (command list). E.g. you can make a new page, and on that page check the Actor condition. That page could have:
  • No image;
  • No commands; and
  • Through enabled (found in the Options checkboxes in the bottom-left).
I.e. make it invisible, do nothing when activated, and have no collision.

Event pages have their conditions checked from highest page index to lowest. So if page 2 meets its condition (That Guy is in the party) then page 2 will be active; otherwise page 1 will be active. The active page is entirely responsible for how the event appears in-game.

Naturally, this kind of approach can alternatively be used to change the appearance of an event rather than just make it disappear.
Thank you! This was very helpful.

After looking at some of the resources you provided, I actually realized there's a much simpler way of doing this without listing out the character's names to switch out, though I may end up coming back to that idea in the future.

Instead what I did was change the initial question, now when approaching a party member, you will be prompted to either add or remove them. If there are already 4 party members, the add option will just be disabled (using one of the plugins related to the one you shared). That way if a player wants to swap out a party member, they can just remove one of them and add the one they want. Also, I'm having it to where the party members don't follow you, they'll all just be standing around in the hub world where you can interact with them. I think it's a good compromise.

Once again, thanks for the help!

Original thread: https://forums.rpgmakerweb.com/threads/how-to-detect-if-certain-party-members.175537/