TEST INACTIVE PARTY MEMBER

Posts

Pages: 1
So I am playing around with testing, and guess what, you cannot test an inactive actor with a conditional branch checking if actor is in party. So how do you check if an inactive actor is part of the group?
SunflowerGames
The most beautiful user on RMN!
13323

Can't you make variables for characters?
Then make variables for maps...

There might be a way to check if the character is in the group by checking if they are on the map. There's probably another way to do this too.
Marrend
Guardian of the Description Thread
21781
Is the character physically in the party, but outside of the battle party? It makes a difference with the context of using Conditional Branch.

I'm not going to post the entire thing, but, if you use Conditional Branch, checking to see if a certain actor is in the party, it runs...

when 4  # Actor
  actor = $game_actors[@params[1]]
  if actor
    case @params[2]
    when 0  # in party
      result = ($game_party.members.include?(actor))
    #etc
  end
end


...this code. Digging a bit deeper...

class Game_Party < Game_Unit
  #--------------------------------------------------------------------------
  # * Get Members
  #--------------------------------------------------------------------------
  def members
    in_battle ? battle_members : all_members
  end
  #--------------------------------------------------------------------------
  # * Get All Members
  #--------------------------------------------------------------------------
  def all_members
    @actors.collect {|id| $game_actors[id] }
  end
  #--------------------------------------------------------------------------
  # * Get Battle Members
  #--------------------------------------------------------------------------
  def battle_members
    all_members[0, max_battle_members].select {|actor| actor.exist? }
  end
end


...we can see that $game_party.members returns a different array, based on whither or not the party is in battle. That might be the issue. Going on the theory that you need to check if a person is in the party regardless of that factor...

$game_party.all_members.include?($game_actors[actor_id])


...this should return the result desired, after replacing "actor_id" with the ID of the actor you want to check party-presence for.
author=Marrend
Is the character physically in the party, but outside of the battle party? It makes a difference with the context of using Conditional Branch.

I'm not going to post the entire thing, but, if you use Conditional Branch, checking to see if a certain actor is in the party, it runs...

when 4  # Actor
  actor = $game_actors[@params[1]]
  if actor
    case @params[2]
    when 0  # in party
      result = ($game_party.members.include?(actor))
    #etc
  end
end


...this code. Digging a bit deeper...

class Game_Party < Game_Unit
  #--------------------------------------------------------------------------
  # * Get Members
  #--------------------------------------------------------------------------
  def members
    in_battle ? battle_members : all_members
  end
  #--------------------------------------------------------------------------
  # * Get All Members
  #--------------------------------------------------------------------------
  def all_members
    @actors.collect {|id| $game_actors[id] }
  end
  #--------------------------------------------------------------------------
  # * Get Battle Members
  #--------------------------------------------------------------------------
  def battle_members
    all_members[0, max_battle_members].select {|actor| actor.exist? }
  end
end


...we can see that $game_party.members returns a different array, based on whither or not the party is in battle. That might be the issue. Going on the theory that you need to check if a person is in the party regardless of that factor...

$game_party.all_members.include?($game_actors[actor_id])


...this should return the result desired, after replacing "actor_id" with the ID of the actor you want to check party-presence for.


Very good, Very good, exactly what I was looking for,thanks.
Pages: 1