Is there a party script with this feature?

Started by Vexus, January 06, 2012, 07:12:02 am

Previous topic - Next topic

Vexus

Hi there so I'm looking for a party switch script that let's me make requirements on some characters that can join the group.

Say I got a beast tamer character and I need it so when he's in the party his pet MUST also be in the party or else you can't bring him along (Obviously if you try to add the pet the same thing happens).

And this while a thought it could be a good idea for my game.

When you progress throughout the story or maybe some side quests there will be consequences for what you choose, this could make certain characters in your group hate another party member (With a switch or something to verify which character hates which) resulting in you having to choose one or the other in your team.

I don't know if there is a party script like this but if you know of one that at least has the first point in it I'll gladly use it.

Thanks.
Current Project/s:

Fenriswolf

I don't know about the seconds part, but the first part can easily be evented.
Just use a conditional branch with requiring a certain actor to be in the party.

Quote from: VexusSay I got a beast tamer character and I need it so when he's in the party his pet MUST also be in the party or else you can't bring him along (Obviously if you try to add the pet the same thing happens).


By the way, how do you plan on taking one of either in your party if it requires to have at least one of them in your party already? it's impossibruuu!

Vexus

I'm sure somehow with a script it could be possible to make requirements on having party members just can't find one that has what I need.
Current Project/s:

KK20

Quote from: Fenriswolf on January 06, 2012, 09:36:38 am
By the way, how do you plan on taking one of either in your party if it requires to have at least one of them in your party already? it's impossibruuu!
Easy. Say that the party can only have 4 members at once. If there are 3 members currently in the party, the beast master and the beast are grayed out and cannot be added to the party. If there are 2 members in the party, selecting either the beast master or the beast adds both members in.

For simplicity, you can just have only the beast master as a selectable party member and, when added to the party, another actor (beast) is added as well.

Anyways, onto the actual request, I'm not going to create an entirely new party switch scene. Perhaps if you find a party switch script that you like, I may be able to edit it.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Vexus

January 10, 2012, 06:05:17 pm #4 Last Edit: January 10, 2012, 06:07:41 pm by Vexus
I was going to try this for now:

Spoiler: ShowHide

#===================================
#  Party Changing System by Leon_Westbrooke
#   -v 1.1
#----------------------------------------------------------------------
#  Instructions:  Place above main, but below all other default scripts.

#  Script Call: $scene = Scene_Party_Change.new

#  Features: 
#    -Allows the player to make a party from the minimum to maximum size.
#    -Extra members are limitless.
#    -You can remove a person from the party and put it into reserve using:
#       $game_party.remove_actor_to_party(actor_id)
#    -You can remove a person from the reserve if they exist, and them into
#     the party:
#       $game_party.add_actor_to_party(actor_id)
#    -You can lock a character in reserve or active party by using:
#       $game_party.locked.push(actor_id)
#    -You can set the maximum and minimum number of the party in-game using:
#       $game_party.min_size = x
#       $game_party.max_size = x
#       (NOTE: Do NOT make the max size lower than the minimum size.)
#    -Allows you to use the default add/remove actors command.
#       (NOTE: If you remove an actor with this method, he is gone from both
#              the party and the reserve members.)
#
#  Credits:
#    This setup uses SephirothSpawn's coding to simplify the cursor's position.
#
#
#  Command Quick-list:
#    $game_party.remove_actor_from_party(actor_id)
#      -Removes an actor from the party, and puts them in reserve.
#    $game_party.add_actor_to_party(actor_id)
#      -Replaces the last actor in the party with the actor in reserve.
#    $game_party.locked.push(actor_id)
#      -Locks the actor in place.
#    $game_party.min_size = x
#    $game_party.max_size = x
#      -Sets the minimum and maximum party size.
#
#
#  Notes:
#    This script rewrites these methods from Game_Party:
#      add_actor
#      remove_actor
#===================================

#==================================================
#  Game_Party
#==================================================
class Game_Party

  attr_accessor :party_members
  attr_accessor :move
  attr_accessor :locked
  attr_accessor :min_size
  attr_accessor :max_size
 
  alias leon_partyswitch_gameactor_initialize initialize

  def initialize
    leon_partyswitch_gameactor_initialize
    @party_members = []
    #  Edit :This is to change if an actor is locked or not. To lock them, add
    #        their id to the array below.
    @locked = [1]
    @min_size = 1
    @max_size = 4
  end
 
 
  def add_actor(actor_id)
    actor = $game_actors[actor_id]
    if @actors.size < @max_size
      unless @actors.include?(actor)
        unless @party_members.include?(actor.id)
          @actors.push(actor)
          $game_player.refresh
        end
      end
    else
      unless @party_members.include?(actor.id)
        unless @actors.include?(actor)
          @party_members.push(actor.id)
          $game_player.refresh
        end
      end
    end
  end
 
  def remove_actor(actor_id)
    @actors.delete($game_actors[actor_id])
    @party_members.delete(actor_id)
    $game_player.refresh
  end
 
  def remove_actor_from_party(actor_id)
    if @actors.include?($game_actors[actor_id])
      unless @party_members.include?(actor_id)
        @party_members.push(actor_id)
        @party_members.sort!
      end
    end
        @actors.delete($game_actors[actor_id])
    $game_player.refresh
  end

  def add_actor_to_party(actor_id)
    if @party_members.include?(actor_id)
      if @actors[@max_size - 1] != nil
        @party_members.push(@actors[@max_size - 1].id)
        @actors.delete_at(@max_size - 1)
      end
      @actors.push($game_actors[actor_id])
      @party_members.delete(actor_id)
    end
  end
end
#==================================================
#  END Game_Party
#==================================================

#==============================================================================
# ** Window_Selectable
#==============================================================================
class Window_Selectable < Window_Base
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :cursor_height
  #--------------------------------------------------------------------------
  # * Alias Initialization
  #--------------------------------------------------------------------------
  alias custom_int initialize
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height)
    custom_int(x, y, width, height)
    @cursor_height = 32
  end
  #--------------------------------------------------------------------------
  # * Get Top Row
  #--------------------------------------------------------------------------
  def top_row
    # Divide y-coordinate of window contents transfer origin by 1 row
    # height of @cursor_height
    return self.oy / @cursor_height
  end
  #--------------------------------------------------------------------------
  # * Set Top Row
  # row : row shown on top
  #--------------------------------------------------------------------------
  def top_row=(row)
    # If row is less than 0, change it to 0
    if row < 0
      row = 0
    end
    # If row exceeds row_max - 1, change it to row_max - 1
    if row > row_max - 1
      row = row_max - 1
    end
    # Multiply 1 row height by 32 for y-coordinate of window contents
    # transfer origin
    self.oy = row * @cursor_height
  end
  #--------------------------------------------------------------------------
  # * Get Number of Rows Displayable on 1 Page
  #--------------------------------------------------------------------------
  def page_row_max
    # Subtract a frame height of 32 from the window height, and divide it by
    # 1 row height of @cursor_height
    return (self.height - 32) / @cursor_height
  end
  #--------------------------------------------------------------------------
  # * Update Cursor Rectangle
  #--------------------------------------------------------------------------
  def update_cursor_rect
    # If cursor position is less than 0
    if @index < 0
      self.cursor_rect.empty
      return
    end
    # Get current row
    row = @index / @column_max
    # If current row is before top row
    if row < self.top_row
      # Scroll so that current row becomes top row
      self.top_row = row
    end
    # If current row is more to back than back row
    if row > self.top_row + (self.page_row_max - 1)
      # Scroll so that current row becomes back row
      self.top_row = row - (self.page_row_max - 1)
    end
    # Calculate cursor width
    cursor_width = self.width / @column_max - 32
    # Calculate cursor coordinates
    x = @index % @column_max * (cursor_width + 32)
    y = @index / @column_max * @cursor_height - self.oy
    if self.active == true
      # Update cursor rectangle
      self.cursor_rect.set(x, y, cursor_width, @cursor_height)
    end
  end
end

#==============================================================================
# ** Window_Command
#==============================================================================
class Window_Command < Window_Selectable
  #--------------------------------------------------------------------------
  # * Unisable Item
  # index : item number
  #--------------------------------------------------------------------------
  def undisable_item(index)
    draw_item(index, normal_color)
  end
end
#============================================================


#==================================================
#  Window_Party_Info
#==================================================
class Window_Party_Info < Window_Base
  def initialize
    super(0, 0, 640, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end

  def refresh
    self.contents.clear
    self.contents.draw_text(0, 0, 614, 32, "Please make a party of #{$game_party.min_size.to_s} to #{$game_party.max_size.to_s} members.", 1)
  end
end
#==================================================
#  END Window_Party_Info
#==================================================


#==================================================
#  Window_Party_Slots
#==================================================
class Window_Party_Slots < Window_Selectable

  def initialize
    super(0, 64, 320, 416)
    @item_max = 4
    self.contents = Bitmap.new(width - 32, height - 32)
    self.index = 0
    self.active = true
    refresh
  end
 
  def actors
    if @data[index] != nil
      return @data[index]
    end
  end

  def refresh
    @data = []
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    for i in 0...$game_party.actors.size
      @data.push($game_party.actors[i])
    end
    @item_max = (@data.size + 1)
    if @item_max > 0
      if @item_max > 4
        @item_max = 4
      end
      self.contents = Bitmap.new(width - 32, row_max * 96)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
 
  def draw_item(index)
    @actor = @data[index]
    y = index * 96
    x = 4
    if $game_party.locked.include?(@actor.id)
      self.contents.font.color = disabled_color
      opacity = 128
    else
      self.contents.font.color = normal_color
      opacity = 255
    end
    if @actor != nil
      self.contents.draw_text(x + 100, y, 192, 32, @actor.name)
      draw_actor_hp(@actor, x + 100, y + 32)
      draw_actor_sp(@actor, x + 100, y + 64)
      bitmap = RPG::Cache.character(@actor.character_name, @actor.character_hue)
      cw = bitmap.width / 4
      ch = bitmap.height / 4
      facing = 0
      src_rect = Rect.new(0, facing * ch, cw, ch)
      self.contents.blt(x + 24, y + 32, bitmap, src_rect, opacity)
    end
  end
 
  def update_cursor_rect
    if @index > -1
      x = 0
      y = index * 96
      self.cursor_rect.set(x, y, (self.width - 32), 96)
    else
      self.cursor_rect.empty
    end
  end
 
end
#==================================================
#  END Window_Party_Slots
#==================================================


#==================================================
#  Window_Party_Extras
#==================================================
class Window_Party_Extras < Window_Selectable
  def initialize
    super(320, 64, 320, 416)
    self.cursor_height = 96
    self.contents = Bitmap.new(width - 32, height - 32)
    self.index = -1
    self.active = false
    refresh
  end
 
  def actors
    if @data != nil
      return @data[index]
    end
  end

  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    for i in 0...$game_party.party_members.size
      @data.push($game_actors[$game_party.party_members[i]])
    end
    @data.push(nil)
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 96)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
 
  def draw_item(index)
    @actor = @data[index]
    y = index * 96
    x = 4
    if $game_party.locked.include?(@actor.id)
      self.contents.font.color = disabled_color
      opacity = 128
    else
      self.contents.font.color = normal_color
      opacity = 255
    end
    if @actor != nil
      self.contents.draw_text(x + 100, y, 192, 32, @actor.name)
      draw_actor_hp(@actor, x + 100, y + 32)
      draw_actor_sp(@actor, x + 100, y + 64)
      bitmap = RPG::Cache.character(@actor.character_name, @actor.character_hue)
      cw = bitmap.width / 4
      ch = bitmap.height / 4
      facing = 0
      src_rect = Rect.new(0, facing * ch, cw, ch)
      self.contents.blt(x + 24, y + 32, bitmap, src_rect, opacity)
    end
  end
 
end
#===================================
#  END Window_Party_Extras
#===================================


#===================================
#  Scene_Party_Change
#===================================
class Scene_Party_Change
  def main
   
    @info_window = Window_Party_Info.new
    @slot_window = Window_Party_Slots.new
    @extra_window = Window_Party_Extras.new
   
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
   
    @info_window.dispose
    @slot_window.dispose
    @extra_window.dispose
  end
 
  def update
    @slot_window.update
   
    if @slot_window.active
      update_slot
      return
    end
   
    if @extra_window.active
      update_extra
      return
    end
  end
 
  def update_slot
    if Input.trigger?(Input::B)
      if $game_party.actors.size >= $game_party.min_size and $game_party.actors.size <= $game_party.max_size
        $game_player.refresh
        $game_system.se_play($data_system.cancel_se)
        $scene = Scene_Map.new
      else
        $game_system.se_play($data_system.buzzer_se)
      end
    end
   
    if Input.trigger?(Input::C)
      if $game_party.locked.include?(@slot_window.actors.id) == true
        if @slot_window.index != 0
          $game_system.se_play($data_system.decision_se)
          @slot_window.active = false
          @extra_window.active = true
          @extra_window.index = 0
        else
          $game_system.se_play($data_system.buzzer_se)
        end
      else
        $game_system.se_play($data_system.decision_se)
        @slot_window.active = false
        @extra_window.active = true
        @extra_window.index = 0
      end
    end
  end
 
  def update_extra
    @extra_window.update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @slot_window.active = true
      @extra_window.active = false
      @extra_window.index = -1
    end
   
    if Input.trigger?(Input::C)
      $game_system.se_play($data_system.decision_se)
      if $game_party.locked.include?(@extra_window.actors.id)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      if @extra_window.actors == nil
        if $game_party.actors[@slot_window.index] != nil
          $game_party.party_members.push($game_party.actors[@slot_window.index].id)
          $game_party.remove_actor_from_party($game_party.actors[@slot_window.index].id)
          $game_party.party_members.sort!
          @slot_window.refresh
          @extra_window.refresh
          @slot_window.active = true
          @extra_window.active = false
          @extra_window.index = -1
        else
          @slot_window.active = true
          @extra_window.active = false
          @extra_window.index = -1
        end
      else
        if $game_party.actors[@slot_window.index] != nil
          hold = @extra_window.actors
          $game_party.party_members.push($game_party.actors[@slot_window.index].id)
          $game_party.actors[@slot_window.index] = hold
          $game_party.party_members.delete_at(@extra_window.index)
          $game_party.party_members.sort!
          @slot_window.refresh
          @extra_window.refresh
          @slot_window.active = true
          @extra_window.active = false
          @extra_window.index = -1
        else
          $game_party.actors[@slot_window.index] = @extra_window.actors
          $game_party.party_members.delete_at(@extra_window.index)
          $game_party.party_members.sort!
          @slot_window.refresh
          @extra_window.refresh
          @slot_window.active = true
          @extra_window.active = false
          @extra_window.index = -1
        end
      end
    end
  end
 
end


But another guy on another forum told me a way by conditioning to do it which is:

$game_party.actors.size > 2

Still when I need to remove party members to add others I didn't find a solution yet so if you could really do something that would be awesome.

There are 2 characters that are beast masters in my game and they have different pets (And one later on unlockable from a side quest) hope it's possible to configure it for more than one character/pet.

Thanks.
Current Project/s:

KK20

Tricky thing will be to allow the player to decide which pet will go with the beast master. Current idea is to (within the Party Switch scene) change the right window to only display the pets, forcing the player to choose one of the pets. After selection, the beast master and pet are added to the party.

Selecting the pet will bring up the "pet-only" window edit mentioned above. This may take a while to make.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Vexus

January 10, 2012, 06:56:23 pm #6 Last Edit: January 10, 2012, 06:57:35 pm by Vexus
It would be hard to put in the script say for example character 4 is the beast master and 8 is his pet?

Thanks for helping.

If this fails I'll try the summoning way which still can't happen if the party is full but that way it would be the person's fault not mine.
Current Project/s:

KK20

January 12, 2012, 12:21:43 am #7 Last Edit: January 12, 2012, 12:40:33 am by KK20
Hmmm... I'm not really satisfied with this. It does it's job but...
Party Switch: ShowHide
#===================================
#  Party Changing System by Leon_Westbrooke
#   -v 1.1
#     Edit by KK20
#----------------------------------------------------------------------
#  Instructions:  Place above main, but below all other default scripts.

#  Script Call: $scene = Scene_Party_Change.new

#  Features: 
#    -Allows the player to make a party from the minimum to maximum size.
#    -Extra members are limitless.
#    -You can remove a person from the party and put it into reserve using:
#       $game_party.remove_actor_to_party(actor_id)
#    -You can remove a person from the reserve if they exist, and them into
#     the party:
#       $game_party.add_actor_to_party(actor_id)
#    -You can lock a character in reserve or active party by using:
#       $game_party.locked.push(actor_id)
#    -You can set the maximum and minimum number of the party in-game using:
#       $game_party.min_size = x
#       $game_party.max_size = x
#       (NOTE: Do NOT make the max size lower than the minimum size.)
#    -Allows you to use the default add/remove actors command.
#       (NOTE: If you remove an actor with this method, he is gone from both
#              the party and the reserve members.)
#
#  Credits:
#    This setup uses SephirothSpawn's coding to simplify the cursor's position.
#
#
#  Command Quick-list:
#    $game_party.remove_actor_from_party(actor_id)
#      -Removes an actor from the party, and puts them in reserve.
#    $game_party.add_actor_to_party(actor_id)
#      -Replaces the last actor in the party with the actor in reserve.
#    $game_party.locked.push(actor_id)
#      -Locks the actor in place.
#    $game_party.min_size = x
#    $game_party.max_size = x
#      -Sets the minimum and maximum party size.
#
#
#  Notes:
#    This script rewrites these methods from Game_Party:
#      add_actor
#      remove_actor
#===================================
# KK20 Edit Added Features
#
# - Beastmaster and pets configuration added below
# - You can add or remove pets that are available to the party with the following:
#
#   $game_party.add_pet(id)
#   $game_party.remove_pet(id)
#
#===================================


#==================================================
#  Game_Party
#==================================================
class Game_Party

  attr_accessor :party_members
  attr_accessor :pets
  attr_accessor :move
  attr_accessor :locked
  attr_accessor :min_size
  attr_accessor :max_size
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#         C O N F I G U R E
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  def beastmaster(id)
    case id
    #-------------------------------------------
    # Determine what actor is a beast master and which pets he controls
    #-------------------------------------------
    when 5 then return [12,13,14]
    when 9 then return [10,11] # Actor 9 can control Actors 10 and 11
    #when _ then return [_]
    else
      return []
    end
  end
 
  #-------------------------------------------
  # Which pets you have access to at the beginning of the game
  #-------------------------------------------
  STARTING_PETS = [10,11,12,14]
 
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#         E N D   C O N F I G U R E
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
  alias leon_partyswitch_gameactor_initialize initialize

  def initialize
    leon_partyswitch_gameactor_initialize
    @pets = STARTING_PETS
    @party_members = [3,4,5,6,9]
    #  Edit :This is to change if an actor is locked or not. To lock them, add
    #        their id to the array below.
    @locked = []
    @min_size = 1
    @max_size = 4
  end
 
 
  def add_actor(actor_id)
    actor = $game_actors[actor_id]
    if @actors.size < @max_size
      unless @actors.include?(actor)
        unless @party_members.include?(actor.id)
          @actors.push(actor)
          $game_player.refresh
        end
      end
    else
      unless @party_members.include?(actor.id)
        unless @actors.include?(actor)
          @party_members.push(actor.id)
          $game_player.refresh
        end
      end
    end
  end
 
  def remove_actor(actor_id)
    @actors.delete($game_actors[actor_id])
    @party_members.delete(actor_id)
    $game_player.refresh
  end
 
  def remove_actor_from_party(actor_id)
    if @actors.include?($game_actors[actor_id])
      unless @party_members.include?(actor_id)
        @party_members.push(actor_id)
        @party_members.sort!
      end
    end
        @actors.delete($game_actors[actor_id])
    $game_player.refresh
  end

  def add_actor_to_party(actor_id)
    if @party_members.include?(actor_id)
      if @actors[@max_size - 1] != nil
        @party_members.push(@actors[@max_size - 1].id)
        @actors.delete_at(@max_size - 1)
      end
      @actors.push($game_actors[actor_id])
      @party_members.delete(actor_id)
    end
  end
 
  def add_pet(id)
    return if @pets.include?(id)
    @pets.push(id)
    @pets.sort!
  end
   
  def remove_pet(id)
    return if !@pets.include?(id)
    @pets.delete(id)
  end
 
end
#==================================================
#  END Game_Party
#==================================================

#==============================================================================
# ** Window_Selectable
#==============================================================================
class Window_Selectable < Window_Base
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :cursor_height
  #--------------------------------------------------------------------------
  # * Alias Initialization
  #--------------------------------------------------------------------------
  alias custom_int initialize
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height)
    custom_int(x, y, width, height)
    @cursor_height = 32
  end
  #--------------------------------------------------------------------------
  # * Get Top Row
  #--------------------------------------------------------------------------
  def top_row
    # Divide y-coordinate of window contents transfer origin by 1 row
    # height of @cursor_height
    return self.oy / @cursor_height
  end
  #--------------------------------------------------------------------------
  # * Set Top Row
  # row : row shown on top
  #--------------------------------------------------------------------------
  def top_row=(row)
    # If row is less than 0, change it to 0
    if row < 0
      row = 0
    end
    # If row exceeds row_max - 1, change it to row_max - 1
    if row > row_max - 1
      row = row_max - 1
    end
    # Multiply 1 row height by 32 for y-coordinate of window contents
    # transfer origin
    self.oy = row * @cursor_height
  end
  #--------------------------------------------------------------------------
  # * Get Number of Rows Displayable on 1 Page
  #--------------------------------------------------------------------------
  def page_row_max
    # Subtract a frame height of 32 from the window height, and divide it by
    # 1 row height of @cursor_height
    return (self.height - 32) / @cursor_height
  end
  #--------------------------------------------------------------------------
  # * Update Cursor Rectangle
  #--------------------------------------------------------------------------
  def update_cursor_rect
    # If cursor position is less than 0
    if @index < 0
      self.cursor_rect.empty
      return
    end
    # Get current row
    row = @index / @column_max
    # If current row is before top row
    if row < self.top_row
      # Scroll so that current row becomes top row
      self.top_row = row
    end
    # If current row is more to back than back row
    if row > self.top_row + (self.page_row_max - 1)
      # Scroll so that current row becomes back row
      self.top_row = row - (self.page_row_max - 1)
    end
    # Calculate cursor width
    cursor_width = self.width / @column_max - 32
    # Calculate cursor coordinates
    x = @index % @column_max * (cursor_width + 32)
    y = @index / @column_max * @cursor_height - self.oy
    if self.active == true
      # Update cursor rectangle
      self.cursor_rect.set(x, y, cursor_width, @cursor_height)
    end
  end
end

#==============================================================================
# ** Window_Command
#==============================================================================
class Window_Command < Window_Selectable
  #--------------------------------------------------------------------------
  # * Unisable Item
  # index : item number
  #--------------------------------------------------------------------------
  def undisable_item(index)
    draw_item(index, normal_color)
  end
end
#============================================================


#==================================================
#  Window_Party_Info
#==================================================
class Window_Party_Info < Window_Base
  def initialize
    super(0, 0, 640, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end

  def refresh(pets_list = false)
    self.contents.clear
    if !pets_list
      self.contents.draw_text(0, 0, 614, 32, "Please make a party of #{$game_party.min_size.to_s} to #{$game_party.max_size.to_s} members.", 1)
    else
      self.contents.draw_text(0, 0, 614, 32, "Select which pet to go with the beast tamer.", 1)
    end
  end
end
#==================================================
#  END Window_Party_Info
#==================================================


#==================================================
#  Window_Party_Slots
#==================================================
class Window_Party_Slots < Window_Selectable

  def initialize
    super(0, 64, 320, 416)
    @item_max = 4
    self.contents = Bitmap.new(width - 32, height - 32)
    self.index = 0
    self.active = true
    refresh
  end
 
  def actors
    if @data[index] != nil
      return @data[index]
    end
  end

  def refresh
    @data = []
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    for i in 0...$game_party.actors.size
      @data.push($game_party.actors[i])
    end
    @item_max = (@data.size + 1)
    if @item_max > 0
      if @item_max > 4
        @item_max = 4
      end
      self.contents = Bitmap.new(width - 32, row_max * 96)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
 
  def draw_item(index)
    @actor = @data[index]
    y = index * 96
    x = 4
    if $game_party.locked.include?(@actor.id)
      self.contents.font.color = disabled_color
      opacity = 128
    else
      self.contents.font.color = normal_color
      opacity = 255
    end
    if @actor != nil
      self.contents.draw_text(x + 100, y, 192, 32, @actor.name)
      draw_actor_hp(@actor, x + 100, y + 32)
      draw_actor_sp(@actor, x + 100, y + 64)
      bitmap = RPG::Cache.character(@actor.character_name, @actor.character_hue)
      cw = bitmap.width / 4
      ch = bitmap.height / 4
      facing = 0
      src_rect = Rect.new(0, facing * ch, cw, ch)
      self.contents.blt(x + 24, y + 32, bitmap, src_rect, opacity)
    end
  end
 
  def update_cursor_rect
    if @index > -1
      x = 0
      y = index * 96
      self.cursor_rect.set(x, y, (self.width - 32), 96)
    else
      self.cursor_rect.empty
    end
  end
 
end
#==================================================
#  END Window_Party_Slots
#==================================================


#==================================================
#  Window_Party_Extras
#==================================================
class Window_Party_Extras < Window_Selectable
  def initialize
    super(320, 64, 320, 416)
    self.cursor_height = 96
    self.contents = Bitmap.new(width - 32, height - 32)
    self.index = -1
    self.active = false
    refresh
  end
 
  def actors
    if @data != nil
      return @data[index]
    end
  end

  def refresh(type = "actor", id = 0)
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
   
    # Original refresh method
    if type == "actor" and id == 0
      for i in 0...$game_party.party_members.size
        @data.push($game_actors[$game_party.party_members[i]])
      end
      @data.push(nil)
    #Editted refresh method
    else
      # Called when swapping pets
      if type == "pet"
        pet_list = []
        # Determine which beastmaster this pet belongs to
        $game_party.actors.each{|actor|
          if $game_party.beastmaster(actor.id).include?(id)
            pet_list = $game_party.beastmaster(actor.id)
            break
          end
        }
      # Called when adding a beastmaster to party
      else
        pet_list = $game_party.beastmaster(id)
      end
      # List all pets that can be swapped with this one
      pet_list.each{|pet|
        # Skip this pet if it's already in the party
        next if pet == id
        @data.push($game_actors[pet]) if $game_party.pets.include?(pet)
      }
    end
     
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 96)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
 
  def draw_item(index)
    @actor = @data[index]
    y = index * 96
    x = 4
    if $game_party.locked.include?(@actor.id) or
      ($game_party.beastmaster(@actor.id) != [] and $game_party.actors.size >= $game_party.max_size - 1)
      self.contents.font.color = disabled_color
      opacity = 128
    else
      self.contents.font.color = normal_color
      opacity = 255
    end
    if @actor != nil
      self.contents.draw_text(x + 100, y, 192, 32, @actor.name)
      draw_actor_hp(@actor, x + 100, y + 32)
      draw_actor_sp(@actor, x + 100, y + 64)
      bitmap = RPG::Cache.character(@actor.character_name, @actor.character_hue)
      cw = bitmap.width / 4
      ch = bitmap.height / 4
      facing = 0
      src_rect = Rect.new(0, facing * ch, cw, ch)
      self.contents.blt(x + 24, y + 32, bitmap, src_rect, opacity)
    end
  end
 
end
#===================================
#  END Window_Party_Extras
#===================================


#===================================
#  Scene_Party_Change
#===================================
class Scene_Party_Change
  def main
   
    @info_window = Window_Party_Info.new
    @slot_window = Window_Party_Slots.new
    @extra_window = Window_Party_Extras.new
    @pet_list_active = false
    @beastmaster = nil
   
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
   
    @info_window.dispose
    @slot_window.dispose
    @extra_window.dispose
  end
#---------------------------------------------
  def is_beastmaster(actor)
    return true if $game_party.beastmaster(actor.id) != []
    return false
  end
 
#---------------------------------------------   
  def can_swap_pets(id)
    pet_list = []
    # Determine which beastmaster this pet belongs to
    $game_party.actors.each{|actor|
      if $game_party.beastmaster(actor.id).include?(id)
        pet_list = $game_party.beastmaster(actor.id)
          break
      end
    }
    pet_list.each{|pet|
      # Skip this pet if it's already in the party
      next if pet == id
      return true if $game_party.pets.include?(pet)
    }
    return false
  end
#---------------------------------------------   
  def remove_beastmaster_pet(actor_id)
    pets = $game_party.beastmaster(actor_id)
    $game_party.actors.each{|actor|
      $game_party.actors.delete(actor) if pets.include?(actor.id)
    }
  end
#---------------------------------------------   
  def update
    @slot_window.update
   
    if @slot_window.active
      update_slot
      return
    end
   
    if @extra_window.active
      if !@pet_list_active
        update_extra
      else
        update_pets
      end
      return
    end
  end
#---------------------------------------------   
  def update_slot
    if Input.trigger?(Input::B)
      if $game_party.actors.size >= $game_party.min_size and $game_party.actors.size <= $game_party.max_size
        $game_player.refresh
        $game_system.se_play($data_system.cancel_se)
        $scene = Scene_Map.new
      else
        $game_system.se_play($data_system.buzzer_se)
      end
    end
   
    if Input.trigger?(Input::C)
      if $game_party.locked.include?(@slot_window.actors.id) == true
        if @slot_window.index != 0
          $game_system.se_play($data_system.decision_se)
          @slot_window.active = false
          @extra_window.active = true
          @extra_window.index = 0
        else
          $game_system.se_play($data_system.buzzer_se)
        end
      else
        if $game_party.pets.include?(@slot_window.actors.id)
          if can_swap_pets(@slot_window.actors.id)
            @extra_window.refresh("pet", @slot_window.actors.id)
            @info_window.refresh(true)
            @pet_list_active = true
          else
            $game_system.se_play($data_system.buzzer_se)
            return
          end
        end
        $game_system.se_play($data_system.decision_se)
        @slot_window.active = false
        @extra_window.active = true
        @extra_window.index = 0
      end
    end
  end
#--------------------------------------------- 
  def update_extra
    @extra_window.update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @extra_window.index = 0
      @extra_window.refresh
      @slot_window.active = true
      @extra_window.active = false
      @extra_window.index = -1
      @info_window.refresh
      return
    end
   
    if Input.trigger?(Input::C)
      if $game_party.locked.include?(@extra_window.actors.id) or
      ($game_party.beastmaster(@extra_window.actors.id) != [] and $game_party.actors.size >= $game_party.max_size - 1)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      $game_system.se_play($data_system.decision_se)
      # If the player selected an empty spot in EXTRAs
      if @extra_window.actors == nil
        # The player is planning to remove this party member
        if $game_party.actors[@slot_window.index] != nil
          $game_party.party_members.push($game_party.actors[@slot_window.index].id)
          ### If the actor being removed is a beast master
          if is_beastmaster($game_party.actors[@slot_window.index])
          # If true, then remove the associated pet
            remove_beastmaster_pet($game_party.actors[@slot_window.index].id)
          end
          $game_party.remove_actor_from_party($game_party.actors[@slot_window.index].id)
          $game_party.party_members.sort!
          @slot_window.refresh
          @extra_window.refresh
        end
        @slot_window.active = true
        @extra_window.active = false
        @extra_window.index = -1
      # If player selected an actual actor in EXTRAs
      else
        # If added party member is a beastmaster
        if $game_party.beastmaster(@extra_window.actors.id) != []
          @beastmaster = @extra_window.actors
          @beastmaster_index = @extra_window.index
          @extra_window.refresh("actor", @extra_window.actors.id)
          @extra_window.index = 0
          @info_window.refresh(true)
          @pet_list_active = true
          return
        # Added party member is not a beastmaster
        else
          # If swapping party members (A <-> B). Otherwise, skip this part.
          if $game_party.actors[@slot_window.index] != nil
            $game_party.party_members.push($game_party.actors[@slot_window.index].id)
            ### If the actor being removed is a beast master
            if is_beastmaster($game_party.actors[@slot_window.index])
            # If true, then remove the associated pet
              remove_beastmaster_pet($game_party.actors[@slot_window.index].id)
            end
           
          end
          $game_party.actors[@slot_window.index] = @extra_window.actors
          $game_party.party_members.delete_at(@extra_window.index)
          $game_party.party_members.sort!
          @slot_window.refresh
          @extra_window.refresh
          @slot_window.active = true
          @extra_window.active = false
          @extra_window.index = -1
        end
      end
    end
  end
#---------------------------------------------   
  def update_pets
    @extra_window.update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @extra_window.index = 0
      @extra_window.refresh
      @slot_window.active = true
      @extra_window.active = false
      @extra_window.index = -1
      @pet_list_active = false
      @info_window.refresh
    end
   
    if Input.trigger?(Input::C)
      if $game_party.locked.include?(@extra_window.actors.id)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      $game_system.se_play($data_system.decision_se)
      # If the player selected an empty spot in EXTRAs
      if @extra_window.actors == nil
       #IMPOSSIBLE--The beastmaster needs a pet! You can't remove the pet from party!
      else
        @pet_list_active = false
        # Put the party member back into the extras, unless they are a pet
        if $game_party.actors[@slot_window.index] and !$game_party.pets.include?($game_party.actors[@slot_window.index].id)
          $game_party.party_members.push($game_party.actors[@slot_window.index].id)
          ### If the actor being removed is a beast master
          if is_beastmaster($game_party.actors[@slot_window.index])
          # If true, then remove the associated pet
            remove_beastmaster_pet($game_party.actors[@slot_window.index].id)
          end
        end
        # If the player added a beastmaster
        if @beastmaster != nil
          # Add beastmaster
          $game_party.actors[@slot_window.index] = @beastmaster
          @beastmaster = nil
          # Add the pet
          $game_party.actors.push(@extra_window.actors)
          # Remove the beastmaster from the extras
          $game_party.party_members.delete_at(@beastmaster_index)
          $game_party.party_members.sort!
          @slot_window.refresh
          @extra_window.refresh
          @slot_window.active = true
          @extra_window.active = false
          @extra_window.index = -1
        # Swapping monsters
        else
          # If swapping party members (A <-> B). Otherwise, skip this part.
          $game_party.actors[@slot_window.index] = @extra_window.actors
          @slot_window.refresh
          @extra_window.refresh
          @slot_window.active = true
          @extra_window.active = false
          @extra_window.index = -1
        end
     
      end
      @info_window.refresh
    end
  end
#---------------------------------------------
end
- Didn't try it with a party size bigger than 4
- Can't have two beast masters control same pets
- Configuration and some small notes I wrote in script

I, personally, don't like the "feel" of this party switch system. Feels...raw. :\

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Vexus

First of all thanks for helping me but it's not working well since if you try to remove a member from party you can no longer add any member when you call the party switch script.

Couldn't try it as I couldn't try add them back when I put them in reserve.
Current Project/s:

KK20

January 12, 2012, 11:25:37 pm #9 Last Edit: January 12, 2012, 11:29:37 pm by KK20
Quote from: Author's Notes#    -Allows you to use the default add/remove actors command.
#       (NOTE: If you remove an actor with this method, he is gone from both
#              the party and the reserve members.)
You can't use the default event command "Remove Party Member" or else that party member is GONE--both in your current party and in your reserve.

Instead, use this method:
$game_party.remove_actor_from_party(actor_id)


If that's not what you were talking about, please clarify what you did to get the error.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Vexus

I call the party script ingame in which you can put your members in reserve in other words put them on the right box but when you try to press the button on an empty slot in your party it gives the cancel sound but there are members in the reserve slot so I should be able to move them back in party.

Also this happens only with your edit without it I can freely add party members from reserve if I put them in reserve.
Current Project/s:

KK20

I just tested it some more and still couldn't come up with what you got.

1.) How big can the party be?
2.) How many actors start in your party? How many start in your reserve?
3.) Did you CONFIGURE the actors within the script to your specifications?

While testing, I ran along a small bug irrelevant to your current issue.
Party Switch: ShowHide
#===================================
#  Party Changing System by Leon_Westbrooke
#   -v 1.1
#     Edit by KK20
#----------------------------------------------------------------------
#  Instructions:  Place above main, but below all other default scripts.

#  Script Call: $scene = Scene_Party_Change.new

#  Features: 
#    -Allows the player to make a party from the minimum to maximum size.
#    -Extra members are limitless.
#    -You can remove a person from the party and put it into reserve using:
#       $game_party.remove_actor_to_party(actor_id)
#    -You can remove a person from the reserve if they exist, and them into
#     the party:
#       $game_party.add_actor_to_party(actor_id)
#    -You can lock a character in reserve or active party by using:
#       $game_party.locked.push(actor_id)
#    -You can set the maximum and minimum number of the party in-game using:
#       $game_party.min_size = x
#       $game_party.max_size = x
#       (NOTE: Do NOT make the max size lower than the minimum size.)
#    -Allows you to use the default add/remove actors command.
#       (NOTE: If you remove an actor with this method, he is gone from both
#              the party and the reserve members.)
#
#  Credits:
#    This setup uses SephirothSpawn's coding to simplify the cursor's position.
#
#
#  Command Quick-list:
#    $game_party.remove_actor_from_party(actor_id)
#      -Removes an actor from the party, and puts them in reserve.
#    $game_party.add_actor_to_party(actor_id)
#      -Replaces the last actor in the party with the actor in reserve.
#    $game_party.locked.push(actor_id)
#      -Locks the actor in place.
#    $game_party.min_size = x
#    $game_party.max_size = x
#      -Sets the minimum and maximum party size.
#
#
#  Notes:
#    This script rewrites these methods from Game_Party:
#      add_actor
#      remove_actor
#===================================
# KK20 Edit Added Features
#
# - Beastmaster and pets configuration added below
# - You can add or remove pets that are available to the party with the following:
#
#   $game_party.add_pet(id)
#   $game_party.remove_pet(id)
#
#===================================


#==================================================
#  Game_Party
#==================================================
class Game_Party

  attr_accessor :party_members
  attr_accessor :pets
  attr_accessor :move
  attr_accessor :locked
  attr_accessor :min_size
  attr_accessor :max_size
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#         C O N F I G U R E
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  def beastmaster(id)
    case id
    #-------------------------------------------
    # Determine what actor is a beast master and which pets he controls
    #-------------------------------------------
    when 5 then return [12,13,14]
    when 9 then return [10,11] # Actor 9 can control Actors 10 and 11
    #when _ then return [_]
    else
      return []
    end
  end
 
  #-------------------------------------------
  # Which pets you have access to at the beginning of the game
  #-------------------------------------------
  STARTING_PETS = [10,11,12,14]
 
  #-------------------------------------------
  # Which actors you have access to at the beginning of the game
  #-------------------------------------------
  STARTING_PARTY = [3,5,10]
 
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#         E N D   C O N F I G U R E
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
  alias leon_partyswitch_gameactor_initialize initialize

  def initialize
    leon_partyswitch_gameactor_initialize
    @pets = STARTING_PETS
    @party_members = STARTING_PARTY
    #  Edit :This is to change if an actor is locked or not. To lock them, add
    #        their id to the array below.
    @locked = []
    @min_size = 1
    @max_size = 4
  end
 
 
  def add_actor(actor_id)
    actor = $game_actors[actor_id]
    if @actors.size < @max_size
      unless @actors.include?(actor)
        unless @party_members.include?(actor.id)
          @actors.push(actor)
          $game_player.refresh
        end
      end
    else
      unless @party_members.include?(actor.id)
        unless @actors.include?(actor)
          @party_members.push(actor.id)
          $game_player.refresh
        end
      end
    end
  end
 
  def remove_actor(actor_id)
    @actors.delete($game_actors[actor_id])
    @party_members.delete(actor_id)
    $game_player.refresh
  end
 
  def remove_actor_from_party(actor_id)
    if @actors.include?($game_actors[actor_id])
      unless @party_members.include?(actor_id)
        @party_members.push(actor_id)
        @party_members.sort!
      end
    end
        @actors.delete($game_actors[actor_id])
    $game_player.refresh
  end

  def add_actor_to_party(actor_id)
    if @party_members.include?(actor_id)
      if @actors[@max_size - 1] != nil
        @party_members.push(@actors[@max_size - 1].id)
        @actors.delete_at(@max_size - 1)
      end
      @actors.push($game_actors[actor_id])
      @party_members.delete(actor_id)
    end
  end
 
  def add_pet(id)
    return if @pets.include?(id)
    @pets.push(id)
    @pets.sort!
  end
   
  def remove_pet(id)
    return if !@pets.include?(id)
    @pets.delete(id)
  end
 
end
#==================================================
#  END Game_Party
#==================================================

#==============================================================================
# ** Window_Selectable
#==============================================================================
class Window_Selectable < Window_Base
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :cursor_height
  #--------------------------------------------------------------------------
  # * Alias Initialization
  #--------------------------------------------------------------------------
  alias custom_int initialize
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height)
    custom_int(x, y, width, height)
    @cursor_height = 32
  end
  #--------------------------------------------------------------------------
  # * Get Top Row
  #--------------------------------------------------------------------------
  def top_row
    # Divide y-coordinate of window contents transfer origin by 1 row
    # height of @cursor_height
    return self.oy / @cursor_height
  end
  #--------------------------------------------------------------------------
  # * Set Top Row
  # row : row shown on top
  #--------------------------------------------------------------------------
  def top_row=(row)
    # If row is less than 0, change it to 0
    if row < 0
      row = 0
    end
    # If row exceeds row_max - 1, change it to row_max - 1
    if row > row_max - 1
      row = row_max - 1
    end
    # Multiply 1 row height by 32 for y-coordinate of window contents
    # transfer origin
    self.oy = row * @cursor_height
  end
  #--------------------------------------------------------------------------
  # * Get Number of Rows Displayable on 1 Page
  #--------------------------------------------------------------------------
  def page_row_max
    # Subtract a frame height of 32 from the window height, and divide it by
    # 1 row height of @cursor_height
    return (self.height - 32) / @cursor_height
  end
  #--------------------------------------------------------------------------
  # * Update Cursor Rectangle
  #--------------------------------------------------------------------------
  def update_cursor_rect
    # If cursor position is less than 0
    if @index < 0
      self.cursor_rect.empty
      return
    end
    # Get current row
    row = @index / @column_max
    # If current row is before top row
    if row < self.top_row
      # Scroll so that current row becomes top row
      self.top_row = row
    end
    # If current row is more to back than back row
    if row > self.top_row + (self.page_row_max - 1)
      # Scroll so that current row becomes back row
      self.top_row = row - (self.page_row_max - 1)
    end
    # Calculate cursor width
    cursor_width = self.width / @column_max - 32
    # Calculate cursor coordinates
    x = @index % @column_max * (cursor_width + 32)
    y = @index / @column_max * @cursor_height - self.oy
    if self.active == true
      # Update cursor rectangle
      self.cursor_rect.set(x, y, cursor_width, @cursor_height)
    end
  end
end

#==============================================================================
# ** Window_Command
#==============================================================================
class Window_Command < Window_Selectable
  #--------------------------------------------------------------------------
  # * Unisable Item
  # index : item number
  #--------------------------------------------------------------------------
  def undisable_item(index)
    draw_item(index, normal_color)
  end
end
#============================================================


#==================================================
#  Window_Party_Info
#==================================================
class Window_Party_Info < Window_Base
  def initialize
    super(0, 0, 640, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end

  def refresh(pets_list = false)
    self.contents.clear
    if !pets_list
      self.contents.draw_text(0, 0, 614, 32, "Please make a party of #{$game_party.min_size.to_s} to #{$game_party.max_size.to_s} members.", 1)
    else
      self.contents.draw_text(0, 0, 614, 32, "Select which pet to go with the beast tamer.", 1)
    end
  end
end
#==================================================
#  END Window_Party_Info
#==================================================


#==================================================
#  Window_Party_Slots
#==================================================
class Window_Party_Slots < Window_Selectable

  def initialize
    super(0, 64, 320, 416)
    @item_max = 4
    self.contents = Bitmap.new(width - 32, height - 32)
    self.index = 0
    self.active = true
    refresh
  end
 
  def actors
    if @data[index] != nil
      return @data[index]
    end
  end

  def refresh
    @data = []
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    for i in 0...$game_party.actors.size
      @data.push($game_party.actors[i])
    end
    @item_max = (@data.size + 1)
    if @item_max > 0
      if @item_max > 4
        @item_max = 4
      end
      self.contents = Bitmap.new(width - 32, row_max * 96)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
 
  def draw_item(index)
    @actor = @data[index]
    y = index * 96
    x = 4
    if $game_party.locked.include?(@actor.id)
      self.contents.font.color = disabled_color
      opacity = 128
    else
      self.contents.font.color = normal_color
      opacity = 255
    end
    if @actor != nil
      self.contents.draw_text(x + 100, y, 192, 32, @actor.name)
      draw_actor_hp(@actor, x + 100, y + 32)
      draw_actor_sp(@actor, x + 100, y + 64)
      bitmap = RPG::Cache.character(@actor.character_name, @actor.character_hue)
      cw = bitmap.width / 4
      ch = bitmap.height / 4
      facing = 0
      src_rect = Rect.new(0, facing * ch, cw, ch)
      self.contents.blt(x + 24, y + 32, bitmap, src_rect, opacity)
    end
  end
 
  def update_cursor_rect
    if @index > -1
      x = 0
      y = index * 96
      self.cursor_rect.set(x, y, (self.width - 32), 96)
    else
      self.cursor_rect.empty
    end
  end
 
end
#==================================================
#  END Window_Party_Slots
#==================================================


#==================================================
#  Window_Party_Extras
#==================================================
class Window_Party_Extras < Window_Selectable
  def initialize
    super(320, 64, 320, 416)
    self.cursor_height = 96
    self.contents = Bitmap.new(width - 32, height - 32)
    self.index = -1
    self.active = false
    refresh
  end
 
  def actors
    if @data != nil
      return @data[index]
    end
  end

  def refresh(type = "actor", id = 0)
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
   
    # Original refresh method
    if type == "actor" and id == 0
      for i in 0...$game_party.party_members.size
        @data.push($game_actors[$game_party.party_members[i]])
      end
      @data.push(nil)
    #Editted refresh method
    else
      # Called when swapping pets
      if type == "pet"
        pet_list = []
        # Determine which beastmaster this pet belongs to
        $game_party.actors.each{|actor|
          if $game_party.beastmaster(actor.id).include?(id)
            pet_list = $game_party.beastmaster(actor.id)
            break
          end
        }
      # Called when adding a beastmaster to party
      else
        pet_list = $game_party.beastmaster(id)
      end
      # List all pets that can be swapped with this one
      pet_list.each{|pet|
        # Skip this pet if it's already in the party
        next if pet == id
        @data.push($game_actors[pet]) if ($game_party.pets.include?(pet) and $game_actors[pet] != nil)
      }
    end
     
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 96)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
 
  def draw_item(index)
    @actor = @data[index]
    y = index * 96
    x = 4
    if $game_party.locked.include?(@actor.id) or
      ($game_party.beastmaster(@actor.id) != [] and $game_party.actors.size >= $game_party.max_size - 1)
      self.contents.font.color = disabled_color
      opacity = 128
    else
      self.contents.font.color = normal_color
      opacity = 255
    end
    if @actor != nil
      self.contents.draw_text(x + 100, y, 192, 32, @actor.name)
      draw_actor_hp(@actor, x + 100, y + 32)
      draw_actor_sp(@actor, x + 100, y + 64)
      bitmap = RPG::Cache.character(@actor.character_name, @actor.character_hue)
      cw = bitmap.width / 4
      ch = bitmap.height / 4
      facing = 0
      src_rect = Rect.new(0, facing * ch, cw, ch)
      self.contents.blt(x + 24, y + 32, bitmap, src_rect, opacity)
    end
  end
 
end
#===================================
#  END Window_Party_Extras
#===================================


#===================================
#  Scene_Party_Change
#===================================
class Scene_Party_Change
  def main
   
    @info_window = Window_Party_Info.new
    @slot_window = Window_Party_Slots.new
    @extra_window = Window_Party_Extras.new
    @pet_list_active = false
    @beastmaster = nil
   
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
   
    @info_window.dispose
    @slot_window.dispose
    @extra_window.dispose
  end
#---------------------------------------------
  def is_beastmaster(actor)
    return true if $game_party.beastmaster(actor.id) != []
    return false
  end
 
#---------------------------------------------   
  def can_swap_pets(id)
    pet_list = []
    # Determine which beastmaster this pet belongs to
    $game_party.actors.each{|actor|
      if $game_party.beastmaster(actor.id).include?(id)
        pet_list = $game_party.beastmaster(actor.id)
          break
      end
    }
    pet_list.each{|pet|
      # Skip this pet if it's already in the party
      next if pet == id
      return true if ($game_party.pets.include?(pet) and $game_actors[pet] != nil)
    }
    return false
  end
#---------------------------------------------   
  def remove_beastmaster_pet(actor_id)
    pets = $game_party.beastmaster(actor_id)
    $game_party.actors.each{|actor|
      $game_party.actors.delete(actor) if pets.include?(actor.id)
    }
  end
#---------------------------------------------   
  def update
    @slot_window.update
   
    if @slot_window.active
      update_slot
      return
    end
   
    if @extra_window.active
      if !@pet_list_active
        update_extra
      else
        update_pets
      end
      return
    end
  end
#---------------------------------------------   
  def update_slot
    if Input.trigger?(Input::B)
      if $game_party.actors.size >= $game_party.min_size and $game_party.actors.size <= $game_party.max_size
        $game_player.refresh
        $game_system.se_play($data_system.cancel_se)
        $scene = Scene_Map.new
      else
        $game_system.se_play($data_system.buzzer_se)
      end
    end
   
    if Input.trigger?(Input::C)
      if $game_party.locked.include?(@slot_window.actors.id) == true
        if @slot_window.index != 0
          $game_system.se_play($data_system.decision_se)
          @slot_window.active = false
          @extra_window.active = true
          @extra_window.index = 0
        else
          $game_system.se_play($data_system.buzzer_se)
        end
      else
        if $game_party.pets.include?(@slot_window.actors.id)
          if can_swap_pets(@slot_window.actors.id)
            @extra_window.refresh("pet", @slot_window.actors.id)
            @info_window.refresh(true)
            @pet_list_active = true
          else
            $game_system.se_play($data_system.buzzer_se)
            return
          end
        end
        $game_system.se_play($data_system.decision_se)
        @slot_window.active = false
        @extra_window.active = true
        @extra_window.index = 0
      end
    end
  end
#--------------------------------------------- 
  def update_extra
    @extra_window.update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @extra_window.index = 0
      @extra_window.refresh
      @slot_window.active = true
      @extra_window.active = false
      @extra_window.index = -1
      @info_window.refresh
      return
    end
   
    if Input.trigger?(Input::C)
      if $game_party.locked.include?(@extra_window.actors.id) or
      ($game_party.beastmaster(@extra_window.actors.id) != [] and $game_party.actors.size >= $game_party.max_size - 1)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      $game_system.se_play($data_system.decision_se)
      # If the player selected an empty spot in EXTRAs
      if @extra_window.actors == nil
        # The player is planning to remove this party member
        if $game_party.actors[@slot_window.index] != nil
          $game_party.party_members.push($game_party.actors[@slot_window.index].id)
          ### If the actor being removed is a beast master
          if is_beastmaster($game_party.actors[@slot_window.index])
          # If true, then remove the associated pet
            remove_beastmaster_pet($game_party.actors[@slot_window.index].id)
          end
          $game_party.remove_actor_from_party($game_party.actors[@slot_window.index].id)
          $game_party.party_members.sort!
          @slot_window.refresh
          @extra_window.refresh
        end
        @slot_window.active = true
        @extra_window.active = false
        @extra_window.index = -1
      # If player selected an actual actor in EXTRAs
      else
        # If added party member is a beastmaster
        if $game_party.beastmaster(@extra_window.actors.id) != []
          @beastmaster = @extra_window.actors
          @beastmaster_index = @extra_window.index
          @extra_window.refresh("actor", @extra_window.actors.id)
          @extra_window.index = 0
          @info_window.refresh(true)
          @pet_list_active = true
          return
        # Added party member is not a beastmaster
        else
          # If swapping party members (A <-> B). Otherwise, skip this part.
          if $game_party.actors[@slot_window.index] != nil
            $game_party.party_members.push($game_party.actors[@slot_window.index].id)
            ### If the actor being removed is a beast master
            if is_beastmaster($game_party.actors[@slot_window.index])
            # If true, then remove the associated pet
              remove_beastmaster_pet($game_party.actors[@slot_window.index].id)
            end
           
          end
          $game_party.actors[@slot_window.index] = @extra_window.actors
          $game_party.party_members.delete_at(@extra_window.index)
          $game_party.party_members.sort!
          @slot_window.refresh
          @extra_window.refresh
          @slot_window.active = true
          @extra_window.active = false
          @extra_window.index = -1
        end
      end
    end
  end
#---------------------------------------------   
  def update_pets
    @extra_window.update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @extra_window.index = 0
      @extra_window.refresh
      @slot_window.active = true
      @extra_window.active = false
      @extra_window.index = -1
      @pet_list_active = false
      @info_window.refresh
    end
   
    if Input.trigger?(Input::C)
      if $game_party.locked.include?(@extra_window.actors.id)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      $game_system.se_play($data_system.decision_se)
      # If the player selected an empty spot in EXTRAs
      if @extra_window.actors == nil
       #IMPOSSIBLE--The beastmaster needs a pet! You can't remove the pet from party!
      else
        @pet_list_active = false
        # Put the party member back into the extras, unless they are a pet
        if $game_party.actors[@slot_window.index] and !$game_party.pets.include?($game_party.actors[@slot_window.index].id)
          $game_party.party_members.push($game_party.actors[@slot_window.index].id)
          ### If the actor being removed is a beast master
          if is_beastmaster($game_party.actors[@slot_window.index])
          # If true, then remove the associated pet
            remove_beastmaster_pet($game_party.actors[@slot_window.index].id)
          end
        end
        # If the player added a beastmaster
        if @beastmaster != nil
          # Add beastmaster
          $game_party.actors[@slot_window.index] = @beastmaster
          @beastmaster = nil
          # Add the pet
          $game_party.actors.push(@extra_window.actors)
          # Remove the beastmaster from the extras
          $game_party.party_members.delete_at(@beastmaster_index)
          $game_party.party_members.sort!
          @slot_window.refresh
          @extra_window.refresh
          @slot_window.active = true
          @extra_window.active = false
          @extra_window.index = -1
        # Swapping monsters
        else
          # If swapping party members (A <-> B). Otherwise, skip this part.
          $game_party.actors[@slot_window.index] = @extra_window.actors
          @slot_window.refresh
          @extra_window.refresh
          @slot_window.active = true
          @extra_window.active = false
          @extra_window.index = -1
        end
     
      end
      @info_window.refresh
    end
  end
#---------------------------------------------
end

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Vexus

January 13, 2012, 06:46:19 pm #12 Last Edit: January 13, 2012, 06:53:31 pm by Vexus
Quote from: KK20 on January 13, 2012, 01:25:44 pm
I just tested it some more and still couldn't come up with what you got.

1.) How big can the party be?
2.) How many actors start in your party? How many start in your reserve?
3.) Did you CONFIGURE the actors within the script to your specifications?



1) Party size is 4.
2) You start alone but to test it I tried adding them via an event on map with add party member.
3) Yes I did. The problem only occurs when I enter the ids of the pets in the part of the script:
STARTING_PETS = []

If I enter the values there I can't add people from reserve from the party switch screen. If I try adding the pets via an event (party add) instead of writing them in the script and go to try adding the beast tamer guy you get to choose which pet is his but the window is empty. (Tough you can still add the pets from the list of players as they show as party members. if added via party add event)

Current Project/s:

KK20

I'm still not getting any errors. This has me believing that either you didn't configure properly or you have another script that is somehow creating conflicts (most likely not the case).

Also, to add pets to the party, use the script call I created: $game_party.add_pet(id)
Don't use the event method "Change Party Members".

I request a demo to look into this further.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Vexus

January 14, 2012, 07:33:37 am #14 Last Edit: January 14, 2012, 07:47:13 am by Vexus
Still got the same problem.

I tried even on a new game just to see if it's maybe a conflict between another script but still same thing happened.

Here a demo:

http://www.megaupload.com/?d=F1HISTKZ

Now just to be clear starting pet and party are empty on mine because you start only with your actor in party.

In the demo I made the same thing I'm trying on my game.

NPC on the left adds party members into your party and the one on the right calls the party switch screen. Then remove every member in your party putting it in reserve and try adding them again you'll probably get the cancel sound like I did which doesn't let you add anyone.

The problem only occurs if you either add the ids on starting pets or adding pets via the event too so it has something to do with the pet part in the script.

[Edit]

Ops I forgot to change the ids in the demo of the beast tamers in the script so try add them on some random members.
Current Project/s:

KK20

That took a while to find, but it is also something I would never have expected. The empty slot in the left-side box is considered a "nil" object. However, in my script, I ask for the actor's ID at whatever index the player's cursor is at. It just so happens that "nil.id" equals 4. And you made it where one of the pets is actor 4--thus the clash.

I read this just to figure out why:
http://blog.bigbinary.com/2008/06/23/why-the-id-of-nil-is-4-in-ruby.html

Anyways, I editted it.
Spoiler: ShowHide
#===================================
#  Party Changing System by Leon_Westbrooke
#   -v 1.1
#     Edit by KK20
#----------------------------------------------------------------------
#  Instructions:  Place above main, but below all other default scripts.

#  Script Call: $scene = Scene_Party_Change.new

#  Features: 
#    -Allows the player to make a party from the minimum to maximum size.
#    -Extra members are limitless.
#    -You can remove a person from the party and put it into reserve using:
#       $game_party.remove_actor_to_party(actor_id)
#    -You can remove a person from the reserve if they exist, and them into
#     the party:
#       $game_party.add_actor_to_party(actor_id)
#    -You can lock a character in reserve or active party by using:
#       $game_party.locked.push(actor_id)
#    -You can set the maximum and minimum number of the party in-game using:
#       $game_party.min_size = x
#       $game_party.max_size = x
#       (NOTE: Do NOT make the max size lower than the minimum size.)
#    -Allows you to use the default add/remove actors command.
#       (NOTE: If you remove an actor with this method, he is gone from both
#              the party and the reserve members.)
#
#  Credits:
#    This setup uses SephirothSpawn's coding to simplify the cursor's position.
#
#
#  Command Quick-list:
#    $game_party.remove_actor_from_party(actor_id)
#      -Removes an actor from the party, and puts them in reserve.
#    $game_party.add_actor_to_party(actor_id)
#      -Replaces the last actor in the party with the actor in reserve.
#    $game_party.locked.push(actor_id)
#      -Locks the actor in place.
#    $game_party.min_size = x
#    $game_party.max_size = x
#      -Sets the minimum and maximum party size.
#
#
#  Notes:
#    This script rewrites these methods from Game_Party:
#      add_actor
#      remove_actor
#===================================
# KK20 Edit Added Features
#
# - Beastmaster and pets configuration added below
# - You can add or remove pets that are available to the party with the following:
#
#   $game_party.add_pet(id)
#   $game_party.remove_pet(id)
#
#===================================


#==================================================
#  Game_Party
#==================================================
class Game_Party

  attr_accessor :party_members
  attr_accessor :pets
  attr_accessor :move
  attr_accessor :locked
  attr_accessor :min_size
  attr_accessor :max_size
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#         C O N F I G U R E
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  def beastmaster(id)
    case id
    #-------------------------------------------
    # Determine what actor is a beast master and which pets he controls
    #-------------------------------------------
    when 5 then return [4,10,12,13]
    when 9 then return [10,11] # Actor 9 can control Actors 10 and 11
    #when _ then return [_]
    else
      return []
    end
  end
 
  #-------------------------------------------
  # Which pets you have access to at the beginning of the game
  #-------------------------------------------
  STARTING_PETS = []
 
  #-------------------------------------------
  # Which actors you have access to at the beginning of the game
  #-------------------------------------------
  STARTING_PARTY = []
 
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#         E N D   C O N F I G U R E
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
  alias leon_partyswitch_gameactor_initialize initialize

  def initialize
    leon_partyswitch_gameactor_initialize
    @pets = STARTING_PETS
    @party_members = STARTING_PARTY
    #  Edit :This is to change if an actor is locked or not. To lock them, add
    #        their id to the array below.
    @locked = []
    @min_size = 1
    @max_size = 4
  end
 
 
  def add_actor(actor_id)
    actor = $game_actors[actor_id]
    if @actors.size < @max_size
      unless @actors.include?(actor)
        unless @party_members.include?(actor.id)
          @actors.push(actor)
          $game_player.refresh
        end
      end
    else
      unless @party_members.include?(actor.id)
        unless @actors.include?(actor)
          @party_members.push(actor.id)
          $game_player.refresh
        end
      end
    end
  end
 
  def remove_actor(actor_id)
    @actors.delete($game_actors[actor_id])
    @party_members.delete(actor_id)
    $game_player.refresh
  end
 
  def remove_actor_from_party(actor_id)
    if @actors.include?($game_actors[actor_id])
      unless @party_members.include?(actor_id)
        @party_members.push(actor_id)
        @party_members.sort!
      end
    end
        @actors.delete($game_actors[actor_id])
    $game_player.refresh
  end

  def add_actor_to_party(actor_id)
    if @party_members.include?(actor_id)
      if @actors[@max_size - 1] != nil
        @party_members.push(@actors[@max_size - 1].id)
        @actors.delete_at(@max_size - 1)
      end
      @actors.push($game_actors[actor_id])
      @party_members.delete(actor_id)
    end
  end
 
  def add_pet(id)
    return if @pets.include?(id)
    @pets.push(id)
    @pets.sort!
  end
   
  def remove_pet(id)
    return if !@pets.include?(id)
    @pets.delete(id)
  end
 
end
#==================================================
#  END Game_Party
#==================================================

#==============================================================================
# ** Window_Selectable
#==============================================================================
class Window_Selectable < Window_Base
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :cursor_height
  #--------------------------------------------------------------------------
  # * Alias Initialization
  #--------------------------------------------------------------------------
  alias custom_int initialize
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height)
    custom_int(x, y, width, height)
    @cursor_height = 32
  end
  #--------------------------------------------------------------------------
  # * Get Top Row
  #--------------------------------------------------------------------------
  def top_row
    # Divide y-coordinate of window contents transfer origin by 1 row
    # height of @cursor_height
    return self.oy / @cursor_height
  end
  #--------------------------------------------------------------------------
  # * Set Top Row
  # row : row shown on top
  #--------------------------------------------------------------------------
  def top_row=(row)
    # If row is less than 0, change it to 0
    if row < 0
      row = 0
    end
    # If row exceeds row_max - 1, change it to row_max - 1
    if row > row_max - 1
      row = row_max - 1
    end
    # Multiply 1 row height by 32 for y-coordinate of window contents
    # transfer origin
    self.oy = row * @cursor_height
  end
  #--------------------------------------------------------------------------
  # * Get Number of Rows Displayable on 1 Page
  #--------------------------------------------------------------------------
  def page_row_max
    # Subtract a frame height of 32 from the window height, and divide it by
    # 1 row height of @cursor_height
    return (self.height - 32) / @cursor_height
  end
  #--------------------------------------------------------------------------
  # * Update Cursor Rectangle
  #--------------------------------------------------------------------------
  def update_cursor_rect
    # If cursor position is less than 0
    if @index < 0
      self.cursor_rect.empty
      return
    end
    # Get current row
    row = @index / @column_max
    # If current row is before top row
    if row < self.top_row
      # Scroll so that current row becomes top row
      self.top_row = row
    end
    # If current row is more to back than back row
    if row > self.top_row + (self.page_row_max - 1)
      # Scroll so that current row becomes back row
      self.top_row = row - (self.page_row_max - 1)
    end
    # Calculate cursor width
    cursor_width = self.width / @column_max - 32
    # Calculate cursor coordinates
    x = @index % @column_max * (cursor_width + 32)
    y = @index / @column_max * @cursor_height - self.oy
    if self.active == true
      # Update cursor rectangle
      self.cursor_rect.set(x, y, cursor_width, @cursor_height)
    end
  end
end

#==============================================================================
# ** Window_Command
#==============================================================================
class Window_Command < Window_Selectable
  #--------------------------------------------------------------------------
  # * Unisable Item
  # index : item number
  #--------------------------------------------------------------------------
  def undisable_item(index)
    draw_item(index, normal_color)
  end
end
#============================================================


#==================================================
#  Window_Party_Info
#==================================================
class Window_Party_Info < Window_Base
  def initialize
    super(0, 0, 640, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end

  def refresh(pets_list = false)
    self.contents.clear
    if !pets_list
      self.contents.draw_text(0, 0, 614, 32, "Please make a party of #{$game_party.min_size.to_s} to #{$game_party.max_size.to_s} members.", 1)
    else
      self.contents.draw_text(0, 0, 614, 32, "Select which pet to go with the beast tamer.", 1)
    end
  end
end
#==================================================
#  END Window_Party_Info
#==================================================


#==================================================
#  Window_Party_Slots
#==================================================
class Window_Party_Slots < Window_Selectable

  def initialize
    super(0, 64, 320, 416)
    @item_max = 4
    self.contents = Bitmap.new(width - 32, height - 32)
    self.index = 0
    self.active = true
    refresh
  end
 
  def actors
    if @data[index] != nil
      return @data[index]
    end
  end

  def refresh
    @data = []
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    for i in 0...$game_party.actors.size
      @data.push($game_party.actors[i])
    end
    @item_max = (@data.size + 1)
    if @item_max > 0
      if @item_max > 4
        @item_max = 4
      end
      self.contents = Bitmap.new(width - 32, row_max * 96)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
 
  def draw_item(index)
    @actor = @data[index]
    y = index * 96
    x = 4
    if $game_party.locked.include?(@actor.id)
      self.contents.font.color = disabled_color
      opacity = 128
    else
      self.contents.font.color = normal_color
      opacity = 255
    end
    if @actor != nil
      self.contents.draw_text(x + 100, y, 192, 32, @actor.name)
      draw_actor_hp(@actor, x + 100, y + 32)
      draw_actor_sp(@actor, x + 100, y + 64)
      bitmap = RPG::Cache.character(@actor.character_name, @actor.character_hue)
      cw = bitmap.width / 4
      ch = bitmap.height / 4
      facing = 0
      src_rect = Rect.new(0, facing * ch, cw, ch)
      self.contents.blt(x + 24, y + 32, bitmap, src_rect, opacity)
    end
  end
 
  def update_cursor_rect
    if @index > -1
      x = 0
      y = index * 96
      self.cursor_rect.set(x, y, (self.width - 32), 96)
    else
      self.cursor_rect.empty
    end
  end
 
end
#==================================================
#  END Window_Party_Slots
#==================================================


#==================================================
#  Window_Party_Extras
#==================================================
class Window_Party_Extras < Window_Selectable
  def initialize
    super(320, 64, 320, 416)
    self.cursor_height = 96
    self.contents = Bitmap.new(width - 32, height - 32)
    self.index = -1
    self.active = false
    refresh
  end
 
  def actors
    if @data != nil
      return @data[index]
    end
  end

  def refresh(type = "actor", id = 0)
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
   
    # Original refresh method
    if type == "actor" and id == 0
      for i in 0...$game_party.party_members.size
        @data.push($game_actors[$game_party.party_members[i]])
      end
      @data.push(nil)
    #Editted refresh method
    else
      # Called when swapping pets
      if type == "pet"
        pet_list = []
        # Determine which beastmaster this pet belongs to
        $game_party.actors.each{|actor|
          if $game_party.beastmaster(actor.id).include?(id)
            pet_list = $game_party.beastmaster(actor.id)
            break
          end
        }
      # Called when adding a beastmaster to party
      else
        pet_list = $game_party.beastmaster(id)
      end
      # List all pets that can be swapped with this one
      pet_list.each{|pet|
        # Skip this pet if it's already in the party
        next if pet == id
        @data.push($game_actors[pet]) if ($game_party.pets.include?(pet) and $game_actors[pet] != nil)
      }
    end
     
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 96)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
 
  def draw_item(index)
    @actor = @data[index]
    y = index * 96
    x = 4
    if $game_party.locked.include?(@actor.id) or
      ($game_party.beastmaster(@actor.id) != [] and $game_party.actors.size >= $game_party.max_size - 1)
      self.contents.font.color = disabled_color
      opacity = 128
    else
      self.contents.font.color = normal_color
      opacity = 255
    end
    if @actor != nil
      self.contents.draw_text(x + 100, y, 192, 32, @actor.name)
      draw_actor_hp(@actor, x + 100, y + 32)
      draw_actor_sp(@actor, x + 100, y + 64)
      bitmap = RPG::Cache.character(@actor.character_name, @actor.character_hue)
      cw = bitmap.width / 4
      ch = bitmap.height / 4
      facing = 0
      src_rect = Rect.new(0, facing * ch, cw, ch)
      self.contents.blt(x + 24, y + 32, bitmap, src_rect, opacity)
    end
  end
 
end
#===================================
#  END Window_Party_Extras
#===================================


#===================================
#  Scene_Party_Change
#===================================
class Scene_Party_Change
  def main
   
    @info_window = Window_Party_Info.new
    @slot_window = Window_Party_Slots.new
    @extra_window = Window_Party_Extras.new
    @pet_list_active = false
    @beastmaster = nil
   
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
   
    @info_window.dispose
    @slot_window.dispose
    @extra_window.dispose
  end
#---------------------------------------------
  def is_beastmaster(actor)
    return true if $game_party.beastmaster(actor.id) != []
    return false
  end
 
#---------------------------------------------   
  def can_swap_pets(id)
    pet_list = []
    # Determine which beastmaster this pet belongs to
    $game_party.actors.each{|actor|
      if $game_party.beastmaster(actor.id).include?(id)
        pet_list = $game_party.beastmaster(actor.id)
          break
      end
    }
    pet_list.each{|pet|
      # Skip this pet if it's already in the party
      next if pet == id
      return true if ($game_party.pets.include?(pet) and $game_actors[pet] != nil)
    }
    return false
  end
#---------------------------------------------   
  def remove_beastmaster_pet(actor_id)
    pets = $game_party.beastmaster(actor_id)
    $game_party.actors.each{|actor|
      $game_party.actors.delete(actor) if pets.include?(actor.id)
    }
  end
#---------------------------------------------   
  def update
    @slot_window.update
   
    if @slot_window.active
      update_slot
      return
    end
   
    if @extra_window.active
      if !@pet_list_active
        update_extra
      else
        update_pets
      end
      return
    end
  end
#---------------------------------------------   
  def update_slot
    if Input.trigger?(Input::B)
      if $game_party.actors.size >= $game_party.min_size and $game_party.actors.size <= $game_party.max_size
        $game_player.refresh
        $game_system.se_play($data_system.cancel_se)
        $scene = Scene_Map.new
      else
        $game_system.se_play($data_system.buzzer_se)
      end
    end
   
    if Input.trigger?(Input::C)
      if $game_party.locked.include?(@slot_window.actors.id) == true
        if @slot_window.index != 0
          $game_system.se_play($data_system.decision_se)
          @slot_window.active = false
          @extra_window.active = true
          @extra_window.index = 0
        else
          $game_system.se_play($data_system.buzzer_se)
        end
      else
        if $game_party.pets.include?(@slot_window.actors.id)
          if can_swap_pets(@slot_window.actors.id) and @slot_window.actors != nil
            @extra_window.refresh("pet", @slot_window.actors.id)
            @info_window.refresh(true)
            @pet_list_active = true
          else
            $game_system.se_play($data_system.buzzer_se)
            return
          end
        end
        $game_system.se_play($data_system.decision_se)
        @slot_window.active = false
        @extra_window.active = true
        @extra_window.index = 0
      end
    end
  end
#--------------------------------------------- 
  def update_extra
    @extra_window.update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @extra_window.index = 0
      @extra_window.refresh
      @slot_window.active = true
      @extra_window.active = false
      @extra_window.index = -1
      @info_window.refresh
      return
    end
   
    if Input.trigger?(Input::C)
      if $game_party.locked.include?(@extra_window.actors.id) or
      ($game_party.beastmaster(@extra_window.actors.id) != [] and $game_party.actors.size >= $game_party.max_size - 1)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      $game_system.se_play($data_system.decision_se)
      # If the player selected an empty spot in EXTRAs
      if @extra_window.actors == nil
        # The player is planning to remove this party member
        if $game_party.actors[@slot_window.index] != nil
          $game_party.party_members.push($game_party.actors[@slot_window.index].id)
          ### If the actor being removed is a beast master
          if is_beastmaster($game_party.actors[@slot_window.index])
          # If true, then remove the associated pet
            remove_beastmaster_pet($game_party.actors[@slot_window.index].id)
          end
          $game_party.remove_actor_from_party($game_party.actors[@slot_window.index].id)
          $game_party.party_members.sort!
          @slot_window.refresh
          @extra_window.refresh
        end
        @slot_window.active = true
        @extra_window.active = false
        @extra_window.index = -1
      # If player selected an actual actor in EXTRAs
      else
        # If added party member is a beastmaster
        if $game_party.beastmaster(@extra_window.actors.id) != []
          @beastmaster = @extra_window.actors
          @beastmaster_index = @extra_window.index
          @extra_window.refresh("actor", @extra_window.actors.id)
          @extra_window.index = 0
          @info_window.refresh(true)
          @pet_list_active = true
          return
        # Added party member is not a beastmaster
        else
          # If swapping party members (A <-> B). Otherwise, skip this part.
          if $game_party.actors[@slot_window.index] != nil
            $game_party.party_members.push($game_party.actors[@slot_window.index].id)
            ### If the actor being removed is a beast master
            if is_beastmaster($game_party.actors[@slot_window.index])
            # If true, then remove the associated pet
              remove_beastmaster_pet($game_party.actors[@slot_window.index].id)
            end
           
          end
          $game_party.actors[@slot_window.index] = @extra_window.actors
          $game_party.party_members.delete_at(@extra_window.index)
          $game_party.party_members.sort!
          @slot_window.refresh
          @extra_window.refresh
          @slot_window.active = true
          @extra_window.active = false
          @extra_window.index = -1
        end
      end
    end
  end
#---------------------------------------------   
  def update_pets
    @extra_window.update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @extra_window.index = 0
      @extra_window.refresh
      @slot_window.active = true
      @extra_window.active = false
      @extra_window.index = -1
      @pet_list_active = false
      @info_window.refresh
    end
   
    if Input.trigger?(Input::C)
      if $game_party.locked.include?(@extra_window.actors.id)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      $game_system.se_play($data_system.decision_se)
      # If the player selected an empty spot in EXTRAs
      if @extra_window.actors == nil
       #IMPOSSIBLE--The beastmaster needs a pet! You can't remove the pet from party!
      else
        @pet_list_active = false
        # Put the party member back into the extras, unless they are a pet
        if $game_party.actors[@slot_window.index] and !$game_party.pets.include?($game_party.actors[@slot_window.index].id)
          $game_party.party_members.push($game_party.actors[@slot_window.index].id)
          ### If the actor being removed is a beast master
          if is_beastmaster($game_party.actors[@slot_window.index])
          # If true, then remove the associated pet
            remove_beastmaster_pet($game_party.actors[@slot_window.index].id)
          end
        end
        # If the player added a beastmaster
        if @beastmaster != nil
          # Add beastmaster
          $game_party.actors[@slot_window.index] = @beastmaster
          @beastmaster = nil
          # Add the pet
          $game_party.actors.push(@extra_window.actors)
          # Remove the beastmaster from the extras
          $game_party.party_members.delete_at(@beastmaster_index)
          $game_party.party_members.sort!
          @slot_window.refresh
          @extra_window.refresh
          @slot_window.active = true
          @extra_window.active = false
          @extra_window.index = -1
        # Swapping monsters
        else
          # If swapping party members (A <-> B). Otherwise, skip this part.
          $game_party.actors[@slot_window.index] = @extra_window.actors
          @slot_window.refresh
          @extra_window.refresh
          @slot_window.active = true
          @extra_window.active = false
          @extra_window.index = -1
        end
     
      end
      @info_window.refresh
    end
  end
#---------------------------------------------
end
By the way, I noticed you gave two beastmasters the ability to control the same pet. I said before that doing so might create errors.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Vexus

January 14, 2012, 01:03:42 pm #16 Last Edit: January 14, 2012, 01:19:34 pm by Vexus
Would it create a problem if only 1 of the beast masters is possible to have throughout a game? (Meaning if you choose to get beast master 1, the 2nd one won't join you and vice verse)

[Edit]

The problem still occurred on actor 4 but I changed the position of the pet to 13 and an actor to 4 and it works fine now (And the problem didn't happen when I tried that actor of position 4, I could add/remove people fine)

Thanks a lot for the help you solved one of my problems I had :)

You'll be named in the credits for sure.
Current Project/s:

KK20


Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Vexus

Ok then I tried it out and it worked fine.

Thanks a lot for the help :).
Current Project/s: