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.

Problem with KGC's Large Party

Okay, I am using KGC's Large Party script with the default RMXP battle system. I also use it primarily as my party change system. My problem is that I don't want some characters to be exchangable.

I was looking through the script, and saw a function called "Indespensable Join" which does just that, making some characters mandatory through a call script command. My problem is, however, I do not know what call script I am supposed to use. Could someone take a look at this at find out how to make someone a mandatory member of the party? Any help is very much appreciated. The script is below. Thanks!

Code:
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/    â—† Extended Party - KGC_LargeParty â—†
#_/----------------------------------------------------------------------------
#_/  Makes it possible to have a party size of 5 or more
#_/============================================================================
#_/ ≪メニュー画面改造[MenuAlter]≫より下
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

#==============================================================================
# ★ カスタマイズ項目 - Customize ★
#==============================================================================

module KGC
  # â—†Sets the maximum active members in party
  LP_MAX_MEMBER = 5

  # â—†Butler position equal layout when fighting 
  #  Because compulsorily is, there is a bug [ru] possibility, depending upon the function which is jointly used. 
  BATTIE_AUTO_POSITION = false

  # â—†At the time of replacement failure setting forcing joining 
  #  If outside the aggressive member you insert in the aggressive member mandatorily, (generally known forcing combat mission) 
  LP_INDISPENSABLE_JOIN = true

  # â—†Text displayed for an empty slot
  LP_BLANK_TEXT = "-EMPTY-"
  # â—†Text displayed for an occupied slot
  LP_ENTER_TEXT = "-ENTER-"
  # â—†At the time line to change background color 
  LP_SELECT_COLOR = Color.new(64, 255, 128, 128)

  # â—†Verification window character string 
  #  * When command several orders are modified, the bug [ri] it increases. 
  LP_CONFIRM_COMMANDS = ["Finish", "Stop", "Cancel"]

  # ◆Standby members XP Gain.[Remember the its actually 5% not 500%(Thousand minute ratio  1‰=0.1%)】
  LP_STAND_BY_EXP = 500

  # â—†While fighting replacement function 
  #  The extent coercive processing which is not possible is done. 
  #  It jointly uses mono depending upon, there is a bug [ru] possibility tremendous (´・ω・`)
  LP_BATTLE_PARTYFORM = true
  # â—†While fighting replacement picture movement button 
  #  ≪Only at the time of Active Count Battle≫ introduction use. 
  LP_BATTLE_PARTYFORM_BUTTON_ACB = Input::F6
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

$imported = {} if $imported == nil
$imported["LargeParty"] = true

#--------------------------------------------------------------------------
# ● パーティ編成画面の呼び出し
#--------------------------------------------------------------------------
def call_partyform
  # プレイヤーの姿勢を矯正
  $game_player.straighten
  # パーティ編成画面に切り替え
  $scene = Scene_PartyForm.new(1)
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# â–  Game_System
#==============================================================================

class Game_System
  #--------------------------------------------------------------------------
  # ● 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_accessor :partyform_permit         # パーティ編成許可
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  alias initialize_KGC_LargeParty initialize
  def initialize
    initialize_KGC_LargeParty

    @partyform_permit = true
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# â–  Game_Actor
#==============================================================================

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # ● 戦闘ステータス X 座標
  #--------------------------------------------------------------------------
  def battle_status_x
    # パーティ内の並び順から X 座標を計算して返す
    if self.index != nil
      if KGC::BATTIE_AUTO_POSITION
        if $imported["HPSPAlter"] && !KGC::HPSP_DRAW_NAME_LUMP
          return 80 + self.index * 592 / $game_party.actors.size
        else
          return 80 + self.index * 580 / $game_party.actors.size
        end
      else
        return 80 + self.index * (312 - KGC::LP_MAX_MEMBER * 39)
      end
    else
      return 0
    end
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# â–  Game_Party
#==============================================================================

class Game_Party
  #--------------------------------------------------------------------------
  # ● 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_accessor :battle_actors            # 戦闘メンバー
  attr_accessor :party_actors             # パーティ内の全アクター
  attr_accessor :indispensable_actors     # 入れ替え不可能(必須)アクター
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  alias initialize_KGC_LargeParty initialize
  def initialize
    initialize_KGC_LargeParty

    # パーティメンバーの配列を作成
    @battle_actors = []
    @party_actors = []
    @indispensable_actors = []
  end
  #--------------------------------------------------------------------------
  # ● 初期パーティのセットアップ
  #--------------------------------------------------------------------------
  def setup_starting_members
    @battle_actors = []
    @party_actors = []
    @indispensable_actors = []
    for i in $data_system.party_members
      @battle_actors.push($game_actors[i])
      @party_actors.push($game_actors[i])
    end
  end
  #--------------------------------------------------------------------------
  # ● 戦闘テスト用パーティのセットアップ
  #--------------------------------------------------------------------------
  def setup_battle_test_members
    @battle_actors = []
    @party_actors = []
    @indispensable_actors = []
    for battler in $data_system.test_battlers
      actor = $game_actors[battler.actor_id]
      actor.level = battler.level
      gain_weapon(battler.weapon_id, 1)
      gain_armor(battler.armor1_id, 1)
      gain_armor(battler.armor2_id, 1)
      gain_armor(battler.armor3_id, 1)
      gain_armor(battler.armor4_id, 1)
      actor.equip(0, battler.weapon_id)
      actor.equip(1, battler.armor1_id)
      actor.equip(2, battler.armor2_id)
      actor.equip(3, battler.armor3_id)
      actor.equip(4, battler.armor4_id)
      actor.recover_all
      @battle_actors.push(actor)
      @party_actors.push(actor)
    end
    @items = {}
    for i in 1...$data_items.size
      next if $data_items[i].name == ""
      occasion = $data_items[i].occasion
      @items[i] = 99 if occasion == 0 || occasion == 1
    end
  end
  #--------------------------------------------------------------------------
  # ● パーティメンバーのリフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    # ゲームデータをロードした直後はアクターオブジェクトが
    # $game_actors から分離してしまっている。
    # ロードのたびにアクターを再設定することで問題を回避する。
    new_battle_actors = []
    new_party_actors = []
    new_indispensable_actors = []
    for i in 0...@battle_actors.size
      if $data_actors[@battle_actors[i].id] != nil
        new_battle_actors.push($game_actors[@battle_actors[i].id])
      end
    end
    for i in 0...@party_actors.size
      if $data_actors[@party_actors[i].id] != nil
        new_party_actors.push($game_actors[@party_actors[i].id])
      end
    end
    for i in 0...@indispensable_actors.size
      if $data_actors[@indispensable_actors[i].id] != nil
        new_indispensable_actors.push($game_actors[@indispensable_actors[i].id])
      end
    end
    @battle_actors = new_battle_actors
    @party_actors = new_party_actors
    @indispensable_actors = new_indispensable_actors
  end
  #--------------------------------------------------------------------------
  # ● アクターの取得
  #--------------------------------------------------------------------------
  def actors
    return $game_temp.in_battle ? @battle_actors : @party_actors
  end
  #--------------------------------------------------------------------------
  # ● 最大レベルの取得
  #--------------------------------------------------------------------------
  def max_level
    # パーティ人数が 0 人の場合
    return 0 if self.actors.size == 0
    level = 0
    # パーティメンバーの最大レベルを求める
    self.actors.each { |actor| level = [level, actor.level].max }
    return level
  end
  #--------------------------------------------------------------------------
  # ● アクターを加える
  #     actor_id : アクター ID
  #--------------------------------------------------------------------------
  def add_actor(actor_id)
    # アクターを取得
    actor = $game_actors[actor_id]
    # 戦闘メンバーが最大数未満で、このアクターが戦闘メンバーにいない場合
    if @battle_actors.size < KGC::LP_MAX_MEMBER && !@battle_actors.include?(actor)
      # 戦闘メンバーとパーティにアクターを追加
      @battle_actors << actor
      @party_actors << actor
    else
      # パーティメンバーにのみアクターを追加
      @party_actors << actor
    end
    # プレイヤーをリフレッシュ
    $game_player.refresh
  end
  #--------------------------------------------------------------------------
  # ● アクターを外す
  #     actor_id : アクター ID
  #--------------------------------------------------------------------------
  def remove_actor(actor_id)
    actor = $game_actors[actor_id]
    # パーティからアクターを削除
    @party_actors.delete(actor)
    # 入れ替え不能者リストから削除
    @indispensable_actors.delete(actor)
    # アクターが戦闘メンバーにいる場合
    if @battle_actors.include?(actor)
      # 戦闘メンバーからアクターを削除
      @battle_actors.delete(actor)
      # 控えメンバーから適当に1人持ってくる
      for i in 0...@party_actors.size
        actor = @party_actors[i]
        # 戦闘メンバーに含まれない場合
        unless @battle_actors.include?(actor)
          # 戦闘メンバーに追加
          @battle_actors << actor
          break
        end
      end
    end
    # プレイヤーをリフレッシュ
    $game_player.refresh
  end
  #--------------------------------------------------------------------------
  # ● アクターの入れ替え可否を設定
  #     actor_id   : アクター ID
  #     permission : 許可フラグ(省略時:true) 
  #--------------------------------------------------------------------------
  def changeable(actor_id, permission = true)
    # アクターを取得
    actor = $game_actors[actor_id]
    # アクターがパーティ内にいない場合は戻る
    return unless @party_actors.include?(actor)
    if permission
      # 指定アクターを入れ替え不能リストから削除
      @indispensable_actors.delete(actor)
    else
      # 指定アクターを入れ替え不能リストに追加
      @indispensable_actors << actor
      # 強制加入がオンで、このアクターが戦闘メンバーにいない場合
      if KGC::LP_INDISPENSABLE_JOIN && !@battle_actors.include?(actor)
        # 戦闘メンバーの最後尾から順に入れ替え可能キャラを探す
        for i in 0...@battle_actors.size
          b_actor = @battle_actors.reverse[i]
          # 入れ替え禁止の場合は次へ
          next if @indispensable_actors.include?(b_actor)
          # 無理矢理戦闘メンバーに加える
          @battle_actors.delete(b_actor)
          @battle_actors.push(actor)
          # パーティの並び順を直す
          party_buf = @party_actors.dup
          @party_actors = []
          for p_actor in @battle_actors
            @party_actors.push(p_actor)
          end
          for p_actor in party_buf - @battle_actors
            @party_actors.push(p_actor)
          end
          break
        end
      end
    end
    # プレイヤーをリフレッシュ
    $game_player.refresh
  end
  #--------------------------------------------------------------------------
  # ● メンバー整列
  #--------------------------------------------------------------------------
  def sort_member
    # パーティをID順に整列
    @battle_actors.sort! { |a, b|
      a.id - b.id
    }
    @party_actors.sort! { |a, b|
      a.id - b.id
    }
    # パーティの並び順を直す
    restore_order
  end
  #--------------------------------------------------------------------------
  # ● パーティの並び順を直す
  #--------------------------------------------------------------------------
  def restore_order
    party_buf = @party_actors.dup
    @party_actors = []
    @battle_actors.each { |actor|
      @party_actors << actor
    }
    party_buf -= @battle_actors
    party_buf.each { |actor|
      @party_actors << actor
    }
  end
  #--------------------------------------------------------------------------
  # ● 全員のアクションクリア
  #--------------------------------------------------------------------------
  def clear_actions
    # パーティ全員のアクションをクリア
    self.actors.each { |actor|
      actor.current_action.clear
    }
  end
  #--------------------------------------------------------------------------
  # ● コマンド入力可能判定
  #--------------------------------------------------------------------------
  def inputable?
    # 一人でもコマンド入力可能なら true を返す
    self.actors.each { |actor|
      return true if actor.inputable?
    }
    return false
  end
  #--------------------------------------------------------------------------
  # ● 全滅判定
  #--------------------------------------------------------------------------
  def all_dead?
    # パーティ人数が 0 人の場合
    return false if $game_party.actors.size == 0
    # HP 0 以上のアクターがパーティにいる場合
    self.actors.each { |actor|
      return false if actor.hp > 0
    }
    # 全滅
    return true
  end
  #--------------------------------------------------------------------------
  # ● スリップダメージチェック (マップ用)
  #--------------------------------------------------------------------------
  def check_map_slip_damage
    self.actors.each { |actor|
      next if actor.hp == 0 || !actor.slip_damage?
      actor.hp -= [actor.maxhp / 100, 1].max
      $game_system.se_play($data_system.actor_collapse_se) if actor.hp == 0
      $game_screen.start_flash(Color.new(255,0,0,128), 4)
      $game_temp.gameover = $game_party.all_dead?
    }
  end
  #--------------------------------------------------------------------------
  # ● 対象アクターのランダムな決定
  #     hp0 : HP 0 のアクターに限る
  #--------------------------------------------------------------------------
  def random_target_actor(hp0 = false)
    # ルーレットを初期化
    roulette = []
    # ループ
    for actor in self.actors
      # 条件に該当する場合
      if (!hp0 && actor.exist?) || (hp0 && actor.hp0?)
        # アクターのクラスの [位置] を取得
        position = $data_classes[actor.class_id].position
        # 前衛のとき n = 4、中衛のとき n = 3、後衛のとき n = 2
        n = 4 - position
        # ルーレットにアクターを n 回追加
        n.times { roulette.push(actor) }
      end
    end
    # ルーレットのサイズが 0 の場合
    return nil if roulette.size == 0
    # ルーレットを回し、アクターを決定
    return roulette[rand(roulette.size)]
  end
  #--------------------------------------------------------------------------
  # ● 対象アクターのスムーズな決定
  #     actor_index : アクターインデックス
  #--------------------------------------------------------------------------
  def smooth_target_actor(actor_index)
    # アクターを取得
    actor = self.actors[actor_index]
    # アクターが存在する場合
    return actor if actor != nil && actor.exist?
    # ループ
    for actor in self.actors
      # アクターが存在する場合
      return actor if actor.exist?
    end
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# â–  Sprite_Battler
#==============================================================================

class Sprite_Battler < RPG::Sprite
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  alias update_KGC_LargeParty update
  def update
    update_KGC_LargeParty

    if @battler.is_a?(Game_Actor)
      # スプライトの座標を調整
      self.x = @battler.battle_status_x
    end
  end
  #--------------------------------------------------------------------------
  # ● グラフィックをリフレッシュ
  #--------------------------------------------------------------------------
  def refresh_graphic
    @battler_name = nil
    @battler_hue = nil
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# â–  Spriteset_Battle
#==============================================================================

class Spriteset_Battle
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  alias update_KGC_LargeParty update
  def update
    # アクタースプライトを作成
    unless @actor_sprites_created
      @actor_sprites = []
      for i in 0...[KGC::LP_MAX_MEMBER, 4].max
        @actor_sprites.push(Sprite_Battler.new(@viewport2))
      end
      # 作成済みフラグをオン
      @actor_sprites_created = true
    end

    update_KGC_LargeParty

    # アクタースプライトの内容を更新 (アクターの入れ替えに対応)
    (0...@actor_sprites.size).each { |i|
      @actor_sprites[i].battler = $game_party.actors[i]
    }
  end
  #--------------------------------------------------------------------------
  # ● アクタースプライトをリフレッシュ
  #--------------------------------------------------------------------------
  def refresh_actor_sprites
    @actor_sprites.each { |s|
      s.battler = nil
      s.refresh_graphic
    }
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# â–  Window_MenuStatus
#==============================================================================

unless $imported["MenuAlter"]
class Window_MenuStatus < Window_Selectable
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    @item_max = $game_party.actors.size
    self.contents.dispose
    self.contents = Bitmap.new(width - 32, @item_max * 112)
    for i in 0...@item_max
      x, y = 64, i * 112
      # 戦闘参加メンバー以降は背景を暗くする
      if i >= $game_party.battle_actors.size
        self.contents.fill_rect(x - 64, y, 448, 112, Color.new(0, 0, 0, 96))
      end
      actor = $game_party.actors[i]
      draw_actor_graphic(actor, x - 40, y + 80)
      draw_actor_name(actor, x, y)
      draw_actor_class(actor, x + 144, y)
      draw_actor_level(actor, x, y + 32)
      draw_actor_state(actor, x + 90, y + 32)
      draw_actor_exp(actor, x, y + 64)
      draw_actor_hp(actor, x + 236, y + 32)
      draw_actor_sp(actor, x + 236, y + 64)
    end
  end
  #--------------------------------------------------------------------------
  # ● 行数の取得
  #--------------------------------------------------------------------------
  def row_max
    # 項目数から行数を算出
    return @item_max - 1
  end
  #--------------------------------------------------------------------------
  # ● 先頭の行の取得
  #--------------------------------------------------------------------------
  def top_row
    # ウィンドウ内容の転送元 Y 座標を、1 行の高さ 112 で割る
    return self.oy / 112
  end
  #--------------------------------------------------------------------------
  # ● 先頭の行の設定
  #     row : 先頭に表示する行
  #--------------------------------------------------------------------------
  def top_row=(row)
    # row を 0 ~ row_max - 1 に修正
    row = [[row, 0].max, row_max - 1].min
    # row に 1 行の高さ 112 を掛け、ウィンドウ内容の転送元 Y 座標とする
    self.oy = row * 112
  end
  #--------------------------------------------------------------------------
  # ● 1 ページに表示できる行数の取得
  #--------------------------------------------------------------------------
  def page_row_max
    return (self.height - 32) / 112
  end
  #--------------------------------------------------------------------------
  # ● 1 ページに表示できる項目数の取得
  #--------------------------------------------------------------------------
  def page_item_max
    return page_row_max
  end
  #--------------------------------------------------------------------------
  # ● カーソルの矩形更新
  #--------------------------------------------------------------------------
  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
      return
    end
    # 現在の行を取得
    row = @index
    # 現在の行が、表示されている先頭の行より前の場合
    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 - 32
    # カーソルの座標を計算
    y = @index * 112 - self.oy
    # カーソルの矩形を更新
    self.cursor_rect.set(0, y, cursor_width, 112)
  end
end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# â–  Window_BattleStatus
#==============================================================================

class Window_BattleStatus < Window_Base
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  alias initialize_KGC_LargeParty initialize
  def initialize
    initialize_KGC_LargeParty

    # レベルアップフラグを再作成
    @level_up_flags = []
    for i in 0...[KGC::LP_MAX_MEMBER, 4].max
      @level_up_flags[i] = false
    end
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  alias refresh_KGC_LargeParty refresh
  def refresh
    @dw = 120 - (KGC::LP_MAX_MEMBER - 4) * 12

    refresh_KGC_LargeParty

    Graphics.frame_reset
  end
  #--------------------------------------------------------------------------
  # ● 名前の描画
  #     actor : アクター
  #     x     : 描画先 X 座標
  #     y     : 描画先 Y 座標
  #--------------------------------------------------------------------------
  alias draw_actor_name_KGC_LargeParty draw_actor_name
  def draw_actor_name(actor, x, y)
    x2 = actor.battle_status_x - 64

    draw_actor_name_KGC_LargeParty(actor, x2, y)
  end
  #--------------------------------------------------------------------------
  # ● ステートの描画
  #--------------------------------------------------------------------------
  alias draw_actor_state_KGC_LargeParty draw_actor_state
  def draw_actor_state(actor, x, y, width = 120)
    x2 = actor.battle_status_x - 64

    draw_actor_state_KGC_LargeParty(actor, x2, y, width)
  end
  #--------------------------------------------------------------------------
  # ● HP の描画
  #     actor : アクター
  #     x     : 描画先 X 座標
  #     y     : 描画先 Y 座標
  #     width : 描画先の幅
  #--------------------------------------------------------------------------
  alias draw_actor_hp_KGC_LargeParty draw_actor_hp
  def draw_actor_hp(actor, x, y, width = 120)
    x2 = actor.battle_status_x - 64

    draw_actor_hp_KGC_LargeParty(actor, x2, y, @dw)
  end
  #--------------------------------------------------------------------------
  # ● SP の描画
  #     actor : アクター
  #     x     : 描画先 X 座標
  #     y     : 描画先 Y 座標
  #     width : 描画先の幅
  #--------------------------------------------------------------------------
  alias draw_actor_sp_KGC_LargeParty draw_actor_sp
  def draw_actor_sp(actor, x, y, width = 120)
    x2 = actor.battle_status_x - 64

    draw_actor_sp_KGC_LargeParty(actor, x2, y, @dw)
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# â–  Window_BattleMember
#------------------------------------------------------------------------------
#  戦闘用メンバーを表示するウィンドウです。
#==============================================================================

class Window_BattleMember < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_accessor :selected_index           # 選択済みインデックス
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 640, 224)
    @column_max = 4
    @item_max = KGC::LP_MAX_MEMBER
    @selected_index = nil
    bw = 152 * @column_max
    bh = ((@item_max - 1) / @column_max + 1) * 192
    self.contents = Bitmap.new(bw, bh)
    refresh
    self.active = true
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # ● 選択アクター取得
  #--------------------------------------------------------------------------
  def actor
    return @actors[self.index]
  end
  #--------------------------------------------------------------------------
  # ● アクター画像描画
  #     actor : 対象アクター
  #     x, y  : 描画先
  #--------------------------------------------------------------------------
  def draw_actor_graphic(actor, x, y)
    bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
    rect = bitmap.rect
    rect.height = [bitmap.height, 192].min
    self.contents.blt(x, y, bitmap, rect)
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.size = 20
    @actors = $game_party.battle_actors
    @item_max.times { |i|
      x = i % @column_max * 152 + 8
      y = i / @column_max * 192 + 64
      # アクターが存在する場合
      if i < @actors.size
        # 選択済みの場合は背景変色
        if i == @selected_index
          self.contents.fill_rect(x - 8, y - 64, 152, 192, KGC::LP_SELECT_COLOR)
        end
        draw_actor_info(@actors[i], x, y)
      else
        self.contents.font.color = system_color
        if $imported["FrameShadowText"]
          self.contents.draw_frame_text(x - 8, y, 152, 32, KGC::LP_BLANK_TEXT, 1)
        else
          self.contents.draw_text(x - 8, y, 152, 32, KGC::LP_BLANK_TEXT, 1)
        end
      end
    }
  end
  #--------------------------------------------------------------------------
  # ● アクター情報描画
  #     actor : 対象アクター
  #     x, y  : 描画先
  #--------------------------------------------------------------------------
  def draw_actor_info(actor, x, y)
    draw_actor_graphic(actor, x, y - 64)
    draw_actor_name(actor, x, y)
    draw_actor_class(actor, x, y + 20)
    draw_actor_level(actor, x, y + 44)
    draw_actor_state(actor, x + 64, y + 44)
    draw_actor_hp(actor, x, y + 68)
    draw_actor_sp(actor, x, y + 92)
  end
  #--------------------------------------------------------------------------
  # ● カーソル矩形更新
  #--------------------------------------------------------------------------
  def update_cursor_rect
    # カーソル位置が 0 未満の場合
    if @index < 0
      self.cursor_rect.empty
      return
    end
    # カーソルの幅を計算
    cursor_width = 152
    # カーソルの座標を計算
    x = @index % @column_max * 152
    y = @index / @column_max * 192 - self.oy
    # カーソルの矩形を更新
    self.cursor_rect.set(x, y, cursor_width, 192)
    self.oy = @index / @column_max * 192
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# â–  Window_PartyMember
#------------------------------------------------------------------------------
#  パーティメンバーを表示するウィンドウです。
#==============================================================================

class Window_PartyMember < Window_Selectable
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    super(0, 224, 640, 256)
    @actors = $game_party.party_actors
    @column_max = 4
    bw = 152 * @column_max
    bh = ((@actors.size - 1) / @column_max + 1) * 112
    self.contents = Bitmap.new(bw, bh)
    refresh
    self.active = false
    self.index = -1
  end
  #--------------------------------------------------------------------------
  # ● アクターの取得
  #--------------------------------------------------------------------------
  def actor
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.size = 16
    @actors = $game_party.party_actors
    @item_max = @actors.size
    @data = []
    @actors.each_with_index { |actor, i|
      x = i % @column_max * 152 + 8
      y = i / @column_max * 112 + 16
      @data << actor
      if $game_party.battle_actors.include?(actor)
        # 戦闘用メンバーに含まれている場合
        self.contents.font.color = system_color
        self.contents.draw_shadow_text(x, y - 16, 148, 32, KGC::LP_ENTER_TEXT, 1)
      else
        draw_actor_graphic(actor, x + 144, y - 16)
      end
      draw_actor_info(actor, x, y)
    }
  end
  #--------------------------------------------------------------------------
  # ● アクター画像の描画
  #--------------------------------------------------------------------------
  def draw_actor_graphic(actor, x, y)
    bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
    src_rect = bitmap.rect
    cw = src_rect.width >> 1
    ch = src_rect.height >> 1
    dest_rect = Rect.new(x - cw, y, cw, ch)
    self.contents.stretch_blt(dest_rect, bitmap, src_rect)
  end
  #--------------------------------------------------------------------------
  # ● アクター情報の描画
  #--------------------------------------------------------------------------
  def draw_actor_info(actor, x, y)
    draw_actor_name(actor, x, y)
    draw_actor_class(actor, x, y + 16)
    draw_actor_level(actor, x, y + 32)
    draw_actor_state(actor, x + 64, y + 32)
    draw_actor_hp(actor, x, y + 48)
    draw_actor_sp(actor, x, y + 64)
  end
  #--------------------------------------------------------------------------
  # ● HP の描画
  #--------------------------------------------------------------------------
  def draw_actor_hp(actor, x, y, width = 144)
    # 文字列 "HP" を描画
    self.contents.font.color = system_color
    self.contents.draw_shadow_text(x, y, 32, 32, $data_system.words.hp)
    hp_x = x + width - 108
    # HP を描画
    self.contents.font.color = actor.hp == 0 ? knockout_color :
      actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
    self.contents.draw_shadow_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
    # MaxHP を描画
    self.contents.font.color = normal_color
    self.contents.draw_shadow_text(hp_x + 48, y, 12, 32, "/", 1)
    self.contents.draw_shadow_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
  end
  #--------------------------------------------------------------------------
  # ● SP の描画
  #--------------------------------------------------------------------------
  def draw_actor_sp(actor, x, y, width = 144)
    # 文字列 "SP" を描画
    self.contents.font.color = system_color
    self.contents.draw_shadow_text(x, y, 32, 32, $data_system.words.sp)
    sp_x = x + width - 108
    # SP を描画
    self.contents.font.color = actor.sp == 0 ? knockout_color :
      actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
    self.contents.draw_shadow_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
    # MaxSP を描画
    self.contents.font.color = normal_color
    self.contents.draw_shadow_text(sp_x + 48, y, 12, 32, "/", 1)
    self.contents.draw_shadow_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
  end
  #--------------------------------------------------------------------------
  # ● カーソル矩形更新
  #--------------------------------------------------------------------------
  def update_cursor_rect
    # カーソル位置が 0 未満の場合
    if @index < 0
      self.cursor_rect.empty
      return
    end
    # カーソルの幅を計算
    cursor_width = 152
    # カーソルの座標を計算
    x = @index % @column_max * 152
    y = 0
    # カーソルの矩形を更新
    self.cursor_rect.set(x, y, cursor_width, 112)
    self.oy = @index / @column_max * 112
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# â–  Window_Target
#==============================================================================

class Window_Target < Window_Selectable
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 336, 480)
    self.contents = Bitmap.new(width - 32,
      $game_party.party_actors.size * 116 - 16)
    self.z += 10
    @item_max = $game_party.party_actors.size
    refresh
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    actors = $game_party.party_actors
    actors.each_index { |i|
      x = 4
      y = i * 116
      # 非戦闘メンバーは背景を暗くする
      if i >= actors.size
        self.contents.fill_rect(0, y, width - 32, 116, Color.new(0, 0, 0, 96))
      end
      draw_actor_info(actors[i], x, y)
    }
  end
  #--------------------------------------------------------------------------
  # ● アクター情報描画
  #--------------------------------------------------------------------------
  def draw_actor_info(actor, x, y)
    draw_actor_name(actor, x, y)
    draw_actor_class(actor, x + 144, y)
    draw_actor_level(actor, x + 8, y + 32)
    draw_actor_state(actor, x + 8, y + 64)
    draw_actor_hp(actor, x + 152, y + 32)
    draw_actor_sp(actor, x + 152, y + 64)
  end
  #--------------------------------------------------------------------------
  # ● カーソル矩形更新
  #--------------------------------------------------------------------------
  def update_cursor_rect
    # カーソル位置 -1 は全選択
    if @index < 0
      self.cursor_rect.set(0, 0, self.width - 32, @item_max * 116 - 20)
	  return
    end
    # 現在の行を取得
    row = @index
    # 現在の行が、表示されている先頭の行より前の場合
    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 - 32
    # カーソルの座標を計算
    x = @index % @column_max * (cursor_width + 32)
    y = @index / @column_max * 116 - self.oy
    # カーソルの矩形を更新
    self.cursor_rect.set(x, y, self.width - 32, 96)
  end
  #--------------------------------------------------------------------------
  # ● 先頭の行の取得
  #--------------------------------------------------------------------------
  def top_row
    # ウィンドウ内容の転送元 Y 座標を、1 行の高さ 116 で割る
    return self.oy / 116
  end
  #--------------------------------------------------------------------------
  # ● 先頭の行の設定
  #     row : 先頭に表示する行
  #--------------------------------------------------------------------------
  def top_row=(row)
    # row を 0 ~ row_max - 1 に修正
    row = [[row, 0].max, row_max - 1].min
    # row に 1 行の高さ 116 を掛け、ウィンドウ内容の転送元 Y 座標とする
    self.oy = row * 116
  end
  #--------------------------------------------------------------------------
  # ● 1 ページに表示できる行数の取得
  #--------------------------------------------------------------------------
  def page_row_max
    return 4
  end
  #--------------------------------------------------------------------------
  # ● 行数の取得
  #--------------------------------------------------------------------------
  def row_max
    return $game_party.party_actors.size
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# â–  Window_PartyCommand
#==============================================================================

if KGC::LP_BATTLE_PARTYFORM
class Window_PartyCommand < Window_Selectable
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 640, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.back_opacity = 160
    @commands = ["Fight", "Escape", "Formation"]
    @item_max = 3
    @column_max = 3
    draw_item(0, normal_color)
    draw_item(1, $game_temp.battle_can_escape ? normal_color : disabled_color)
    draw_item(2, $game_system.partyform_permit ? normal_color : disabled_color)
    self.active = false
    self.visible = false
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # ● 項目の描画
  #     index : 項目番号
  #     color : 文字色
  #--------------------------------------------------------------------------
  def draw_item(index, color)
    self.contents.font.color = color
    rect = Rect.new(80 + index * 160 + 4, 0, 128 - 10, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    self.contents.draw_text(rect, @commands[index], 1)
  end
  #--------------------------------------------------------------------------
  # ● カーソルの矩形更新
  #--------------------------------------------------------------------------
  def update_cursor_rect
    self.cursor_rect.set(80 + index * 160, 0, 128, 32)
  end
end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# â–  Window_ShopStatus
#==============================================================================

class Window_ShopStatus < Window_Base
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  if !$imported["EquipExtension"] && KGC::LP_MAX_MEMBER > 4
  def refresh
    self.contents.clear
    return if @item == nil
    case @item
    when RPG::Item
      number = $game_party.item_number(@item.id)
    when RPG::Weapon
      number = $game_party.weapon_number(@item.id)
    when RPG::Armor
      number = $game_party.armor_number(@item.id)
    end
    self.contents.font.size = 22
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 200, 32, "Amount")
    self.contents.font.color = normal_color
    self.contents.draw_text(204, 0, 32, 32, number.to_s, 2)
    return if @item.is_a?(RPG::Item)
    self.contents.font.size = 18
    # 装備品追加情報
    for i in 0...$game_party.actors.size
      # アクターを取得
      actor = $game_party.actors[i]
      # 装備可能なら通常文字色に、不可能なら無効文字色に設定
      if actor.equippable?(@item)
        self.contents.font.color = normal_color
      else
        self.contents.font.color = disabled_color
      end
      # アクターの名前を描画
      self.contents.draw_text(4, 32 + 44 * i, 120, 32, actor.name)
      # 現在の装備品を取得
      if @item.is_a?(RPG::Weapon)
        item1 = $data_weapons[actor.weapon_id]
      elsif @item.kind == 0
        item1 = $data_armors[actor.armor1_id]
      elsif @item.kind == 1
        item1 = $data_armors[actor.armor2_id]
      elsif @item.kind == 2
        item1 = $data_armors[actor.armor3_id]
      else
        item1 = $data_armors[actor.armor4_id]
      end
      # 装備可能な場合
      if actor.equippable?(@item)
        # 武器の場合
        if @item.is_a?(RPG::Weapon)
          atk1 = item1 != nil ? item1.atk : 0
          atk2 = @item != nil ? @item.atk : 0
          change = atk2 - atk1
        end
        # 防具の場合
        if @item.is_a?(RPG::Armor)
          pdef1 = item1 != nil ? item1.pdef : 0
          mdef1 = item1 != nil ? item1.mdef : 0
          pdef2 = @item != nil ? @item.pdef : 0
          mdef2 = @item != nil ? @item.mdef : 0
          change = pdef2 - pdef1 + mdef2 - mdef1
        end
        # パラメータの変化値を描画
        self.contents.draw_text(124, 32 + 44 * i, 112, 32, sprintf("%+d", change), 2)
      end
      # アイテムを描画
      if item1 != nil
        x = 4
        y = 32 + 44 * i + 22
        bitmap = RPG::Cache.icon(item1.icon_name)
        opacity = self.contents.font.color == normal_color ? 255 : 128
        self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
        self.contents.draw_text(x + 28, y, 212, 32, item1.name)
      end
    end
  end
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# â–  Arrow_Actor
#==============================================================================

class Arrow_Actor < Arrow_Base
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  alias update_KGC_LargeParty update
  def update
    update_KGC_LargeParty

    # スプライトの座標を設定
    if self.actor != nil
      self.x = self.actor.battle_status_x
    end
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# â–  Scene_Menu
#==============================================================================

class Scene_Menu
  #--------------------------------------------------------------------------
  # ● フレーム更新 (コマンドウィンドウがアクティブの場合)
  #--------------------------------------------------------------------------
  alias update_command_KGC_LargeParty update_command
  def update_command
    # A ボタンが押された場合
    if Input.trigger?(Input::A)
      # 編成禁止の場合
      unless $game_system.partyform_permit
        # ブザー SE を演奏
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # 決定 SE を演奏
      $game_system.se_play($data_system.decision_se)
      # パーティ編成画面に切り替え
      $scene = Scene_PartyForm.new(0, @command_window.index)
      return
    end

    update_command_KGC_LargeParty
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (ステータスウィンドウがアクティブの場合)
  #--------------------------------------------------------------------------
  alias update_status_KGC_LargeParty update_status
  def update_status
    # A ボタンが押された場合
    if Input.trigger?(Input::A)
      # 編成禁止の場合
      unless $game_system.partyform_permit
        # ブザー SE を演奏
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # 決定 SE を演奏
      $game_system.se_play($data_system.decision_se)
      # パーティ編成画面に切り替え
      $scene = Scene_PartyForm.new(0, @command_window.index)
      return
    end

    update_status_KGC_LargeParty
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# â–  Scene_PartyForm
#------------------------------------------------------------------------------
#  パーティ編成を行うクラスです。
#==============================================================================

class Scene_PartyForm
  #--------------------------------------------------------------------------
  # ● オブ&#1
 

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