设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索

人物扩张系统的问题

查看数: 3027 | 评论数: 4 | 收藏 0
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2020-7-21 22:54

正文摘要:

本帖最后由 暴走杀神 于 2020-7-24 21:32 编辑 人物数量超出窗口的时候要换人的时候显示不出来,光标往下调的时候看不到,菜单中使用物品和技能也是如此 想弄成像物品界面显示的那种,找了半天不知道怎么弄 自己 ...

回复

爆焰 发表于 2020-8-3 01:22:14
本帖最后由 爆焰 于 2020-8-3 03:29 编辑

替换掉原来的脚本
暴走杀神 发表于 2020-8-1 22:06
目前就用了这些脚本,按你说的换地方放貌似行不通啊

  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================  

  4. # ▼▲▼ XRXS26. 人物扩张系统 ver..05 ▼▲▼
  5. # by 桜雅 在土

  6. #==============================================================================
  7. # □ 初始化定义
  8. #==============================================================================
  9. module XRXS26
  10.   FRONT_MEMBER_LIMIT    = 4        # 战斗参战人数最大值
  11.   BACKWARD_MEMBER_LIMIT = 99        # 待机人数最大值
  12.   BACKWARD_EXP_GAINABLE = false     # 待机人物是否获得经验
  13.   MENU_STATUS_STRETCH   = false    # 3人以下的时候,菜单是否拉伸大小
  14. end
  15. #------------------------------------------------------------------------------
  16. # 菜单页面状态
  17. #------------------------------------------------------------------------------
  18. class Window_MenuStatus < Window_Selectable
  19.   # 列数
  20.   COLUMN_MAX = 1
  21.   # 光标高度
  22.   CURSOR_HEIGHT = 96
  23.   # 一行的高度
  24.   LINE_HEIGHT = 116
  25. end
  26. #------------------------------------------------------------------------------
  27. # 菜单场景
  28. #------------------------------------------------------------------------------
  29. class Scene_Menu
  30.   MENU_MEMBER_CHANGE_KEY_GO    = Input::RIGHT # 进入键
  31.   MENU_MEMBER_CHANGE_KEY_END   = Input::LEFT  # 离开键
  32.   MENU_MEMBER_CHANGE_INDEX_MIN = 0            # 可更换角色最小编号
  33.   FORCETOBATTLE_ACTORS         = []           # 不能待机的角色编号
  34.   UMBATTLABLE_ACTORS           = []           # 不能加入战斗的角色编号
  35.   UNMOVABLE_ACTORS             = []           # 不能移动的角色编号
  36. end
  37. #------------------------------------------------------------------------------
  38. #
  39. # 解説
  40. #    Game_Partyの @actors のうち先頭から↑FRONT_MEMBER_LIMIT番目までのアクターを
  41. #   戦闘メンバーとして、それ以上を待機メンバーとして扱います。
  42. #
  43. #==============================================================================
  44. # ■ Game_Party
  45. #==============================================================================
  46. class Game_Party
  47.   #--------------------------------------------------------------------------
  48.   # ○ インクルード
  49.   #--------------------------------------------------------------------------
  50.   include XRXS26
  51.   #--------------------------------------------------------------------------
  52.   # ○ 公開インスタンス変数
  53.   #--------------------------------------------------------------------------
  54.   attr_reader   :backword_actors          # 待機アクター
  55.   #--------------------------------------------------------------------------
  56.   # ● オブジェクト初期化
  57.   #--------------------------------------------------------------------------
  58.   alias xrxs26_initialize initialize
  59.   def initialize
  60.     xrxs26_initialize
  61.     # 待機メンバー配列を初期化
  62.     @backword_actors = []
  63.   end
  64.   #--------------------------------------------------------------------------
  65.   # ● アクターを加える
  66.   #--------------------------------------------------------------------------
  67.   def add_actor(actor_id)
  68.     # アクターを取得
  69.     actor = $game_actors[actor_id]
  70.     # このアクターがパーティにいない場合
  71.     if not @actors.include?(actor)
  72.       # 満員でないならメンバーに追加
  73.       if @actors.size < (FRONT_MEMBER_LIMIT + BACKWARD_MEMBER_LIMIT)
  74.         # アクターを追加
  75.         @actors.push(actor)
  76.         # プレイヤーをリフレッシュ
  77.         $game_player.refresh
  78.       end
  79.     end
  80.   end
  81. end
  82. #==============================================================================
  83. # ■ Spriteset_Battle
  84. #==============================================================================
  85. class Spriteset_Battle
  86.   #--------------------------------------------------------------------------
  87.   # ● インクルード
  88.   #--------------------------------------------------------------------------
  89.   include XRXS26
  90.   #--------------------------------------------------------------------------
  91.   # ● フレーム更新
  92.   #--------------------------------------------------------------------------
  93.   alias xrxs26_initialize initialize
  94.   def initialize
  95.     xrxs26_initialize
  96.     #
  97.     # 以下、五人目以降のアクタースプライトの追加処理---
  98.     #
  99.     # アクターが表示されるビューポートを、とりあえず先頭の人から取得しとく(素
  100.     actor_viewport = @actor_sprites[0].viewport
  101.     # 戦闘参加メンバーが5人以上の場合
  102.     if FRONT_MEMBER_LIMIT > 4
  103.       for i in 5..FRONT_MEMBER_LIMIT
  104.         # アクタースプライトを追加
  105.         @actor_sprites.push(Sprite_Battler.new(actor_viewport))
  106.         @actor_sprites[i-1].battler = $game_party.actors[i-1]
  107.       end
  108.     end
  109.     # ビューポートを更新
  110.     actor_viewport.update
  111.   end
  112. end
  113. #==============================================================================
  114. # ■ Scene_Battle
  115. #==============================================================================
  116. class Scene_Battle
  117.   #--------------------------------------------------------------------------
  118.   # ● インクルード
  119.   #--------------------------------------------------------------------------
  120.   include XRXS26
  121.   #--------------------------------------------------------------------------
  122.   # ● メイン処理 をパーティメンバー処理ではさむ
  123.   #--------------------------------------------------------------------------
  124.   alias xrxs26_main main
  125.   def main
  126.     # 待機メンバーへ退避----------
  127.     $game_party.backword_actors[0,0] = $game_party.actors[FRONT_MEMBER_LIMIT, BACKWARD_MEMBER_LIMIT]
  128.     $game_party.actors[FRONT_MEMBER_LIMIT, BACKWARD_MEMBER_LIMIT] = nil
  129.     $game_party.actors.compact!
  130.     # メイン処理
  131.     xrxs26_main
  132.     # 待機メンバーから復帰
  133.     $game_party.actors[$game_party.actors.size,0] = $game_party.backword_actors
  134.     $game_party.backword_actors.clear
  135.   end
  136.   #--------------------------------------------------------------------------
  137.   # ● アフターバトルフェーズ開始
  138.   #--------------------------------------------------------------------------
  139.   alias xrxs26_start_phase5 start_phase5
  140.   def start_phase5
  141.     # 「待機メンバー経験値獲得」が有効 and 待機アクターが一人以上いる
  142.     if BACKWARD_EXP_GAINABLE and $game_party.backword_actors.size >= 1
  143.       # 待機メンバーから復帰
  144.       $game_party.actors[$game_party.actors.size,0] = $game_party.backword_actors
  145.       $game_party.backword_actors.clear
  146.       # 呼び戻す
  147.       xrxs26_start_phase5
  148.       # 待機メンバーへ退避----------
  149.       $game_party.backword_actors[0,0] = $game_party.actors[FRONT_MEMBER_LIMIT, BACKWARD_MEMBER_LIMIT]
  150.       $game_party.actors[FRONT_MEMBER_LIMIT, BACKWARD_MEMBER_LIMIT] = nil
  151.       $game_party.actors.compact!
  152.     else
  153.       # 呼び戻す
  154.       xrxs26_start_phase5
  155.     end
  156.   end
  157. end
  158. # ▽△▽ XRXL 4. 第二カーソル 機構 ▽△▽
  159. # by 桜雅 在土

  160. #==============================================================================
  161. # --- XRXS. 第二カーソル 機構 ---
  162. #------------------------------------------------------------------------------
  163. #     ウィンドウに .index2 プロパティを追加します。
  164. #==============================================================================
  165. module XRXS_Cursor2
  166.   #--------------------------------------------------------------------------
  167.   # ● オブジェクト初期化
  168.   #--------------------------------------------------------------------------
  169.   def initialize(x, y, w, h)
  170.     super(x, y, h, w)
  171.     # 補助ウィンドウ(透明)を作成:カーソル専用
  172.     @xrxsc2_window = Window_Selectable.new(self.x, self.y, self.width, self.height)
  173.     @xrxsc2_window.opacity = 0
  174.     @xrxsc2_window.active = false
  175.     @xrxsc2_window.index = -1
  176.   end
  177.   #--------------------------------------------------------------------------
  178.   # ○ 第二カーソルの設置
  179.   #--------------------------------------------------------------------------
  180.   def index2
  181.     return @xrxsc2_window.index
  182.   end
  183.   def index2=(index)
  184.     @xrxsc2_window.index = index
  185.     if index == -1
  186.       @xrxsc2_window.cursor_rect.empty
  187.     else
  188.       @xrxsc2_window.x = self.x
  189.       @xrxsc2_window.y = self.y
  190.       @xrxsc2_window.cursor_rect = self.cursor_rect
  191.     end
  192.   end
  193.   #--------------------------------------------------------------------------
  194.   # ○ 先頭の行の設定
  195.   #--------------------------------------------------------------------------
  196.   def top_row=(row)
  197.     super
  198.     # 補助ウィンドウの oy を更新
  199.     pre_oy = @xrxsc2_window.oy
  200.     @xrxsc2_window.oy = self.oy
  201.     @xrxsc2_window.cursor_rect.y -= self.oy - pre_oy
  202.   end
  203.   #--------------------------------------------------------------------------
  204.   # ○ 解放
  205.   #--------------------------------------------------------------------------
  206.   def dispose
  207.     @xrxsc2_window.dispose
  208.     super
  209.   end
  210.   #--------------------------------------------------------------------------
  211.   # ○ X, Y 座標
  212.   #--------------------------------------------------------------------------
  213.   def x=(n)
  214.     super
  215.     @xrxsc2_window.x = self.x unless @xrxsc2_window.nil?
  216.   end
  217.   def y=(n)
  218.     super
  219.     @xrxsc2_window.y = self.y unless @xrxsc2_window.nil?
  220.   end
  221. end
  222. # ▼▲▼ XRXS26AX. +入れ替えメニュー ver.2 ▼▲▼ built 081113
  223. # by 桜雅 在土

  224. #==============================================================================
  225. # ■ Window_MenuStatus
  226. #==============================================================================
  227. class Window_MenuStatus < Window_Selectable
  228.   #--------------------------------------------------------------------------
  229.   # ○ インクルード
  230.   #--------------------------------------------------------------------------
  231.   include XRXS26
  232.   include XRXS_Cursor2
  233.   #--------------------------------------------------------------------------
  234.   # ● 公開インスタンス変数
  235.   #--------------------------------------------------------------------------
  236.   attr_reader   :column_max             # 列数
  237.   #--------------------------------------------------------------------------
  238.   # ● オブジェクト初期化
  239.   #--------------------------------------------------------------------------
  240.   def initialize
  241.     h = 480
  242.     if MENU_STATUS_STRETCH
  243.       h = FRONT_MEMBER_LIMIT * 116 + 16
  244.     end
  245.     super(0, 0, 480, h)
  246.     h = ($game_party.actors.size - 1) * LINE_HEIGHT + CURSOR_HEIGHT
  247.     self.contents = Bitmap.new(width - 32, h)
  248.     refresh
  249.     self.active = false
  250.     self.index = -1
  251.   end
  252.   #--------------------------------------------------------------------------
  253.   # ○ 1 ページに表示できる行数の取得
  254.   #--------------------------------------------------------------------------
  255.   def page_row_max
  256.     if MENU_STATUS_STRETCH
  257.       return FRONT_MEMBER_LIMIT          # 戦闘パーティ最大数
  258.     else
  259.       return [FRONT_MEMBER_LIMIT, 4].max # 戦闘パーティ最大数(最低4)
  260.     end
  261.   end
  262.   #--------------------------------------------------------------------------
  263.   # ○ 先頭の行の取得
  264.   #--------------------------------------------------------------------------
  265.   def top_row
  266.     # ウィンドウ内容の転送元 Y 座標を、1 行の高さ LINE_HEIGHT で割る
  267.     return self.oy / LINE_HEIGHT
  268.   end
  269.   #--------------------------------------------------------------------------
  270.   # ○ 先頭の行の設定
  271.   #--------------------------------------------------------------------------
  272.   def top_row=(row)
  273.     super
  274.     self.oy = self.oy/32 * LINE_HEIGHT
  275.   end
  276.   #--------------------------------------------------------------------------
  277.   # ● カーソルの矩形更新
  278.   #--------------------------------------------------------------------------
  279.   def update_cursor_rect
  280.     super
  281.     unless @index < 0
  282.       y = (self.cursor_rect.y + self.oy) * LINE_HEIGHT/32 - self.oy
  283.       self.cursor_rect.set(0, y, self.cursor_rect.width, CURSOR_HEIGHT)
  284.     end
  285.   end
  286. end
  287. #==============================================================================
  288. # ■ Scene_Menu
  289. #==============================================================================
  290. class Scene_Menu
  291.   #--------------------------------------------------------------------------
  292.   # ○ インクルード
  293.   #--------------------------------------------------------------------------
  294.   include XRXS26
  295.   #--------------------------------------------------------------------------
  296.   # ● フレーム更新
  297.   #--------------------------------------------------------------------------
  298.   alias xrxs26ax_update update
  299.   def update
  300.     # インデックスを保存
  301.     @status_index = @status_window.index
  302.     # 呼び戻す
  303.     xrxs26ax_update
  304.   end
  305.   #--------------------------------------------------------------------------
  306.   # ● フレーム更新 (コマンドウィンドウがアクティブの場合)
  307.   #--------------------------------------------------------------------------
  308.   alias xrxs26ax_update_command update_command
  309.   def update_command
  310.     # 呼び戻す
  311.     xrxs26ax_update_command
  312.     # 入れ替え移行キーが押されたとき、@command_window.indexが設定値以上
  313.     if Input.trigger?(MENU_MEMBER_CHANGE_KEY_GO) and
  314.        @command_window.index >= MENU_MEMBER_CHANGE_INDEX_MIN
  315.       # 決定 SE を演奏
  316.       $game_system.se_play($data_system.decision_se)
  317.       # カーソル位置を記憶
  318.       @command_index_before_menu_member_change = @command_window.index
  319.       # 入れ替えウィンドウへ移行
  320.       @command_window.active = false
  321.       @command_window.index = -1
  322.       @status_window.active = true
  323.       @status_window.index = 0
  324.     end
  325.   end
  326.   #--------------------------------------------------------------------------
  327.   # ● フレーム更新 (ステータスウィンドウがアクティブの場合)
  328.   #--------------------------------------------------------------------------
  329.   alias xrxs26ax_update_status update_status
  330.   def update_status
  331.     # 呼び戻す
  332.     if @command_window.index != -1
  333.       xrxs26ax_update_status
  334.       return
  335.     end
  336.     # B ボタンか入れ替え終了キーが押されたとき
  337.     if ((Input.trigger?(Input::B) or Input.trigger?(MENU_MEMBER_CHANGE_KEY_END)) and
  338.         @status_window.index2 == -1 and
  339.         @status_index%@status_window.column_max == 0)
  340.       # キャンセル SE を演奏
  341.       $game_system.se_play($data_system.cancel_se)
  342.       # コマンドウィンドウをアクティブにする
  343.       @command_window.active = true
  344.       @command_window.index = 0
  345.       @status_window.active = false
  346.       @status_window.index = -1
  347.       return
  348.     end
  349.     # B ボタンが押されたとき
  350.     if Input.trigger?(Input::B) and @status_window.index2 >= 0
  351.       @status_window.index = @status_window.index2
  352.       @status_window.index2 = -1
  353.       return
  354.     end
  355.     # 決定キーが押されたとき
  356.     if Input.trigger?(Input::C)
  357.       if @status_window.index2 == -1
  358.         if UNMOVABLE_ACTORS.include?($game_party.actors[@status_window.index].id)
  359.           # ブザー SE を演奏
  360.           $game_system.se_play($data_system.buzzer_se)
  361.           return
  362.         end
  363.         # 決定 SE を演奏
  364.         $game_system.se_play($data_system.decision_se)
  365.         # メンバーの入れ替え一人目の決定
  366.         @status_window.index2 = @status_window.index
  367.       else
  368.         if UNMOVABLE_ACTORS.include?($game_party.actors[@status_window.index].id)
  369.           # ブザー SE を演奏
  370.           $game_system.se_play($data_system.buzzer_se)
  371.           return
  372.         end
  373.         # どちらかが戦闘メンバー かつ どちらかが戦闘禁止アクター の場合
  374.         if (@status_window.index < FRONT_MEMBER_LIMIT or
  375.             @status_window.index2 < FRONT_MEMBER_LIMIT) and
  376.            (UMBATTLABLE_ACTORS.include?($game_party.actors[@status_window.index].id) or
  377.             UMBATTLABLE_ACTORS.include?($game_party.actors[@status_window.index2].id))
  378.           # ブザー SE を演奏
  379.           $game_system.se_play($data_system.buzzer_se)
  380.           return
  381.         end
  382.         # どちらかが待機メンバー かつ どちらかが待機禁止アクター の場合
  383.         if (@status_window.index >= FRONT_MEMBER_LIMIT or
  384.             @status_window.index2 >= FRONT_MEMBER_LIMIT) and
  385.            (FORCETOBATTLE_ACTORS.include?($game_party.actors[@status_window.index].id) or
  386.             FORCETOBATTLE_ACTORS.include?($game_party.actors[@status_window.index2].id))
  387.           # ブザー SE を演奏
  388.           $game_system.se_play($data_system.buzzer_se)
  389.           return
  390.         end
  391.         # 決定 SE を演奏
  392.         $game_system.se_play($data_system.decision_se)
  393.         # メンバーの入れ替え二人目の決定と入れ替えの実行
  394.         actor2 = $game_party.actors[@status_window.index]
  395.         actor = $game_party.actors[@status_window.index2]
  396.         $game_party.actors[@status_window.index2] = actor2
  397.         $game_party.actors[@status_window.index] = actor
  398.         @status_window.index = @status_window.index2
  399.         @status_window.index2 = -1
  400.         # プレイヤーをリフレッシュ
  401.         $game_player.refresh
  402.         # ステータスウィンドウをリフレッシュ
  403.         @status_window.refresh
  404.       end
  405.       return
  406.     end
  407.   end
  408. end


  409. #==============================================================================
  410. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  411. #==============================================================================

  412. class Scene_Save
  413.   #--------------------------------------------------------------------------
  414.   # ● 写入存档数据
  415.   #     file : 写入用文件对像 (已经打开)
  416.   #--------------------------------------------------------------------------
  417.   def write_save_data(file)
  418.     # 生成描绘存档文件用的角色图形
  419.     characters = []
  420.     for i in 0...[$game_party.actors.size,4].min
  421.       actor = $game_party.actors[i]
  422.       characters.push([actor.character_name, actor.character_hue])
  423.     end
  424.     # 写入描绘存档文件用的角色数据
  425.     Marshal.dump(characters, file)
  426.     # 写入测量游戏时间用画面计数
  427.     Marshal.dump(Graphics.frame_count, file)
  428.     # 增加 1 次存档次数
  429.     $game_system.save_count += 1
  430.     # 保存魔法编号
  431.     # (将编辑器保存的值以随机值替换)
  432.     $game_system.magic_number = $data_system.magic_number
  433.     # 写入各种游戏对像
  434.     Marshal.dump($game_system, file)
  435.     Marshal.dump($game_switches, file)
  436.     Marshal.dump($game_variables, file)
  437.     Marshal.dump($game_self_switches, file)
  438.     Marshal.dump($game_screen, file)
  439.     Marshal.dump($game_actors, file)
  440.     Marshal.dump($game_party, file)
  441.     Marshal.dump($game_troop, file)
  442.     Marshal.dump($game_map, file)
  443.     Marshal.dump($game_player, file)
  444.   end
  445. end

  446. class Scene_Battle
  447.   #--------------------------------------------------------------------------
  448.   # ● 设置物品或特技对像方的战斗者
  449.   #     scope : 特技或者是物品的范围
  450.   #--------------------------------------------------------------------------
  451.   def set_target_battlers(scope)
  452.     # 行动方的战斗者是敌人的情况下
  453.     if @active_battler.is_a?(Game_Enemy)
  454.       # 效果范围分支
  455.       case scope
  456.       when 1  # 敌单体
  457.         index = @active_battler.current_action.target_index
  458.         @target_battlers.push($game_party.smooth_target_actor(index))
  459.       when 2  # 敌全体
  460.         for actor in 0...[$game_party.actors.size,4].min
  461.           if $game_party.actors[actor].exist?
  462.             @target_battlers.push($game_party.actors[actor])
  463.           end
  464.         end
  465.       when 3  # 我方单体
  466.         index = @active_battler.current_action.target_index
  467.         @target_battlers.push($game_troop.smooth_target_enemy(index))
  468.       when 4  # 我方全体
  469.         for enemy in $game_troop.enemies
  470.           if enemy.exist?
  471.             @target_battlers.push(enemy)
  472.           end
  473.         end
  474.       when 5  # 我方单体 (HP 0)
  475.         index = @active_battler.current_action.target_index
  476.         enemy = $game_troop.enemies[index]
  477.         if enemy != nil and enemy.hp0?
  478.           @target_battlers.push(enemy)
  479.         end
  480.       when 6  # 我方全体 (HP 0)
  481.         for enemy in $game_troop.enemies
  482.           if enemy != nil and enemy.hp0?
  483.             @target_battlers.push(enemy)
  484.           end
  485.         end
  486.       when 7  # 使用者
  487.         @target_battlers.push(@active_battler)
  488.       end
  489.     end
  490.     # 行动方的战斗者是角色的情况下
  491.     if @active_battler.is_a?(Game_Actor)
  492.       # 效果范围分支
  493.       case scope
  494.       when 1  # 敌单体
  495.         index = @active_battler.current_action.target_index
  496.         @target_battlers.push($game_troop.smooth_target_enemy(index))
  497.       when 2  # 敌全体
  498.         for enemy in $game_troop.enemies
  499.           if enemy.exist?
  500.             @target_battlers.push(enemy)
  501.           end
  502.         end
  503.       when 3  # 我方单体
  504.         index = @active_battler.current_action.target_index
  505.         @target_battlers.push($game_party.smooth_target_actor(index))
  506.       when 4  # 我方全体
  507.         for actor in 0...[$game_party.actors.size,4].min
  508.           if $game_party.actors[actor].exist?
  509.             @target_battlers.push($game_party.actors[actor])
  510.           end
  511.         end
  512.       when 5  # 我方单体 (HP 0)
  513.         index = @active_battler.current_action.target_index
  514.         actor = $game_party.actors[index]
  515.         if actor != nil and actor.hp0?
  516.           @target_battlers.push(actor)
  517.         end
  518.       when 6  # 我方全体 (HP 0)
  519.         for actor in 0...[$game_party.actors.size,4].min
  520.           if $game_party.actors[actor] != nil and $game_party.actors[actor].hp0?
  521.             @target_battlers.push($game_party.actors[actor])
  522.           end
  523.         end
  524.       when 7  # 使用者
  525.         @target_battlers.push(@active_battler)
  526.       end
  527.     end
  528.   end  
  529.   #--------------------------------------------------------------------------
  530.   # ● 生成行动循序
  531.   #--------------------------------------------------------------------------
  532.   def make_action_orders
  533.     # 初始化序列 @action_battlers
  534.     @action_battlers = []
  535.     # 添加敌人到 @action_battlers 序列
  536.     for enemy in $game_troop.enemies
  537.       @action_battlers.push(enemy)
  538.     end
  539.     # 添加角色到 @action_battlers 序列
  540.     for actor in 0...[$game_party.actors.size,4].min
  541.       @action_battlers.push($game_party.actors[actor])
  542.     end
  543.     # 确定全体的行动速度
  544.     for battler in @action_battlers
  545.       battler.make_action_speed
  546.     end
  547.     # 按照行动速度从大到小排列
  548.     @action_battlers.sort! {|a,b|
  549.       b.current_action.speed - a.current_action.speed }
  550.   end
  551.   #--------------------------------------------------------------------------
  552.   # ● 开始结束战斗回合
  553.   #--------------------------------------------------------------------------
  554.   def start_phase5
  555.     # 转移到回合 5
  556.     @phase = 5
  557.     # 演奏战斗结束 ME
  558.     $game_system.me_play($game_system.battle_end_me)
  559.     # 还原为战斗开始前的 BGM
  560.     $game_system.bgm_play($game_temp.map_bgm)
  561.     # 初始化 EXP、金钱、宝物
  562.     exp = 0
  563.     gold = 0
  564.     treasures = []
  565.     # 循环
  566.     for enemy in $game_troop.enemies
  567.       # 敌人不是隐藏状态的情况下
  568.       unless enemy.hidden
  569.         # 获得 EXP、增加金钱
  570.         exp += enemy.exp
  571.         gold += enemy.gold
  572.         # 出现宝物判定
  573.         if rand(100) < enemy.treasure_prob
  574.           if enemy.item_id > 0
  575.             treasures.push($data_items[enemy.item_id])
  576.           end
  577.           if enemy.weapon_id > 0
  578.             treasures.push($data_weapons[enemy.weapon_id])
  579.           end
  580.           if enemy.armor_id > 0
  581.             treasures.push($data_armors[enemy.armor_id])
  582.           end
  583.         end
  584.       end
  585.     end
  586.     # 限制宝物数为 6 个
  587.     treasures = treasures[0..5]
  588.     # 获得 EXP
  589.     for i in 0...[$game_party.actors.size,4].min
  590.       actor = $game_party.actors[i]
  591.       if actor.cant_get_exp? == false
  592.         last_level = actor.level
  593.         actor.exp += exp
  594.         if actor.level > last_level
  595.           @status_window.level_up(i)
  596.         end
  597.       end
  598.     end
  599.     # 获得金钱
  600.     $game_party.gain_gold(gold)
  601.     # 获得宝物
  602.     for item in treasures
  603.       case item
  604.       when RPG::Item
  605.         $game_party.gain_item(item.id, 1)
  606.       when RPG::Weapon
  607.         $game_party.gain_weapon(item.id, 1)
  608.       when RPG::Armor
  609.         $game_party.gain_armor(item.id, 1)
  610.       end
  611.     end
  612.     # 生成战斗结果窗口
  613.     @result_window = Window_BattleResult.new(exp, gold, treasures)
  614.     # 设置等待计数
  615.     @phase5_wait_count = 100
  616.   end
  617.   #--------------------------------------------------------------------------
  618.   # ● 转到输入下一个角色的命令
  619.   #--------------------------------------------------------------------------
  620.   def phase3_next_actor
  621.     # 循环
  622.     begin
  623.       # 角色的明灭效果 OFF
  624.       if @active_battler != nil
  625.         @active_battler.blink = false
  626.       end
  627.       # 最后的角色的情况
  628.       if @actor_index == [$game_party.actors.size-1,3].min
  629.         # 开始主回合
  630.         start_phase4
  631.         return
  632.       end
  633.       # 推进角色索引
  634.       @actor_index += 1
  635.       @active_battler = $game_party.actors[@actor_index]
  636.       @active_battler.blink = true
  637.     # 如果角色是在无法接受指令的状态就再试
  638.     end until @active_battler.inputable?
  639.     # 设置角色的命令窗口
  640.     phase3_setup_command_window
  641.   end
  642. end

  643. class Arrow_Actor < Arrow_Base  
  644.   #--------------------------------------------------------------------------
  645.   # ● 刷新画面
  646.   #--------------------------------------------------------------------------
  647.   def update
  648.     super
  649.     # 光标右
  650.     if Input.repeat?(Input::RIGHT)
  651.       $game_system.se_play($data_system.cursor_se)
  652.       @index += 1
  653.       @index %= [$game_party.actors.size,4].min
  654.     end
  655.     # 光标左
  656.     if Input.repeat?(Input::LEFT)
  657.       $game_system.se_play($data_system.cursor_se)
  658.       @index += $game_party.actors.size - 1
  659.       @index %= [$game_party.actors.size,4].min
  660.     end
  661.     # 设置活动块坐标
  662.     if self.actor != nil
  663.       self.x = self.actor.screen_x
  664.       self.y = self.actor.screen_y
  665.     end
  666.   end
  667. end

  668. #==============================================================================
  669. # ■ Window_Target
  670. #------------------------------------------------------------------------------
  671. #  物品画面与特技画面的、使用对像角色选择窗口。
  672. #==============================================================================

  673. class Window_Target < Window_Selectable
  674. #--------------------------------------------------------------------------
  675. # ● 初始化对像
  676. #--------------------------------------------------------------------------
  677. def initialize
  678.    super(0, 0, 336, 480)
  679.    self.contents = Bitmap.new(width - 32, $game_party.actors.size*112)
  680.    self.z += 10
  681.    @item_max = $game_party.actors.size
  682.    @top_row = 0
  683.    refresh
  684. end
  685. #--------------------------------------------------------------------------
  686. # ● 刷新
  687. #--------------------------------------------------------------------------
  688. def refresh
  689.    self.contents.clear
  690.    for i in 0...$game_party.actors.size
  691.      x = 4
  692.      y = i * 112
  693.      actor = $game_party.actors[i]
  694.      draw_actor_name(actor, x, y)
  695.      draw_actor_class(actor, x + 144, y)
  696.      draw_actor_level(actor, x + 8, y + 32)
  697.      draw_actor_state(actor, x + 8, y + 64)
  698.      draw_actor_hp(actor, x + 152, y + 32)
  699.      draw_actor_sp(actor, x + 152, y + 64)
  700.    end
  701. end  
  702. #--------------------------------------------------------------------------
  703. # ● 刷新光标矩形
  704. #--------------------------------------------------------------------------
  705. def update_cursor_rect   
  706.    # 光标位置 -1 为全选、-2 以下为单独选择 (使用者自身)
  707.    if @index <= -2
  708.      self.cursor_rect.set(0, (@index + 10) * 112, self.width - 32, 96)
  709.    elsif @index == -1
  710.      self.cursor_rect.set(0, 0, self.width - 32, @item_max * 112 - 20)
  711.    else
  712.      tpy = @index * 112 - self.oy
  713.      self.cursor_rect.set(0, tpy, self.width - 32, 96)
  714.      if @index < @top_row
  715.        @top_row = @index
  716.        self.oy = @top_row *112
  717.      end
  718.      if @index > @top_row+3
  719.        @top_row = @index-3
  720.        self.oy = @top_row *112
  721.      end
  722.    end   
  723. end
  724. end
  725. #==============================================================================
  726. # ■ Window_MenuStatus
  727. #------------------------------------------------------------------------------
  728. #  显示菜单画面和同伴状态的窗口。
  729. #==============================================================================

  730. class Window_MenuStatus < Window_Selectable
  731.   #--------------------------------------------------------------------------
  732.   # ● 初始化目标
  733.   #--------------------------------------------------------------------------
  734.   def initialize
  735.     super(0, 0, 480, 480)
  736.     self.contents = Bitmap.new(width - 32,  $game_party.actors.size*112)
  737.     refresh
  738.     @top_row = 0
  739.     self.active = false
  740.     self.index = -1
  741.   end
  742.   #--------------------------------------------------------------------------
  743.   # ● 刷新
  744.   #--------------------------------------------------------------------------
  745.   def refresh
  746.     self.contents.clear
  747.     @item_max = $game_party.actors.size
  748.     for i in 0...$game_party.actors.size
  749.       x = 64
  750.       y = i * 112
  751.       if i <=3
  752.         self.contents.font.color = Color.new(0,255,0,255)
  753.         self.contents.draw_text(x,y,340,32,"[出战]",2)
  754.         self.contents.font.color = normal_color
  755.       else
  756.         self.contents.font.color = Color.new(128,128,128,255)
  757.         self.contents.draw_text(x,y,340,32,"[待机]",2)
  758.         self.contents.font.color = normal_color
  759.       end
  760.       actor = $game_party.actors[i]
  761.       draw_actor_graphic(actor, x - 40, y + 80)
  762.       draw_actor_name(actor, x, y)
  763.       draw_actor_class(actor, x + 144, y)
  764.       draw_actor_level(actor, x, y + 32)
  765.       draw_actor_state(actor, x + 90, y + 32)
  766.       draw_actor_exp(actor, x, y + 64)
  767.       draw_actor_hp(actor, x + 236, y + 32)
  768.       draw_actor_sp(actor, x + 236, y + 64)
  769.     end
  770.   end
  771.   #--------------------------------------------------------------------------
  772.   # ● 刷新光标矩形
  773.   #--------------------------------------------------------------------------
  774.   def update_cursor_rect
  775.     if @index < 0
  776.       self.cursor_rect.empty
  777.     else
  778.       tpy = @index * 112 - self.oy
  779.       self.cursor_rect.set(0, tpy, self.width - 32, 96)
  780.       if @index < @top_row
  781.         @top_row = @index
  782.         self.oy = @top_row *112
  783.       end
  784.       if @index > @top_row+3
  785.         @top_row = @index-3
  786.         self.oy = @top_row *112
  787.       end
  788.     end
  789.   end
  790. end

  791. class Game_Party
  792.   #--------------------------------------------------------------------------
  793.   # ● 全灭判定
  794.   #--------------------------------------------------------------------------
  795.   def all_dead?
  796.     # 同伴人数为 0 的情况下
  797.     if $game_party.actors.size == 0
  798.       return false
  799.     end
  800.     # 同伴中无人 HP 在 0 以上
  801.     for i in 0..3
  802.       if @actors[i] != nil and@actors[i].hp >0
  803.         return false
  804.       end
  805.     end
  806.     # 全灭
  807.     return true
  808.   end
  809.   #--------------------------------------------------------------------------
  810.   # ● 加入同伴
  811.   #     actor_id : 角色 ID
  812.   #--------------------------------------------------------------------------
  813.   def add_actor(actor_id)
  814.     # 获取角色
  815.     actor = $game_actors[actor_id]
  816.     # 同伴人数未满 4 人、本角色不在队伍中的情况下
  817.     if not @actors.include?(actor)
  818.       # 添加角色
  819.       @actors.push(actor)
  820.       # 还原主角
  821.       $game_player.refresh
  822.     end
  823.   end
  824. end
复制代码

点评

好像是多出了那段原战斗系统的脚本,我用的RTAB战斗系统。不过我把整队里面的战斗系统那段删了,战斗系统就没问题了  发表于 2020-8-4 12:13
什么样的冲突?这个应该跟战斗系统无关的才对  发表于 2020-8-4 08:58
我又看了下,除了默认战斗系统,这个脚本对于其他的cp制战斗系统还是有冲突的  发表于 2020-8-3 20:24
游戏做好记得给我分享一下O(∩_∩)O  发表于 2020-8-3 13:16
谢了,这个的效果比之前舒服多了  发表于 2020-8-3 12:59

评分

参与人数 2星屑 +50 +2 收起 理由
RyanBern + 50 + 1 认可答案
暴走杀神 + 1 塞糖

查看全部评分

爆焰 发表于 2020-7-30 10:43:59
是不是用了除了这个还有其他同样的脚本了?有些被覆盖了。试试调换一下脚本的上下的位置
暴走杀神 发表于 2020-7-27 20:55:59
没人么?看来这个问题很复杂啊
拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2025-8-7 22:47

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表