Project1

标题: 想让角色阵亡时换后备队员上场 [打印本页]

作者: sunset7395    时间: 2016-10-9 22:21
标题: 想让角色阵亡时换后备队员上场
新人请问
如何让场上战斗的队员都阵亡时
不直接游戏结束
而是换成后补队员上场打
连候补队员都阵亡的时候才算真的输了

举例:
现在有ABCDEFG7名队员
A.B.C.D前锋队员战斗都死了
换剩下的所有候补队员,也就是E.F.G上场

像是汉之云的战斗模式
因为有多名角色,想要做成像那样的战斗
不然觉得后补都没上场就游戏结束有点不合理
VA的基础设定唉

论坛都搜过了,没有类似的脚本
所以只好自己发文求助
求大神帮忙
作者: 七重    时间: 2016-10-9 22:47
本帖最后由 七重 于 2016-10-9 22:49 编辑

以前见过一个叫做世界树迷宫风格的战斗系统的脚本。

里面有个前后列系统,里面的设定是,前列的人死了之后,后列的人会上前去。

假如将后列的人改成不显示,不弹出行动命令也许可以满足你的要求。

--
追记:
这样绕圈子好像有点远了。。。仔细一想真不是一个好提议。。
作者: 是猪别乱叫    时间: 2016-10-11 08:48
  1. $imported = {} if $imported.nil?
  2. $imported["Sub_Party"] = true
  3. #==============================================================================
  4. # 全灭后待机成员参战 v1.2
  5. #------------------------------------------------------------------------------
  6. #    2015.05.31 by 企鹅达达
  7. #    2015.06.03 修正事件扣血时不更换队员的bug
  8. #    2015.06.04 防止整队类脚本对为加入队伍的成员调用draw_actor_simple_status等出错
  9. #==============================================================================
  10. #       如题,这个脚本的功能就是让非战斗人员按照序号编成小队,全灭后一个小队一个
  11. #   小队上场战斗。嗯,感觉不是很好用,反正是自用的╮(╯_╰)╭
  12. #       用这个脚本建议把濒死设置成战斗后解除,这样可以避免某些小队战斗
  13. #   时空了一些死掉的队员。
  14. #       顺带一提这脚本和战斗中整队、战斗中添加成员(比如召唤)类型的脚本天生不对头,
  15. #   如果因为这些原因报错,本人也无能为力了 ← ←
  16. #==============================================================================

  17. #参战时显示的信息,可以使用转义符,%s取代角色名。
  18. #    JION_MESSAGE = "\ec[6]%s\ec[0] 参战!"

  19. #如果不想要这个信息,可以设置为 nil
  20. #    JION_MESSAGE = nil

  21. JION_MESSAGE = "%s 参战!"

  22. # 在菜单里显示的名字,SUB_PARTY_NAME里没有的话会用下面的SUB_PARTY_DEFAULT_NAME

  23. SUB_PARTY_SHOW_IN_MENU = true

  24. SUB_PARTY_NAME = ["","",]

  25. SUB_PARTY_DEFAULT_NAME = ""


  26. #==============================================================================
  27. # ■ Game_Battler
  28. #------------------------------------------------------------------------------
  29. #  处理战斗者的类。Game_Actor 和 Game_Enemy 类的父类。
  30. #==============================================================================

  31. class Game_Battler < Game_BattlerBase
  32.   attr_accessor :battle_formation_order          #队伍顺序标记
  33.   #--------------------------------------------------------------------------
  34.   # ● 保存队伍顺序
  35.   #--------------------------------------------------------------------------
  36.   def save_battle_formation_order
  37.     @battle_formation_order = index
  38.   end
  39.   #--------------------------------------------------------------------------
  40.   # ● 行动结束
  41.   #--------------------------------------------------------------------------
  42.   alias sub_party_on_action_end on_action_end
  43.   def on_action_end
  44.     sub_party_on_action_end
  45.     while $game_party.all_dead?
  46.       break if $game_party.sub_party_now >= $game_party.sub_party_max
  47.       $game_party.sub_party_jion_battle
  48.     end
  49.   end
  50. end
  51. #==============================================================================
  52. # ■ Game_Party
  53. #------------------------------------------------------------------------------
  54. #  管理队伍的类。保存有金钱及物品的信息。本类的实例请参考 $game_party 。
  55. #==============================================================================
  56. class Game_Party < Game_Unit
  57.   attr_accessor :sub_party_now          #参战分队编号
  58.   attr_accessor :sub_party_max          #参战分队最大编号
  59.   #--------------------------------------------------------------------------
  60.   # ● 战斗开始处理
  61.   #--------------------------------------------------------------------------
  62.   def sub_party_jion_battle
  63.     @sub_party_now += 1
  64.     max_battle_members.times do |i|
  65.       next if all_members[ max_battle_members * @sub_party_now + i ].nil?
  66.       next if all_members[ max_battle_members * @sub_party_now + i ].dead?
  67.       swap_order( i, max_battle_members * @sub_party_now + i)
  68.       if JION_MESSAGE
  69. #       BattleManager.log_window.add_text(sprintf(JION_MESSAGE, $game_party.all_members[i].name))
  70. #       BattleManager.log_window.abs_wait(90)
  71.         $game_message.add(sprintf(JION_MESSAGE, $game_party.all_members[i].name))
  72.         BattleManager.wait_for_message
  73.       end
  74.     end
  75.   end
  76.   #--------------------------------------------------------------------------
  77.   # ● 队伍顺序恢复
  78.   #--------------------------------------------------------------------------
  79.   def sub_party_reset_order
  80.     @actors.sort! {|a, b|$game_actors[a].battle_formation_order <=> $game_actors[b].battle_formation_order }
  81.   end
  82.   #--------------------------------------------------------------------------
  83.   # ● 保存队伍顺序
  84.   #--------------------------------------------------------------------------
  85.   def sub_party_save_order
  86.     all_members.each do |member|
  87.       member.save_battle_formation_order
  88.     end
  89.   end
  90.   #--------------------------------------------------------------------------
  91.   # ● 初始化参战分队信息,顺带让第一个有成活队员的分队上阵。
  92.   #--------------------------------------------------------------------------
  93.   def make_sub_party
  94.     @sub_party_now = 0
  95.     @sub_party_max = all_members.size / max_battle_members
  96.     @sub_party_max -= 1 if all_members.size == max_battle_members * @sub_party_max
  97.     while battle_members.select {|member|member.alive?}.empty?
  98.       break if @sub_party_now >= @sub_party_max
  99.       sub_party_jion_battle
  100.     end
  101.   end
  102.   #--------------------------------------------------------------------------
  103.   # ● 战斗开始处理
  104.   #--------------------------------------------------------------------------
  105.   alias sub_party_on_battle_start on_battle_start
  106.   def on_battle_start
  107.     sub_party_save_order
  108.     make_sub_party
  109.     sub_party_on_battle_start
  110.   end
  111.   #--------------------------------------------------------------------------
  112.   # ● 战斗结束处理
  113.   #--------------------------------------------------------------------------
  114.   alias sub_party_on_battle_end on_battle_end
  115.   def on_battle_end
  116.     sub_party_reset_order
  117.     sub_party_on_battle_end
  118.   end
  119. end
  120. #==============================================================================
  121. # ■ Game_Interpreter
  122. #------------------------------------------------------------------------------
  123. #  事件指令的解释器。
  124. #   本类在 Game_Map、Game_Troop、Game_Event 类的内部使用。
  125. #==============================================================================

  126. class Game_Interpreter
  127.   #--------------------------------------------------------------------------
  128.   # ● 增减 HP                   v 1.1更新
  129.   #--------------------------------------------------------------------------
  130.   def command_311
  131.     value = operate_value(@params[2], @params[3], @params[4])
  132.     iterate_actor_var(@params[0], @params[1]) do |actor|
  133.       next if actor.dead?
  134.       actor.change_hp(value, @params[5])
  135.       actor.perform_collapse_effect if actor.dead?
  136.     end
  137.     ##############################################
  138.     if SceneManager.scene_is?(Scene_Battle)
  139.       while $game_party.all_dead?
  140.         break if $game_party.sub_party_now >= $game_party.sub_party_max
  141.         $game_party.sub_party_jion_battle
  142.       end
  143.     end
  144.     ##############################################
  145.     SceneManager.goto(Scene_Gameover) if $game_party.all_dead?
  146.   end
  147.   #--------------------------------------------------------------------------
  148.   # ● 更改状态                   v 1.1更新
  149.   #--------------------------------------------------------------------------
  150.   alias sub_party_command_313 command_313
  151.   def command_313
  152.    sub_party_command_313
  153.     ##############################################
  154.     if SceneManager.scene_is?(Scene_Battle)
  155.       while $game_party.all_dead?
  156.         break if $game_party.sub_party_now >= $game_party.sub_party_max
  157.         $game_party.sub_party_jion_battle
  158.       end
  159.     end
  160.     ##############################################
  161.   end
  162. end
  163. if SUB_PARTY_SHOW_IN_MENU
  164. #==============================================================================
  165. # ■ Window_Base
  166. #------------------------------------------------------------------------------
  167. #  游戏中所有窗口的父类
  168. #==============================================================================
  169. class Window_Base < Window
  170.   #--------------------------------------------------------------------------
  171.   # ● 绘制分队名
  172.   #--------------------------------------------------------------------------
  173.   def draw_actor_sub_party(actor, x, y, width = 112)
  174.     return if actor.index.nil?                           #   v1.2修改
  175.     change_color(system_color)
  176.     sub_party_index = actor.index / $game_party.max_battle_members
  177.     text = SUB_PARTY_NAME[sub_party_index].nil? ? SUB_PARTY_DEFAULT_NAME : SUB_PARTY_NAME[sub_party_index]
  178.     draw_text(x, y, width, line_height, text)
  179.     change_color(normal_color)
  180.   end
  181.   #--------------------------------------------------------------------------
  182.   # ● 绘制简单的状态
  183.   #--------------------------------------------------------------------------
  184.   alias sub_party_draw_actor_simple_status draw_actor_simple_status
  185.   def draw_actor_simple_status(actor, x, y)
  186.     sub_party_draw_actor_simple_status(actor, x, y)
  187.     draw_actor_sub_party(actor, x-108, y+56)
  188.   end
  189. end

  190. #encoding:utf-8
  191. #==============================================================================
  192. # ■ Window_Status
  193. #------------------------------------------------------------------------------
  194. #  显示队伍成员状态的窗口
  195. #==============================================================================

  196. class Window_Status < Window_Selectable
  197.   #--------------------------------------------------------------------------
  198.   # ● 绘制基本区域
  199.   #--------------------------------------------------------------------------
  200.   alias sub_party_draw_basic_info draw_basic_info
  201.   def draw_basic_info(x, y)
  202.     sub_party_draw_basic_info(x, y)
  203.     draw_actor_sub_party(@actor, x -132, y+72, 100)
  204.   end
  205. end

  206. end # if SUB_PARTY_SHOW_IN_MENU
复制代码

作者: sunset7395    时间: 2016-10-11 21:44
是猪别乱叫 发表于 2016-10-11 08:48

谢谢 我目前人不在家 不能测试 如果有问题还希望帮忙解惑




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