Check if an actor is in party

Hi there! I'm creating a custom menu and I'm trying to push the scene of the equip menu in a way like this:


$gameParty.setMenuActor($gameActors._data[1]);
        SceneManager.push(Scene_Equip);


The problem is, there're 4 actors in the story, but not all of them are available from the beginning, the problem is:


There's an icon under each character space which let the player enter to the equip menu, but if the button under an unavailable player is touched, it throws an error.


What I need is say to that button that, when is touched, if the actor X is in party, open the equip menu of that actor with ID X, if is not, do nothing.


Any idea?


Thanks a lot.
There is an option in Conditional Branch to test if an actor is in the party.  Just look and see how it's done there, and duplicate it.


rpg_objects.js under Game_Interpreter:


case 4: // Actor
var actor = $gameActors.actor(this._params[1]);
if (actor) {
var n = this._params[3];
switch (this._params[2]) {
case 0: // In the Party
result = $gameParty.members().contains(actor);
break;




So you're after $gameParty.members().contains($gameActors.actor(x)) where x is replaced by the actor id variable you'll use in your script.


There is also an event page condition that allows you to make the page active if a certain actor is in the party.  You could also check there, and you'll probably find it's very similar.
There is an option in Conditional Branch to test if an actor is in the party.  Just look and see how it's done there, and duplicate it.


rpg_objects.js under Game_Interpreter:



case 4: // Actor
var actor = $gameActors.actor(this._params[1]);
if (actor) {
var n = this._params[3];
switch (this._params[2]) {
case 0: // In the Party
result = $gameParty.members().contains(actor);
break;




So you're after $gameParty.members().contains($gameActors.actor(x)) where x is replaced by the actor id variable you'll use in your script.


There is also an event page condition that allows you to make the page active if a certain actor is in the party.  You could also check there, and you'll probably find it's very similar.

I love you so much. It works perfectly 

Original thread: https://forums.rpgmakerweb.com/threads/check-if-an-actor-is-in-party.69879/