Project1

标题: 战斗中添加全员攻击选项 [打印本页]

作者: 夜狠简单    时间: 2013-6-8 10:07
标题: 战斗中添加全员攻击选项
本帖最后由 夜狠简单 于 2013-6-15 17:00 编辑

添加这个项目的目的在于,有时候打怪的时候自己队伍比较强了。不想一个一个队员去点击攻击,所以添加一个“全员攻击”的选择项,让队伍里的所以伙伴对敌人发起普通攻击
首先我们在Scene_Battle 1里的30~31行处修改.看30~31处就行.
  1. #==============================================================================
  2. # ■ Scene_Battle (分割定义 1)
  3. #------------------------------------------------------------------------------
  4. #  处理战斗画面的类。
  5. #==============================================================================

  6. class Scene_Battle
  7.   #--------------------------------------------------------------------------
  8.   # ● 主处理
  9.   #--------------------------------------------------------------------------
  10.   def main
  11.     # 初始化战斗用的各种暂时数据
  12.     $game_temp.in_battle = true
  13.     $game_temp.battle_turn = 0
  14.     $game_temp.battle_event_flags.clear
  15.     $game_temp.battle_abort = false
  16.     $game_temp.battle_main_phase = false
  17.     $game_temp.battleback_name = $game_map.battleback_name
  18.     $game_temp.forcing_battler = nil
  19.     # 初始化战斗用事件解释器
  20.     $game_system.battle_interpreter.setup(nil, 0)
  21.     # 准备队伍
  22.     @troop_id = $game_temp.battle_troop_id
  23.     $game_troop.setup(@troop_id)
  24.     # 生成角色命令窗口
  25.     s1 = $data_system.words.attack
  26.     s2 = $data_system.words.skill
  27.     s3 = $data_system.words.guard
  28.     s4 = $data_system.words.item
  29.     @actor_command_window = Window_Command.new(160, ["全员攻击",s1, s2, s3, s4])
  30.     @actor_command_window.y = 128
  31.     @actor_command_window.back_opacity = 160
  32.     @actor_command_window.active = false
  33.     @actor_command_window.visible = false
  34.     # 生成其它窗口
  35.     @party_command_window = Window_PartyCommand.new
  36.     @help_window = Window_Help.new
  37.     @help_window.back_opacity = 160
  38.     @help_window.visible = false
  39.     @status_window = Window_BattleStatus.new
  40.     @message_window = Window_Message.new
  41.     # 生成活动块
  42.     @spriteset = Spriteset_Battle.new
  43.     # 初始化等待计数
  44.     @wait_count = 0
  45.     # 执行过渡
  46.     if $data_system.battle_transition == ""
  47.       Graphics.transition(20)
  48.     else
  49.       Graphics.transition(40, "Graphics/Transitions/" +
  50.         $data_system.battle_transition)
  51.     end
  52.     # 开始自由战斗回合
  53.     start_phase1
  54.     # 主循环
  55.     loop do
  56.       # 刷新游戏画面
  57.       Graphics.update
  58.       # 刷新输入信息
  59.       Input.update
  60.       # 刷新画面
  61.       update
  62.       # 如果画面切换的话就中断循环
  63.       if $scene != self
  64.         break
  65.       end
  66.     end
  67.     # 刷新地图
  68.     $game_map.refresh
  69.     # 准备过渡
  70.     Graphics.freeze
  71.     # 释放窗口
  72.     @actor_command_window.dispose
  73.     @party_command_window.dispose
  74.     @help_window.dispose
  75.     @status_window.dispose
  76.     @message_window.dispose
  77.     if @skill_window != nil
  78.       @skill_window.dispose
  79.     end
  80.     if @item_window != nil
  81.       @item_window.dispose
  82.     end
  83.     if @result_window != nil
  84.       @result_window.dispose
  85.     end
  86.     # 释放活动块
  87.     @spriteset.dispose
  88.     # 标题画面切换中的情况
  89.     if $scene.is_a?(Scene_Title)
  90.       # 淡入淡出画面
  91.       Graphics.transition
  92.       Graphics.freeze
  93.     end
  94.     # 战斗测试或者游戏结束以外的画面切换中的情况
  95.     if $BTEST and not $scene.is_a?(Scene_Gameover)
  96.       $scene = nil
  97.     end
  98.   end
  99.   #--------------------------------------------------------------------------
  100.   # ● 胜负判定
  101.   #--------------------------------------------------------------------------
  102.   def judge
  103.     # 全灭判定是真、并且同伴人数为 0 的情况下
  104.     if $game_party.all_dead? or $game_party.actors.size == 0
  105.       # 允许失败的情况下
  106.       if $game_temp.battle_can_lose
  107.         # 还原为战斗开始前的 BGM
  108.         $game_system.bgm_play($game_temp.map_bgm)
  109.         # 战斗结束
  110.         battle_end(2)
  111.         # 返回 true
  112.         return true
  113.       end
  114.       # 设置游戏结束标志
  115.       $game_temp.gameover = true
  116.       # 返回 true
  117.       return true
  118.     end
  119.     # 如果存在任意 1 个敌人就返回 false
  120.     for enemy in $game_troop.enemies
  121.       if enemy.exist?
  122.         return false
  123.       end
  124.     end
  125.     # 开始结束战斗回合 (胜利)
  126.     start_phase5
  127.     # 返回 true
  128.     return true
  129.   end
  130.   #--------------------------------------------------------------------------
  131.   # ● 战斗结束
  132.   #     result : 結果 (0:胜利 1:失败 2:逃跑)
  133.   #--------------------------------------------------------------------------
  134.   def battle_end(result)
  135.     # 清除战斗中标志
  136.     $game_temp.in_battle = false
  137.     # 清除全体同伴的行动
  138.     $game_party.clear_actions
  139.     # 解除战斗用状态
  140.     for actor in $game_party.actors
  141.       actor.remove_states_battle
  142.     end
  143.     # 清除敌人
  144.     $game_troop.enemies.clear
  145.     # 调用战斗返回
  146.     if $game_temp.battle_proc != nil
  147.       $game_temp.battle_proc.call(result)
  148.       $game_temp.battle_proc = nil
  149.     end
  150.     # 切换到地图画面
  151.     $scene = Scene_Map.new
  152.   end
  153.   #--------------------------------------------------------------------------
  154.   # ● 设置战斗事件
  155.   #--------------------------------------------------------------------------
  156.   def setup_battle_event
  157.     # 正在执行战斗事件的情况下
  158.     if $game_system.battle_interpreter.running?
  159.       return
  160.     end
  161.     # 搜索全部页的战斗事件
  162.     for index in 0...$data_troops[@troop_id].pages.size
  163.       # 获取事件页
  164.       page = $data_troops[@troop_id].pages[index]
  165.       # 事件条件可以参考 c
  166.       c = page.condition
  167.       # 没有指定任何条件的情况下转到下一页
  168.       unless c.turn_valid or c.enemy_valid or
  169.              c.actor_valid or c.switch_valid
  170.         next
  171.       end
  172.       # 执行完毕的情况下转到下一页
  173.       if $game_temp.battle_event_flags[index]
  174.         next
  175.       end
  176.       # 确认回合条件
  177.       if c.turn_valid
  178.         n = $game_temp.battle_turn
  179.         a = c.turn_a
  180.         b = c.turn_b
  181.         if (b == 0 and n != a) or
  182.            (b > 0 and (n < 1 or n < a or n % b != a % b))
  183.           next
  184.         end
  185.       end
  186.       # 确认敌人条件
  187.       if c.enemy_valid
  188.         enemy = $game_troop.enemies[c.enemy_index]
  189.         if enemy == nil or enemy.hp * 100.0 / enemy.maxhp > c.enemy_hp
  190.           next
  191.         end
  192.       end
  193.       # 确认角色条件
  194.       if c.actor_valid
  195.         actor = $game_actors[c.actor_id]
  196.         if actor == nil or actor.hp * 100.0 / actor.maxhp > c.actor_hp
  197.           next
  198.         end
  199.       end
  200.       # 确认开关条件
  201.       if c.switch_valid
  202.         if $game_switches[c.switch_id] == false
  203.           next
  204.         end
  205.       end
  206.       # 设置事件
  207.       $game_system.battle_interpreter.setup(page.list, 0)
  208.       # 本页的范围是 [战斗] 或 [回合] 的情况下
  209.       if page.span <= 1
  210.         # 设置执行结束标志
  211.         $game_temp.battle_event_flags[index] = true
  212.       end
  213.       return
  214.     end
  215.   end
  216.   #--------------------------------------------------------------------------
  217.   # ● 刷新画面
  218.   #--------------------------------------------------------------------------
  219.   def update
  220.     # 执行战斗事件中的情况下
  221.     if $game_system.battle_interpreter.running?
  222.       # 刷新解释器
  223.       $game_system.battle_interpreter.update
  224.       # 强制行动的战斗者不存在的情况下
  225.       if $game_temp.forcing_battler == nil
  226.         # 执行战斗事件结束的情况下
  227.         unless $game_system.battle_interpreter.running?
  228.           # 继续战斗的情况下、再执行战斗事件的设置
  229.           unless judge
  230.             setup_battle_event
  231.           end
  232.         end
  233.         # 如果不是结束战斗回合的情况下
  234.         if @phase != 5
  235.           # 刷新状态窗口
  236.           @status_window.refresh
  237.         end
  238.       end
  239.     end
  240.     # 系统 (计时器)、刷新画面
  241.     $game_system.update
  242.     $game_screen.update
  243.     # 计时器为 0 的情况下
  244.     if $game_system.timer_working and $game_system.timer == 0
  245.       # 中断战斗
  246.       $game_temp.battle_abort = true
  247.     end
  248.     # 刷新窗口
  249.     @help_window.update
  250.     @party_command_window.update
  251.     @actor_command_window.update
  252.     @status_window.update
  253.     @message_window.update
  254.     # 刷新活动块
  255.     @spriteset.update
  256.     # 处理过渡中的情况下
  257.     if $game_temp.transition_processing
  258.       # 清除处理过渡中标志
  259.       $game_temp.transition_processing = false
  260.       # 执行过渡
  261.       if $game_temp.transition_name == ""
  262.         Graphics.transition(20)
  263.       else
  264.         Graphics.transition(40, "Graphics/Transitions/" +
  265.           $game_temp.transition_name)
  266.       end
  267.     end
  268.     # 显示信息窗口中的情况下
  269.     if $game_temp.message_window_showing
  270.       return
  271.     end
  272.     # 显示效果中的情况下
  273.     if @spriteset.effect?
  274.       return
  275.     end
  276.     # 游戏结束的情况下
  277.     if $game_temp.gameover
  278.       # 切换到游戏结束画面
  279.       $scene = Scene_Gameover.new
  280.       return
  281.     end
  282.     # 返回标题画面的情况下
  283.     if $game_temp.to_title
  284.       # 切换到标题画面
  285.       $scene = Scene_Title.new
  286.       return
  287.     end
  288.     # 中断战斗的情况下
  289.     if $game_temp.battle_abort
  290.       # 还原为战斗前的 BGM
  291.       $game_system.bgm_play($game_temp.map_bgm)
  292.       # 战斗结束
  293.       battle_end(1)
  294.       return
  295.     end
  296.     # 等待中的情况下
  297.     if @wait_count > 0
  298.       # 减少等待计数
  299.       @wait_count -= 1
  300.       return
  301.     end
  302.     # 强制行动的角色存在、
  303.     # 并且战斗事件正在执行的情况下
  304.     if $game_temp.forcing_battler == nil and
  305.        $game_system.battle_interpreter.running?
  306.       return
  307.     end
  308.     # 回合分支
  309.     case @phase
  310.     when 1  # 自由战斗回合
  311.       update_phase1
  312.     when 2  # 同伴命令回合
  313.       update_phase2
  314.     when 3  # 角色命令回合
  315.       update_phase3
  316.     when 4  # 主回合
  317.       update_phase4
  318.     when 5  # 战斗结束回合
  319.       update_phase5
  320.     end
  321.   end
  322. end
复制代码
然后换到Scene_Battle 3里的118行。将部分内容修改.以下是整个Scene_Battle 3
注意359行处.现在战斗是when 1 .
  1. #==============================================================================
  2. # ■ Scene_Battle (分割定义 3)
  3. #------------------------------------------------------------------------------
  4. #  处理战斗画面的类。
  5. #==============================================================================

  6. class Scene_Battle
  7.   #--------------------------------------------------------------------------
  8.   # ● 开始角色命令回合
  9.   #--------------------------------------------------------------------------
  10.   def start_phase3
  11.     # 转移到回合 3
  12.     @phase = 3
  13.     # 设置角色为非选择状态
  14.     @actor_index = -1
  15.     @active_battler = nil
  16.     # 输入下一个角色的命令
  17.     phase3_next_actor
  18.   end
  19.   #--------------------------------------------------------------------------
  20.   # ● 转到输入下一个角色的命令
  21.   #--------------------------------------------------------------------------
  22.   def phase3_next_actor
  23.     # 循环
  24.     begin
  25.       # 角色的明灭效果 OFF
  26.       if @active_battler != nil
  27.         @active_battler.blink = false
  28.       end
  29.       # 最后的角色的情况
  30.       if @actor_index == $game_party.actors.size-1
  31.         # 开始主回合
  32.         start_phase4
  33.         return
  34.       end
  35.       # 推进角色索引
  36.       @actor_index += 1
  37.       @active_battler = $game_party.actors[@actor_index]
  38.       @active_battler.blink = true
  39.     # 如果角色是在无法接受指令的状态就再试
  40.     end until @active_battler.inputable?
  41.     # 设置角色的命令窗口
  42.     phase3_setup_command_window
  43.   end
  44.   #--------------------------------------------------------------------------
  45.   # ● 转向前一个角色的命令输入
  46.   #--------------------------------------------------------------------------
  47.   def phase3_prior_actor
  48.     # 循环
  49.     begin
  50.       # 角色的明灭效果 OFF
  51.       if @active_battler != nil
  52.         @active_battler.blink = false
  53.       end
  54.       # 最初的角色的情况下
  55.       if @actor_index == 0
  56.         # 开始同伴指令回合
  57.         start_phase2
  58.         return
  59.       end
  60.       # 返回角色索引
  61.       @actor_index -= 1
  62.       @active_battler = $game_party.actors[@actor_index]
  63.       @active_battler.blink = true
  64.     # 如果角色是在无法接受指令的状态就再试
  65.     end until @active_battler.inputable?
  66.     # 设置角色的命令窗口
  67.     phase3_setup_command_window
  68.   end
  69.   #--------------------------------------------------------------------------
  70.   # ● 设置角色指令窗口
  71.   #--------------------------------------------------------------------------
  72.   def phase3_setup_command_window
  73.     # 同伴指令窗口无效化
  74.     @party_command_window.active = false
  75.     @party_command_window.visible = false
  76.     # 角色指令窗口无效化
  77.     @actor_command_window.active = true
  78.     @actor_command_window.visible = true
  79.     # 设置角色指令窗口的位置
  80.     @actor_command_window.x = @actor_index * 160
  81.     # 设置索引为 0
  82.     @actor_command_window.index = 0
  83.   end
  84.   #--------------------------------------------------------------------------
  85.   # ● 刷新画面 (角色命令回合)
  86.   #--------------------------------------------------------------------------
  87.   def update_phase3
  88.     # 敌人光标有效的情况下
  89.     if @enemy_arrow != nil
  90.       update_phase3_enemy_select
  91.     # 角色光标有效的情况下
  92.     elsif @actor_arrow != nil
  93.       update_phase3_actor_select
  94.     # 特技窗口有效的情况下
  95.     elsif @skill_window != nil
  96.       update_phase3_skill_select
  97.     # 物品窗口有效的情况下
  98.     elsif @item_window != nil
  99.       update_phase3_item_select
  100.     # 角色指令窗口有效的情况下
  101.     elsif @actor_command_window.active
  102.       update_phase3_basic_command
  103.     end
  104.   end
  105.   #--------------------------------------------------------------------------
  106.   # ● 刷新画面 (角色命令回合 : 基本命令)
  107.   #--------------------------------------------------------------------------
  108.   def update_phase3_basic_command
  109.     # 按下 B 键的情况下
  110.     if Input.trigger?(Input::B)
  111.       # 演奏取消 SE
  112.       $game_system.se_play($data_system.cancel_se)
  113.       # 转向前一个角色的指令输入
  114.       phase3_prior_actor
  115.       return
  116.     end
  117.     # 按下 C 键的情况下
  118.     if Input.trigger?(Input::C)
  119.       # 角色指令窗口光标位置分之
  120.       case @actor_command_window.index
  121.       when 0 #全员攻击
  122.         while @actor_index != $game_party.actors.size-1
  123.         # 符合时执行以下内容
  124.         @active_battler.current_action.kind = 0
  125.         @active_battler.current_action.basic = 0
  126.         phase3_next_actor
  127.       end
  128.         #跳出循环,赋予队伍最后一名伙伴的命令
  129.         @active_battler.current_action.kind = 0
  130.         @active_battler.current_action.basic = 0
  131.         @active_battler.blink = false
  132.         start_phase4
  133.       when 1  # 攻击
  134.         # 演奏确定 SE
  135.         $game_system.se_play($data_system.decision_se)
  136.         # 设置行动
  137.         @active_battler.current_action.kind = 0
  138.         @active_battler.current_action.basic = 0
  139.         # 开始选择敌人
  140.         start_enemy_select
  141.       when 2  # 特技
  142.         # 演奏确定 SE
  143.         $game_system.se_play($data_system.decision_se)
  144.         # 设置行动
  145.         @active_battler.current_action.kind = 1
  146.         # 开始选择特技
  147.         start_skill_select
  148.       when 3  # 防御
  149.         # 演奏确定 SE
  150.         $game_system.se_play($data_system.decision_se)
  151.         # 设置行动
  152.         @active_battler.current_action.kind = 0
  153.         @active_battler.current_action.basic = 1
  154.         # 转向下一位角色的指令输入
  155.         phase3_next_actor
  156.       when 4  # 物品
  157.         # 演奏确定 SE
  158.         $game_system.se_play($data_system.decision_se)
  159.         # 设置行动
  160.         @active_battler.current_action.kind = 2
  161.         # 开始选择物品
  162.         start_item_select
  163.       end
  164.       return
  165.     end
  166.   end
  167.   #--------------------------------------------------------------------------
  168.   # ● 刷新画面 (角色命令回合 : 选择特技)
  169.   #--------------------------------------------------------------------------
  170.   def update_phase3_skill_select
  171.     # 设置特技窗口为可视状态
  172.     @skill_window.visible = true
  173.     # 刷新特技窗口
  174.     @skill_window.update
  175.     # 按下 B 键的情况下
  176.     if Input.trigger?(Input::B)
  177.       # 演奏取消 SE
  178.       $game_system.se_play($data_system.cancel_se)
  179.       # 结束特技选择
  180.       end_skill_select
  181.       return
  182.     end
  183.     # 按下 C 键的情况下
  184.     if Input.trigger?(Input::C)
  185.       # 获取特技选择窗口现在选择的特技的数据
  186.       [url=home.php?mod=space&uid=260100]@skill[/url] = @skill_window.skill
  187.       # 无法使用的情况下
  188.       if @skill == nil or not @active_battler.skill_can_use?(@skill.id)
  189.         # 演奏冻结 SE
  190.         $game_system.se_play($data_system.buzzer_se)
  191.         return
  192.       end
  193.       # 演奏确定 SE
  194.       $game_system.se_play($data_system.decision_se)
  195.       # 设置行动
  196.       @active_battler.current_action.skill_id = @skill.id
  197.       # 设置特技窗口为不可见状态
  198.       @skill_window.visible = false
  199.       # 效果范围是敌单体的情况下
  200.       if @skill.scope == 1
  201.         # 开始选择敌人
  202.         start_enemy_select
  203.       # 效果范围是我方单体的情况下
  204.       elsif @skill.scope == 3 or @skill.scope == 5
  205.         # 开始选择角色
  206.         start_actor_select
  207.       # 效果范围不是单体的情况下
  208.       else
  209.         # 选择特技结束
  210.         end_skill_select
  211.         # 转到下一位角色的指令输入
  212.         phase3_next_actor
  213.       end
  214.       return
  215.     end
  216.   end
  217.   #--------------------------------------------------------------------------
  218.   # ● 刷新画面 (角色命令回合 : 选择物品)
  219.   #--------------------------------------------------------------------------
  220.   def update_phase3_item_select
  221.     # 设置物品窗口为可视状态
  222.     @item_window.visible = true
  223.     # 刷新物品窗口
  224.     @item_window.update
  225.     # 按下 B 键的情况下
  226.     if Input.trigger?(Input::B)
  227.       # 演奏取消 SE
  228.       $game_system.se_play($data_system.cancel_se)
  229.       # 选择物品结束
  230.       end_item_select
  231.       return
  232.     end
  233.     # 按下 C 键的情况下
  234.     if Input.trigger?(Input::C)
  235.       # 获取物品窗口现在选择的物品资料
  236.       @item = @item_window.item
  237.       # 无法使用的情况下
  238.       unless $game_party.item_can_use?(@item.id)
  239.         # 演奏冻结 SE
  240.         $game_system.se_play($data_system.buzzer_se)
  241.         return
  242.       end
  243.       # 演奏确定 SE
  244.       $game_system.se_play($data_system.decision_se)
  245.       # 设置行动
  246.       @active_battler.current_action.item_id = @item.id
  247.       # 设置物品窗口为不可见状态
  248.       @item_window.visible = false
  249.       # 效果范围是敌单体的情况下
  250.       if @item.scope == 1
  251.         # 开始选择敌人
  252.         start_enemy_select
  253.       # 效果范围是我方单体的情况下
  254.       elsif @item.scope == 3 or @item.scope == 5
  255.         # 开始选择角色
  256.         start_actor_select
  257.       # 效果范围不是单体的情况下
  258.       else
  259.         # 物品选择结束
  260.         end_item_select
  261.         # 转到下一位角色的指令输入
  262.         phase3_next_actor
  263.       end
  264.       return
  265.     end
  266.   end
  267.   #--------------------------------------------------------------------------
  268.   # ● 刷新画面画面 (角色命令回合 : 选择敌人)
  269.   #--------------------------------------------------------------------------
  270.   def update_phase3_enemy_select
  271.     # 刷新敌人箭头
  272.     @enemy_arrow.update
  273.     # 按下 B 键的情况下
  274.     if Input.trigger?(Input::B)
  275.       # 演奏取消 SE
  276.       $game_system.se_play($data_system.cancel_se)
  277.       # 选择敌人结束
  278.       end_enemy_select
  279.       return
  280.     end
  281.     # 按下 C 键的情况下
  282.     if Input.trigger?(Input::C)
  283.       # 演奏确定 SE
  284.       $game_system.se_play($data_system.decision_se)
  285.       # 设置行动
  286.       @active_battler.current_action.target_index = @enemy_arrow.index
  287.       # 选择敌人结束
  288.       end_enemy_select
  289.       # 显示特技窗口中的情况下
  290.       if @skill_window != nil
  291.         # 结束特技选择
  292.         end_skill_select
  293.       end
  294.       # 显示物品窗口的情况下
  295.       if @item_window != nil
  296.         # 结束物品选择
  297.         end_item_select
  298.       end
  299.       # 转到下一位角色的指令输入
  300.       phase3_next_actor
  301.     end
  302.   end
  303.   #--------------------------------------------------------------------------
  304.   # ● 画面更新 (角色指令回合 : 选择角色)
  305.   #--------------------------------------------------------------------------
  306.   def update_phase3_actor_select
  307.     # 刷新角色箭头
  308.     @actor_arrow.update
  309.     # 按下 B 键的情况下
  310.     if Input.trigger?(Input::B)
  311.       # 演奏取消 SE
  312.       $game_system.se_play($data_system.cancel_se)
  313.       # 选择角色结束
  314.       end_actor_select
  315.       return
  316.     end
  317.     # 按下 C 键的情况下
  318.     if Input.trigger?(Input::C)
  319.       # 演奏确定 SE
  320.       $game_system.se_play($data_system.decision_se)
  321.       # 设置行动
  322.       @active_battler.current_action.target_index = @actor_arrow.index
  323.       # 选择角色结束
  324.       end_actor_select
  325.       # 显示特技窗口中的情况下
  326.       if @skill_window != nil
  327.         # 结束特技选择
  328.         end_skill_select
  329.       end
  330.       # 显示物品窗口的情况下
  331.       if @item_window != nil
  332.         # 结束物品选择
  333.         end_item_select
  334.       end
  335.       # 转到下一位角色的指令输入
  336.       phase3_next_actor
  337.     end
  338.   end
  339.   #--------------------------------------------------------------------------
  340.   # ● 开始选择敌人
  341.   #--------------------------------------------------------------------------
  342.   def start_enemy_select
  343.     # 生成敌人箭头
  344.     @enemy_arrow = Arrow_Enemy.new(@spriteset.viewport1)
  345.     # 关联帮助窗口
  346.     @enemy_arrow.help_window = @help_window
  347.     # 无效化角色指令窗口
  348.     @actor_command_window.active = false
  349.     @actor_command_window.visible = false
  350.   end
  351.   #--------------------------------------------------------------------------
  352.   # ● 结束选择敌人
  353.   #--------------------------------------------------------------------------
  354.   def end_enemy_select
  355.     # 释放敌人箭头
  356.     @enemy_arrow.dispose
  357.     @enemy_arrow = nil
  358.     # 指令为 [战斗] 的情况下
  359.     if @actor_command_window.index == 1
  360.       # 有效化角色指令窗口
  361.       @actor_command_window.active = true
  362.       @actor_command_window.visible = true
  363.       # 隐藏帮助窗口
  364.       @help_window.visible = false
  365.     end
  366.   end
  367.   #--------------------------------------------------------------------------
  368.   # ● 开始选择角色
  369.   #--------------------------------------------------------------------------
  370.   def start_actor_select
  371.     # 生成角色箭头
  372.     @actor_arrow = Arrow_Actor.new(@spriteset.viewport2)
  373.     @actor_arrow.index = @actor_index
  374.     # 关联帮助窗口
  375.     @actor_arrow.help_window = @help_window
  376.     # 无效化角色指令窗口
  377.     @actor_command_window.active = false
  378.     @actor_command_window.visible = false
  379.   end
  380.   #--------------------------------------------------------------------------
  381.   # ● 结束选择角色
  382.   #--------------------------------------------------------------------------
  383.   def end_actor_select
  384.     # 释放角色箭头
  385.     @actor_arrow.dispose
  386.     @actor_arrow = nil
  387.   end
  388.   #--------------------------------------------------------------------------
  389.   # ● 开始选择特技
  390.   #--------------------------------------------------------------------------
  391.   def start_skill_select
  392.     # 生成特技窗口
  393.     @skill_window = Window_Skill.new(@active_battler)
  394.     # 关联帮助窗口
  395.     @skill_window.help_window = @help_window
  396.     # 无效化角色指令窗口
  397.     @actor_command_window.active = false
  398.     @actor_command_window.visible = false
  399.   end
  400.   #--------------------------------------------------------------------------
  401.   # ● 选择特技结束
  402.   #--------------------------------------------------------------------------
  403.   def end_skill_select
  404.     # 释放特技窗口
  405.     @skill_window.dispose
  406.     @skill_window = nil
  407.     # 隐藏帮助窗口
  408.     @help_window.visible = false
  409.     # 有效化角色指令窗口
  410.     @actor_command_window.active = true
  411.     @actor_command_window.visible = true
  412.   end
  413.   #--------------------------------------------------------------------------
  414.   # ● 开始选择物品
  415.   #--------------------------------------------------------------------------
  416.   def start_item_select
  417.     # 生成物品窗口
  418.     @item_window = Window_Item.new
  419.     # 关联帮助窗口
  420.     @item_window.help_window = @help_window
  421.     # 无效化角色指令窗口
  422.     @actor_command_window.active = false
  423.     @actor_command_window.visible = false
  424.   end
  425.   #--------------------------------------------------------------------------
  426.   # ● 结束选择物品
  427.   #--------------------------------------------------------------------------
  428.   def end_item_select
  429.     # 释放物品窗口
  430.     @item_window.dispose
  431.     @item_window = nil
  432.     # 隐藏帮助窗口
  433.     @help_window.visible = false
  434.     # 有效化角色指令窗口
  435.     @actor_command_window.active = true
  436.     @actor_command_window.visible = true
  437.   end
  438. end
复制代码
弄好后效果如下图

下面是范例工程
全员攻击.zip (201.81 KB, 下载次数: 112)
作者: stevenrock    时间: 2013-6-8 20:16
貌似修改了许多地方……假如说偶想整合,估计需要相当长的时间吧……提个建议:LZ兄能不能把从默认的脚本中修改的部分画个圈圈神马的,方便像偶这么笨的小白能顺利的整合进自己的游戏里?
作者: 512195574    时间: 2013-6-8 20:55
几乎所有的战斗类脚本都跟RTAB冲突,但是能跟RTAB比肩的就很少了……
作者: ︶ㄣ牛排ぶ    时间: 2013-6-8 22:27
感觉这脚本比较鸡肋
现在制作游戏的话除了新手都不会直接用默认战斗系统,你这脚本兼容性不高,新人也不怎么会照着你说的去修改
得出结论,你这东西没多少人会用
LZ还是酌情进行些修改啥的吧
作者: 夜狠简单    时间: 2013-6-8 23:46
本帖最后由 夜狠简单 于 2013-6-9 11:11 编辑

的确很鸡肋,一般不会有人去用,但是做事得有始有终。发完吧


Scene_Battle 1处
将第30~31行代码修改如下
  1. @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4,"全员攻击"])
  2. @actor_command_window.y = 128
复制代码
Scene_Battle 3处将122行处修改如下
  1.   when 0  # 攻击
  2.         # 演奏确定 SE
  3.         $game_system.se_play($data_system.decision_se)
  4.         # 设置行动
  5.         @active_battler.current_action.kind = 0
  6.         @active_battler.current_action.basic = 0
  7.         # 开始选择敌人
  8.         start_enemy_select
  9.       when 1  # 特技
  10.         # 演奏确定 SE
  11.         $game_system.se_play($data_system.decision_se)
  12.         # 设置行动
  13.         @active_battler.current_action.kind = 1
  14.         # 开始选择特技
  15.         start_skill_select
  16.       when 2  # 防御
  17.         # 演奏确定 SE
  18.         $game_system.se_play($data_system.decision_se)
  19.         # 设置行动
  20.         @active_battler.current_action.kind = 0
  21.         @active_battler.current_action.basic = 1
  22.         # 转向下一位角色的指令输入
  23.         phase3_next_actor
  24.       when 3  # 物品
  25.         # 演奏确定 SE
  26.         $game_system.se_play($data_system.decision_se)
  27.         # 设置行动
  28.         @active_battler.current_action.kind = 2
  29.         # 开始选择物品
  30.         start_item_select
  31.          when 4 #全员攻击
  32.         while @actor_index != $game_party.actors.size-1
  33.         # 符合时执行以下内容
  34.         @active_battler.current_action.kind = 0
  35.         @active_battler.current_action.basic = 0
  36.         phase3_next_actor
  37.       end
  38.         #跳出循环,赋予队伍最后一名伙伴的命令
  39.         @active_battler.current_action.kind = 0
  40.         @active_battler.current_action.basic = 0
  41.         start_phase4
  42.       end
  43.       return
  44.     end
  45.   end
复制代码
其实也就添加了一个when 4。解决了原来修改方法的一点bug。
不会影响前面使用了特技的伙伴.
作者: 夜狠简单    时间: 2013-6-9 11:39
stevenrock 发表于 2013-6-8 20:16
貌似修改了许多地方……假如说偶想整合,估计需要相当长的时间吧……提个建议:LZ兄能不能把从默认的脚本中 ...

嗯,可以了。你看下回复
作者: stevenrock    时间: 2013-6-9 13:50
夜狠简单 发表于 2013-6-9 11:39
嗯,可以了。你看下回复

辛苦了,拿去好好学习学习
作者: 黑色独奏曲    时间: 2013-6-13 23:29
使用之后,最后一个角色在全员出击时会不停闪动,求楼主解!
作者: 夜狠简单    时间: 2013-6-15 17:02
黑色独奏曲 发表于 2013-6-13 23:29
使用之后,最后一个角色在全员出击时会不停闪动,求楼主解!

已经改了
作者: mengjiyao123    时间: 2013-9-25 11:14
多谢楼主分享
作者: 夜狠简单    时间: 2013-9-28 00:21
mengjiyao123 发表于 2013-9-25 11:14
多谢楼主分享

这个脚本如果角色状态附带不能行动可是会出错的,但是稍加处理可以解决掉的
作者: mengjiyao123    时间: 2013-9-28 17:43
夜狠简单 发表于 2013-9-28 00:21
这个脚本如果角色状态附带不能行动可是会出错的,但是稍加处理可以解决掉的 ...

啊,多谢,其实我暂时还用不到脚本,我是一个完全的新手。从没有任何经验的。。。




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1