Conditional if any Party member is in the Group?

Hello, lately I have been modifying and looking for more scripts that can be done in the "Call Script" command and the "Conditional Branch", and there is one that I cannot find. and it is the command $game_party.members[0].id to select some actor of the Party.

It turns out that I have searched the code for something similar to make a condition. but I have not been successful in finding it.
this command if $game_party.members[0].id executes a command based on the party member id. But what would happen if one wants to make this condition if any character (and I mean anyone regardless of their ID) is included in the Party?

I have tried with $game_party.exists, $game_party.exists?, $game_party.members.exists and $game_party.all_members?

but none of them work, I would like to know what is the correct command to make a conditional if any member of the party is present.

Thank you very much in advance.
Wait, so what are you trying to do? You want to check if any party member, regardless of ID, is in a certain position or just that they exist in general?
this command if $game_party.members[0].id executes a command based on the party member id.
If that is your entire command, as long as you have one party member and they are in the leader position (and you don't have an empty actor slot as the leader - which has been done more times than I can remember), that will always return true. If you want something to happen based on a specific actor being in the party, or rather being the leader, you would have to do
Code:
if $game_party.members[0].id == 3
or whatever actor id you were after.

If you just want something to be done if you have a party member, and you don't care who they are, you can do
Code:
$game_party.members.size > 0
This condition from post above can crash the game if the party is empty.

Ruby:
$game_party.members[0].id == 3

It's important to make sure the specified actor-slot even exists (e.g., third would be "> 2" and "[2]").

Ruby:
$game_party.members.size > 0 && $game_party.members[0].id == 3

Or you go this way:

Ruby:
$game_party.members[0] && $game_party.members[0].id == 3

~炬燵あ
Code:
$game_party.members.collect{|actor| actor.id} & [ID]

where [ID] is the one you want to find.
returns [ID] if found, [ ] if not.
so,
Code:
if {call} != []
{validate};

you can indirectly use the actors array within $game_party, which is that same thing in disguise, but isn't a public method.

EDIT:
$game_party.members.collect{|actor| actor.id}.include?(ID) => T/F
same thing, more direct.
the thing is, you can't access the actor list from the outside (which contains IDs), you have to collect IDs from members, which holds the actual actor objects.
Wouldn't you always have at least one party member?
Ruby:
class Game_Party
  def has_id?(actor_id)
    @actors.include?(actor_id)
  end
end

The script call would be:

Ruby:
$game_party.has_id?(SOME ID)
Wouldn't you always have at least one party member?
Wait, so what are you trying to do? You want to check if any party member, regardless of ID, is in a certain position or just that they exist in general?

Let's say that what I want to achieve is to detect if the Party is empty or if it has any member/actor in the Party (regardless of the ID or Index number of the actor that is in the Party)
Ruby:
class Game_Party
  def any?
    @actors.any?
  end

  def empty?
    @actors.empty?
  end
end

The script calls would be:

Ruby:
$game_party.any?
$game_party.empty?
Ruby:
class Game_Party
  def any?
    @actors.any?
  end

  def empty?
    @actors.empty?
  end
end

The script calls would be:

Ruby:
$game_party.any?
$game_party.empty?
I have tried with the script, but I think it does not work..
Let's say I want a "Conditional Branch" detect that if the player is alone, set a switch to "false" and when there is someone in the Party (any Actor in the Party) the switch changes to "true" (and vice versa) and that when an Actor is removed from the Party and it becomes empty (Party empy), the switch changes to "False"
why is it that people fail to READ?
$game_party.members.collect{|actor| actor.id}.include?(ID)
has people really forgotten how to SCROLL web pages already?


Let's say I want a "Conditional Branch" detect that if the player is alone
Code:
!$game_party.members.collect{|actor| actor.id}.all?{|n| n == ID}
where ID is the ID of the party leader.

the party can never be empty.
the party IS the player.
the party must always have a leader.
if what you want is to check for anyone other than the leader in the party, that's what you use.
ONE line, to be written in the conditional call.
why is it that people fail to READ?

has people really forgotten how to SCROLL web pages already?



Code:
!$game_party.members.collect{|actor| actor.id}.all?{|n| n == ID}
where ID is the ID of the party leader.

the party can never be empty.
the party IS the player.
the party must always have a leader.
if what you want is to check for anyone other than the leader in the party, that's what you use.
ONE line, to be written in the conditional call.
It worked perfectly, thank you very much and sorry for not reading, I've been absent lately

Original thread: https://forums.rpgmakerweb.com/threads/conditional-if-any-party-member-is-in-the-group.155898/