じ☆ve冰风 发表于 2024-4-19 21:19:51

【BFS】【插件】人物扩张脚本

先上图

4人参战,2人休息,地图上显示4人


6个人的情况(这样可能会比较乱)(注意那个无聊的HERO)
其实我个人比较倾向于伊苏7的3人队友,其他人待机……
总之想要的拿去# 赠品:人物扩张脚本# 窗口界面部分来自 桜雅 在土 XRXS26module BFS_Setting# 参战人数最大值BATTLE_MAX = 6# 待机人数最大值WAITING_MAX = 2# 待机人物是否获得经验BACKWARD_EXP_GAINABLE = true# 3人以下的时候,菜单是否拉伸大小(建议不要使用)MENU_STATUS_STRETCH   = false# 进入键MENU_MEMBER_CHANGE_KEY_GO    = Input::RIGHT   # 离开键MENU_MEMBER_CHANGE_KEY_END   = Input::LEFT    # 可更换角色最小编号MENU_MEMBER_CHANGE_INDEX_MIN = 0   # 不能待机的角色编号FORCETOBATTLE_ACTORS         = []    # 不能加入战斗的角色编号UMBATTLABLE_ACTORS         = []   # 不能移动的角色编号UNMOVABLE_ACTORS             = []   # 列数COLUMN_MAX = 1# 光标高度CURSOR_HEIGHT = 96# 一行的高度LINE_HEIGHT = 116endclass Game_Tempattr_accessor :friends_need_refreshalias rwkz_ini initializedef initialize    rwkz_ini    @friend_need_refresh = falseendendclass Scene_Mapalias rwkz_main maindef main    if $game_temp.friends_need_refresh      BFS_Friends.delete_all_friends      BFS_Friends.prepare_for_transferring      $game_temp.friends_need_refresh = false    end    rwkz_mainendendclass Game_Partyattr_accessor :waiting_actorsdef gain_exp(exp)    for i in 0...$game_party.actors.size      actor = $game_party.actors      if actor.cant_get_exp? == false      actor.exp += exp      end    end    if BFS_Setting::BACKWARD_EXP_GAINABLE      for i in 0...$game_party.waiting_actors.size      actor = $game_party.waiting_actors      if actor.cant_get_exp? == false          actor.exp += exp      end      end    endendalias rk initializedef initialize    rk    @waiting_actors = []enddef remove_actor(actor_id)    if @actors.size == 1      p "数据库中的角色数量会变为0,为了游戏的正常运行,请不要这样做。"      p "因此,系统可能会忽略此次操作,见谅"      p "如有特殊情况,请在脚本中删除这段文字"      return    end    switch_leader if actor_id == $game_party.actors.id    if @actors.include?($game_actors)      @actors.delete($game_actors)      if @waiting_actors != []      waiting_leader = @waiting_actors      @waiting_actors.delete_at(0)      @actors.push(waiting_leader)      end    else      if @waiting_actors.include?($game_actors)      @waiting_actors.delete($game_actors)      else      return      end    end    friend_party_update    BFS_Friends.delete_all_friends    BFS_Friends.prepare_for_transferring    $game_player.refresh    $scene.spriteset.dispose    $scene.spriteset = Spriteset_Map.new    $scene.hud_updateenddef add_actor(actor_id)    actor = $game_actors    unless @actors.include?(actor) or @waiting_actors.include?(actor)      if @actors.size < BFS_Setting::BATTLE_MAX      @actors.push(actor)      $game_player.refresh      friend_party_update      BFS_Friends.add(actor_id)      $scene.spriteset.dispose      $scene.spriteset = Spriteset_Map.new      BFS_Friends.weapon_recheck      else         if @waiting_actors.size < BFS_Setting::WAITING_MAX          @waiting_actors.push(actor)      end      end    endendend#==============================================================================# --- XRXS. 第二カーソル 機構 ---#------------------------------------------------------------------------------#   ウィンドウに .index2 プロパティを追加します。#==============================================================================module XRXS_Cursor2#--------------------------------------------------------------------------# ● オブジェクト初期化#--------------------------------------------------------------------------def initialize(x, y, w, h)    super(x, y, h, w)    # 補助ウィンドウ(透明)を作成:カーソル専用    @xrxsc2_window = Window_Selectable.new(self.x, self.y, self.width, self.height)    @xrxsc2_window.opacity = 0    @xrxsc2_window.active = false    @xrxsc2_window.index = -1end#--------------------------------------------------------------------------# ○ 第二カーソルの設置#--------------------------------------------------------------------------def index2    return @xrxsc2_window.indexenddef index2=(index)    @xrxsc2_window.index = index    if index == -1      @xrxsc2_window.cursor_rect.empty    else      @xrxsc2_window.x = self.x      @xrxsc2_window.y = self.y      @xrxsc2_window.cursor_rect = self.cursor_rect    endend#--------------------------------------------------------------------------# ○ 先頭の行の設定#--------------------------------------------------------------------------def top_row=(row)    super    # 補助ウィンドウの oy を更新    pre_oy = @xrxsc2_window.oy    @xrxsc2_window.oy = self.oy    @xrxsc2_window.cursor_rect.y -= self.oy - pre_oyend#--------------------------------------------------------------------------# ○ 解放#--------------------------------------------------------------------------def dispose    @xrxsc2_window.dispose    superend#--------------------------------------------------------------------------# ○ X, Y 座標#--------------------------------------------------------------------------def x=(n)    super    @xrxsc2_window.x = self.x unless @xrxsc2_window.nil?enddef y=(n)    super    @xrxsc2_window.y = self.y unless @xrxsc2_window.nil?endend# ▼▲▼ XRXS26AX. +入れ替えメニュー ver.2 ▼▲▼ built 081113# by 桜雅 在土#==============================================================================# ■ Window_MenuStatus#==============================================================================class Window_MenuStatus < Window_Selectable#--------------------------------------------------------------------------# ○ インクルード#--------------------------------------------------------------------------include XRXS_Cursor2#--------------------------------------------------------------------------# ● 公開インスタンス変数#--------------------------------------------------------------------------attr_reader   :column_max             # 列数#--------------------------------------------------------------------------# ● オブジェクト初期化#--------------------------------------------------------------------------def initialize    h = 480    if MENU_STATUS_STRETCH      h = BATTLE_MAX * 116 + 16    end    super(0, 0, 480, h)    h = ($game_party.actors.size - 1) * LINE_HEIGHT + CURSOR_HEIGHT    self.contents = Bitmap.new(width - 32, h)    self.active = false    self.index = -1end#--------------------------------------------------------------------------# ○ 1 ページに表示できる行数の取得#--------------------------------------------------------------------------def page_row_max    if MENU_STATUS_STRETCH      return BATTLE_MAX          # 戦闘パーティ最大数    else      return .max # 戦闘パーティ最大数(最低4)    endend#--------------------------------------------------------------------------# ○ 先頭の行の取得#--------------------------------------------------------------------------def top_row    # ウィンドウ内容の転送元 Y 座標を、1 行の高さ LINE_HEIGHT で割る    return self.oy / LINE_HEIGHTend#--------------------------------------------------------------------------# ○ 先頭の行の設定#--------------------------------------------------------------------------def top_row=(row)    super    self.oy = self.oy/32 * LINE_HEIGHTend#--------------------------------------------------------------------------# ● カーソルの矩形更新#--------------------------------------------------------------------------def update_cursor_rect    super    unless @index < 0      y = (self.cursor_rect.y + self.oy) * LINE_HEIGHT/32 - self.oy      self.cursor_rect.set(0, y, self.cursor_rect.width, CURSOR_HEIGHT)    endendend#==============================================================================# ■ Scene_Menu#==============================================================================class Scene_Menuinclude BFS_Setting#--------------------------------------------------------------------------# ● フレーム更新#--------------------------------------------------------------------------alias xrxs26ax_update updatedef update    # インデックスを保存    @status_index = @status_window.index    # 呼び戻す    xrxs26ax_updateend#--------------------------------------------------------------------------# ● フレーム更新 (コマンドウィンドウがアクティブの場合)#--------------------------------------------------------------------------alias xrxs26ax_update_command update_commanddef update_command    # 呼び戻す    xrxs26ax_update_command    # 入れ替え移行キーが押されたとき、@command_window.indexが設定値以上    if Input.trigger?(MENU_MEMBER_CHANGE_KEY_GO) and       @command_window.index >= MENU_MEMBER_CHANGE_INDEX_MIN      # 決定 SE を演奏      $game_system.se_play($data_system.decision_se)      # カーソル位置を記憶      @command_index_before_menu_member_change = @command_window.index      # 入れ替えウィンドウへ移行      @command_window.active = false      @command_window.index = -1      @status_window.active = true      @status_window.index = 0    endend#--------------------------------------------------------------------------# ● フレーム更新 (ステータスウィンドウがアクティブの場合)#--------------------------------------------------------------------------alias xrxs26ax_update_status update_statusdef update_status    # 呼び戻す    if @command_window.index != -1      xrxs26ax_update_status      return    end    # B ボタンか入れ替え終了キーが押されたとき    if ((Input.trigger?(Input::B) or Input.trigger?(MENU_MEMBER_CHANGE_KEY_END)) and      @status_window.index2 == -1 and         @status_index%@status_window.column_max == 0)      # キャンセル SE を演奏      $game_system.se_play($data_system.cancel_se)      # コマンドウィンドウをアクティブにする      @command_window.active = true      @command_window.index = 0      @status_window.active = false      @status_window.index = -1      return    end    # B ボタンが押されたとき    if Input.trigger?(Input::B) and @status_window.index2 >= 0      @status_window.index = @status_window.index2      @status_window.index2 = -1      return    end    # 決定キーが押されたとき    if Input.trigger?(Input::C)      if @status_window.index2 == -1      if UNMOVABLE_ACTORS.include?(@status_window.all_actors[@status_window.index].id)          # ブザー SE を演奏          $game_system.se_play($data_system.buzzer_se)          return      end      # 決定 SE を演奏      $game_system.se_play($data_system.decision_se)      # メンバーの入れ替え一人目の決定      @status_window.index2 = @status_window.index      else      if UNMOVABLE_ACTORS.include?(@status_window.all_actors[@status_window.index].id)          # ブザー SE を演奏          $game_system.se_play($data_system.buzzer_se)          return      end      # どちらかが戦闘メンバー かつ どちらかが戦闘禁止アクター の場合      if (@status_window.index < BATTLE_MAX or             @status_window.index2 < BATTLE_MAX) and         (UMBATTLABLE_ACTORS.include?(@status_window.all_actors[@status_window.index].id) or            UMBATTLABLE_ACTORS.include?(@status_window.all_actors[@status_window.index2].id))          # ブザー SE を演奏          $game_system.se_play($data_system.buzzer_se)          return      end      # どちらかが待機メンバー かつ どちらかが待機禁止アクター の場合      if (@status_window.index >= BATTLE_MAX or             @status_window.index2 >= BATTLE_MAX) and         (FORCETOBATTLE_ACTORS.include?(@status_window.all_actors[@status_window.index].id) or            FORCETOBATTLE_ACTORS.include?(@status_window.all_actors[@status_window.index2].id))          # ブザー SE を演奏          $game_system.se_play($data_system.buzzer_se)          return      end      # 決定 SE を演奏      $game_system.se_play($data_system.decision_se)      # メンバーの入れ替え二人目の決定と入れ替えの実行      actor2 = @status_window.all_actors[@status_window.index]      actor = @status_window.all_actors[@status_window.index2]      @status_window.all_actors[@status_window.index2] = actor2      @status_window.all_actors[@status_window.index] = actor      $game_party.actors.clear      $game_party.waiting_actors.clear      for i in 0...@status_window.all_actors.size          if i < BATTLE_MAX            $game_party.actors.push(@status_window.all_actors)          else            $game_party.waiting_actors.push(@status_window.all_actors)          end      end      $game_temp.friends_need_refresh = true      @status_window.index = @status_window.index2      @status_window.index2 = -1      $game_party.friend_party_update      # プレイヤーをリフレッシュ      $game_player.refresh      # ステータスウィンドウをリフレッシュ      @status_window.refresh      end      return    endendend #==============================================================================# ■ Window_MenuStatus#==============================================================================class Window_MenuStatus < Window_Selectable#--------------------------------------------------------------------------# ○ インクルード#--------------------------------------------------------------------------include BFS_Setting#--------------------------------------------------------------------------# ● 公開インスタンス変数#--------------------------------------------------------------------------attr_reader   :newitem_windowattr_reader   :all_actorsattr_reader   :bottomkeyhelp_window#--------------------------------------------------------------------------# ● オブジェクト初期化#--------------------------------------------------------------------------alias xrxs26bx_initialize initializedef initialize    # 呼び戻す    xrxs26bx_initialize    # 寄生してウィンドウを作成    # ボトルキーヘルプウィンドウ    @bottomkeyhelp_window = Window_BottomKeyHelp.new    @bottomkeyhelp_window.visible = false    # 設定変更    self.height   = 448    self.contents = Bitmap.new(width - 32, height - 32)    @all_actors = $game_party.actors + $game_party.waiting_actors    refreshend#--------------------------------------------------------------------------# ● リフレッシュ#--------------------------------------------------------------------------def refresh    self.contents.clear    @item_max = @all_actors.size    @column_max = 2    y = (BATTLE_MAX+1)/2 * 64 + 28    self.contents.font.size = 16    self.contents.font.color = system_color    self.contents.draw_text(4, 0, 92, 28, "参战")    self.contents.draw_text(4, y, 92, 28, "休息")    for i in 0...@all_actors.size      x = 64 + i%2 * 224      y = i/2 *72 + 24      actor = @all_actors      if i >= BATTLE_MAX      y += 32      self.contents.font.color = disabled_color      self.contents.draw_text(x, y, 120, 32, actor.name)      else      draw_actor_name(actor   , x   , y   )      end      draw_actor_graphic(actor, x - 40, y + 64)      draw_actor_level(actor, x + 94, y   )      draw_actor_hp(actor   , x, y + 16)      draw_actor_sp(actor   , x, y + 32)      draw_actor_state(actor, x, y + 48)    endend#--------------------------------------------------------------------------# ○ フレーム更新#--------------------------------------------------------------------------def update    # ウィンドウを更新    @bottomkeyhelp_window.update    superend#--------------------------------------------------------------------------# ○ 解放#--------------------------------------------------------------------------def dispose    @bottomkeyhelp_window.dispose    superend#--------------------------------------------------------------------------# ● カーソルの矩形更新#--------------------------------------------------------------------------def update_cursor_rect    if @index < 0      self.cursor_rect.empty    else      y = @index/2 * 72 + 28      if @index >= BATTLE_MAX      y += 32      end      self.cursor_rect.set(@index%2 * 224, y, 224, 72)    endendend#==============================================================================# ■ Scene_Menu#==============================================================================class Scene_Menu#--------------------------------------------------------------------------# ● フレーム更新#--------------------------------------------------------------------------alias xrxs26bx_update updatedef update    # 登録    if @bottomkeyhelp_window.nil?      @bottomkeyhelp_window = @status_window.bottomkeyhelp_window      @bottomkeyhelp_window.visible = true      set_keyhelp1    end    # 呼び戻す    xrxs26bx_updateend#--------------------------------------------------------------------------# ● フレーム更新 (コマンドウィンドウがアクティブの場合)#--------------------------------------------------------------------------alias xrxs26bx_update_command update_commanddef update_command    # 呼び戻す    xrxs26bx_update_command    # 入れ替え移行キーが押されたとき    if @command_window.index == -1 and @status_window.active      set_keyhelp2    endend#--------------------------------------------------------------------------# ● フレーム更新 (ステータスウィンドウがアクティブの場合)#--------------------------------------------------------------------------alias xrxs26bx_update_status update_statusdef update_status    # 保存    last_index = @status_window.index2    # 呼び戻す    xrxs26bx_update_status    #    if last_index != @status_window.index2      # 一人目を選択した場合      if @status_window.index2 >= 0      set_keyhelp3      else      set_keyhelp2      end    end    # 戻った場合    unless @status_window.active      set_keyhelp1    endend#--------------------------------------------------------------------------# ○ キーヘルプを設定 1#--------------------------------------------------------------------------def set_keyhelp1    @bottomkeyhelp_window.clear    @bottomkeyhelp_window.add("B","关闭本窗口")    @bottomkeyhelp_window.add("C","确定")    @bottomkeyhelp_window.add("→","人物顺序调整")end#--------------------------------------------------------------------------# ○ キーヘルプを設定 2#--------------------------------------------------------------------------def set_keyhelp2    @bottomkeyhelp_window.clear    @bottomkeyhelp_window.add("←,B","返回")    @bottomkeyhelp_window.add("C","第一个人物确定")end#--------------------------------------------------------------------------# ○ キーヘルプを設定 3#--------------------------------------------------------------------------def set_keyhelp3    @bottomkeyhelp_window.clear    @bottomkeyhelp_window.add("B","返回")    @bottomkeyhelp_window.add("C","第二个人物确定")endend#==============================================================================# □ Window_BottomKeyHelp#------------------------------------------------------------------------------#   画面下で操作説明をする透明なウィンドウです。#==============================================================================class Window_BottomKeyHelp < Window_Base#--------------------------------------------------------------------------# ○ オブジェクト初期化#--------------------------------------------------------------------------def initialize    super(0, 432, 640, 64)    self.contents = Bitmap.new(width - 32, height - 32)    self.opacity = 0    clearend#--------------------------------------------------------------------------# ○ クリア#--------------------------------------------------------------------------def clear    self.contents.clear    @now_x = 608end#--------------------------------------------------------------------------# ○ 追加#--------------------------------------------------------------------------def add(key, explanation)    # 計算    self.contents.font.size = 20    x= self.contents.text_size(key).width    self.contents.font.size = 16    x += self.contents.text_size(explanation).width + 8    @now_x -= x    # 描写    self.contents.font.size = 20    self.contents.font.color = system_color    self.contents.draw_text(@now_x, 0, x, 32, key, 0)    self.contents.font.size = 16    self.contents.font.color = normal_color    self.contents.draw_text(@now_x, 0, x, 32, explanation, 2)    # 余白    @now_x -= 32endend复制代码十一结束了,555……
日后只能周末再来搭理BFS了
这里也对某些同党的退出表示惋惜
             本帖来自P1论坛作者heiwang1997,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址:https://rpg.blue/forum.php?mod=viewthread&tid=250962若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。
页: [1]
查看完整版本: 【BFS】【插件】人物扩张脚本