Check if an actor is in party

Jackiefly

Villager
Member
Joined
Jun 21, 2016
Messages
14
Reaction score
1
First Language
English
Primarily Uses
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.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,487
Reaction score
12,030
First Language
English
Primarily Uses
RMMV
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.
 
Last edited by a moderator:

Jackiefly

Villager
Member
Joined
Jun 21, 2016
Messages
14
Reaction score
1
First Language
English
Primarily Uses
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 
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

You know, I sometimes ponder if working on the story and details is more necessary than the game itself. Its... technically work, just not direct.

Like for me specifically I never stop evolving the story based on what avenues I can approach in gameplay and then I get anxious thinking "hey good thing I thought about that now instead of later". Repeat ad nauseam.
World Of Final Fantasy Livestream~!
(Ft. Kaliga)
So my office building has 8 individually rented offices in it; 3 of which are social workers and 2 are marriage therapists... Unsurprisingly it always sound very angry out there. Glad I have my own private entrance. :LZSexcite: :thumbsup-right:
I wonder if there's ever been an art challenge that involves drawing faces from the generator.

Forum statistics

Threads
94,379
Messages
920,488
Members
124,152
Latest member
phiny
Top