Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Help setting up Fomar's Party Change system with RTAB

I really want to use Fomar's awesome Party Changing system, but I have RTAB and it's conflicting with that.  I can get almost everything working fine, but then when I go into a battle (let's say I have 5 people in my party) you can see like half of the first and fifth member, and when you try to pick commands nothing happens and that person keeps getting a turn...but nothing happens.  I want it so that you can only have 4 people in the active party at a time.

Also I need help with the add-ons for the Party system.  I want it so that:
1. The first party member can NEVER be moved out of the first spot in the party
2. I can control the amount of EXP characters not in the active party get

Here are the scripts I have for the Party Change system:
class Game_Party
 
  Max_Party_Size = 8
 
  def max_party_size
    return Max_Party_Size
  end
 
  def add_actor(actor_id)
    actor = $game_actors[actor_id]
    if not @actors.include?(actor) and $game_party.actors.size < Max_Party_Size
      @actors.push(actor)
      $game_player.refresh
    end
  end
 
  def all_dead?
    if $game_party.actors.size == 0
      return false
    end
    for actor in @actors
      if actor.hp > 0
        return false
      end
      if actor.index >= 4
        return true
      end
    end
    return true
  end
end

class Scene_Menu
 
  alias party_swap_update_command update_command
  def update_command
    party_swap_update_command
    if Input.trigger?(Input::LEFT) or Input.trigger?(Input::RIGHT)
      $game_system.se_play($data_system.cursor_se)
      @previous_index = @command_window.index
      @command_window.index = -1
      @command_window.active = false
      @status_window.active = true
      @status_window.index = @status_window.top_row
      return
    end
  end
 
  alias party_swap_update_status update_status
  def update_status
    if Input.trigger?(Input::B)
      unless @swapee != nil
        $game_system.se_play($data_system.cancel_se)
        if @command_window.index == -1
          @command_window.index = @previous_index
        end
        @command_window.active = true
        @status_window.active = false
        @status_window.index = -1
        return
      end
      @swapee = nil
      return
    end
    if Input.trigger?(Input::C) and @command_window.index == -1
      unless @swapee != nil
        @swapee = @status_window.index
        $game_system.se_play($data_system.decision_se)
        return
      end
      if @swapee == @status_window.index
        $game_system.se_play($data_system.decision_se)
        @swapee = nil
        return
      end
      $game_system.se_play($data_system.decision_se)
      party_ids = []
      for actor in $game_party.actors
        party_ids.push(actor.id)
      end
      swapee2 = @status_window.index
      if @swapee < swapee2
        for i in @swapee...party_ids.size
          $game_party.remove_actor(party_ids)
        end
        $game_party.add_actor(party_ids[swapee2])
        for i in (@swapee + 1)...party_ids.size
          unless i == swapee2
            $game_party.add_actor(party_ids)
          else
            $game_party.add_actor(party_ids[@swapee])
          end
        end
      else
        for i in swapee2...party_ids.size
          $game_party.remove_actor(party_ids)
        end
        $game_party.add_actor(party_ids[@swapee])
        for i in (swapee2 + 1)...party_ids.size
          unless i == @swapee
            $game_party.add_actor(party_ids)
          else
            $game_party.add_actor(party_ids[swapee2])
          end
        end
      end
      @swapee = nil
      @status_window.refresh
      return
    end
    if Input.trigger?(Input::LEFT) or Input.trigger?(Input::RIGHT)
      if @swapee == nil and @command_window.index == -1
        $game_system.se_play($data_system.cursor_se)
        @command_window.index = @previous_index
        @command_window.active = true
        @status_window.active = false
        @status_window.index = -1
      end
    end
    party_swap_update_status
  end
 
 
end

class Window_MenuStatus < Window_Selectable
 
  def initialize
    unless $game_party.actors.size > 4
      super(0, 0, 480, 480)
    else
      super(0, 0, 480, 160 * $game_party.actors.size)
    end
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
    self.active = false
    self.index = -1
  end
 
  alias large_refresh refresh
  def refresh
    large_refresh
    self.height = 480
  end
 
  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
      return
    end
    row = @index / @column_max
    if row < self.top_row
      self.top_row = row
    end
    if row > self.top_row + (self.page_row_max - 1)
      self.top_row = row - (self.page_row_max - 1)
    end
    cursor_width = self.width / @column_max - 32
    x = @index % @column_max * (cursor_width + 32)
    y = @index / @column_max * 116 - self.oy
    self.cursor_rect.set(x, y, cursor_width, 96)
  end
 
  def top_row
    return self.oy / 116
  end
 
  def top_row=(row)
    if row < 0
      row = 0
    end
    if row > row_max - 1
      row = row_max - 1
    end
    self.oy = row * 116
  end
 
  def page_row_max
    return 4
  end
end

class Scene_Battle
  def phase3_next_actor
    begin
      if @active_battler != nil
        @active_battler.blink = false
      end
      if @actor_index == ([$game_party.actors.size, 4].min - 1)
        start_phase4
        return
      end
      @actor_index += 1
      @active_battler = $game_party.actors[@actor_index]
      @active_battler.blink = true
    end until @active_battler.inputable?
    phase3_setup_command_window
  end
 
end

class Game_Actor < Game_Battler
  def exist?
    return super == self.index < 4
  end
end


class Scene_Battle
 
  def start_phase5
    @phase = 5
    $game_system.me_play($game_system.battle_end_me)
    $game_system.bgm_play($game_temp.map_bgm)
    exp = 0
    gold = 0
    treasures = []
    for enemy in $game_troop.enemies
      unless enemy.hidden
        exp += enemy.exp
        gold += enemy.gold
        if rand(100) < enemy.treasure_prob
          if enemy.item_id > 0
            treasures.push($data_items[enemy.item_id])
          end
          if enemy.weapon_id > 0
            treasures.push($data_weapons[enemy.weapon_id])
          end
          if enemy.armor_id > 0
            treasures.push($data_armors[enemy.armor_id])
          end
        end
      end
    end
    treasures = treasures[0..5]
    for i in 0...$game_party.actors.size
      actor = $game_party.actors
      if actor.cant_get_exp? == false
        if i < 4
          last_level = actor.level
          actor.exp += exp
          if actor.level > last_level
            @status_window.level_up(i)
          end
        else
          actor.exp += (exp / 2) # EDIT THIS LINE
          # At the moment actors not in battle gain 50% of the exp
        end
      end
    end
    $game_party.gain_gold(gold)
    for item in treasures
      case item
      when RPG::Item
        $game_party.gain_item(item.id, 1)
      when RPG::Weapon
        $game_party.gain_weapon(item.id, 1)
      when RPG::Armor
        $game_party.gain_armor(item.id, 1)
      end
    end
    @result_window = Window_BattleResult.new(exp, gold, treasures)
    @phase5_wait_count = 100
  end
end


class Game_Party
 
  attr_accessor  :locked
 
  alias locked_initialize initialize
  def initialize
    locked_initialize
    @locked = [1]
  end
 
end

class Scene_Menu
 
  alias locked_update update
  def update
    if @locked_window != nil
      if Input.trigger?(Input::B) or Input.trigger?(Input::C)
        @locked_window.dispose
        @locked_window = nil
      end
      return
    end
    locked_update
  end
 
  alias locked_update_command update_command
  def update_command
    if Input.trigger?(Input::B)
      if $game_party.locked == [] or $game_party.actors.size <= 4 or $game_party.locked.size > 4
        $game_system.se_play($data_system.cancel_se)
        $scene = Scene_Map.new
        return
      end
      locked = $game_party.locked.clone
      for i in 0...4
        locked.delete($game_party.actors.id)
      end
      if locked == []
        $game_system.se_play($data_system.cancel_se)
        $scene = Scene_Map.new
      else
        $game_system.se_play($data_system.buzzer_se)
        @locked_window = Locked.new($game_actors[locked[0]])
      end
      return
    end
    locked_update_command
  end
 
end



class Locked < Window_Base
 
  def initialize(actor)
    super(((640 - 460)/2), ((480 - 70)/2), 460, 70)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.z = 5000
    @actor = actor
    refresh
  end
 
  def refresh
    self.contents.clear
    text = @actor.name + ' needs to be in the active party'
    self.contents.draw_text(4, 0, 460, 32, text)
  end
end


I'm sorry if I haven't got enough info or something, but I'd really appreciate some help with this.  My game can't go on without it really.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top