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

Project1

 找回密码
 注册会员
搜索
查看: 1684|回复: 4
打印 上一主题 下一主题

[已经解决] 关于重复上回合脚本的问题

[复制链接]

Lv2.观梦者

梦石
0
星屑
479
在线时间
30 小时
注册时间
2017-5-30
帖子
56
跳转到指定楼层
1
发表于 2017-10-18 18:54:19 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
本帖最后由 樱桃丸子aab 于 2017-10-18 20:52 编辑

使用后会报错:脚本 '' 的 61行 发生了 NoMethodError
undefined method 'kind=' for nil:NilClass

可能是和我现有的脚本冲突了,请问具体要从哪个角度去排查,或者应该怎么改,麻烦了

【问题已经更新,在3楼】

RUBY 代码复制
  1. #==============================================================================
  2. # 本脚本来自[url=http://www.66rpg.com]www.66rpg.com[/url],转载和使用请保留此信息  
  3. #重复上回合动作  v1.1
  4. #by 叶子       Date: 12-12-2005
  5. #QQ:121058265
  6. #本脚本根据66rpg的站长柳柳提出的思路制作
  7. #如发现有bug请与作者联系或上66rpg发贴说明
  8. #==============================================================================
  9. #当战斗时按下T键,
  10. #当前角色就会重复上回合的动作(包括攻击,特技,防御,物品)。
  11. #当战斗时按下R键,
  12. #所有角色就会重复上回合的动作。
  13. #当战斗时按下F键,
  14. #所有角色就会普通攻击同一个敌人。
  15. #脚本占用了第一号开关。
  16. #当第一号开关打开时,重复上回合动作功能关闭。
  17. #如果想用其他开关,改第130,263,323行中相应内容。
  18. #--------------------------------------------------------------------------
  19. class Game_Battler
  20. #--------------------------------------------------------------------------
  21. # ● 初始化对像
  22. #--------------------------------------------------------------------------
  23. def initialize
  24.    @battler_name = ""
  25.    @battler_hue = 0
  26.    @hp = 0
  27.    @sp = 0
  28.    @pp = 0
  29.    @states = []
  30.    @states_turn = {}
  31.    @maxhp_plus = 0
  32.    @maxsp_plus = 0
  33.    @maxpp_plus = 0
  34.    @str_plus = 0
  35.    @dex_plus = 0
  36.    @agi_plus = 0
  37.    @int_plus = 0
  38.    @hidden = false
  39.    @immortal = false
  40.    @damage_pop = false
  41.    @damage = nil
  42.    @critical = false
  43.    @animation_id = 0
  44.    @animation_hit = false
  45.    @white_flash = false
  46.    @blink = false
  47.    @current_action = Game_BattleAction.new
  48.    @last_action = Game_BattleAction.new
  49. end
  50. #--------------------------------------------------------------------------
  51. # ● 获取前一回合的动作
  52. #--------------------------------------------------------------------------
  53. def last_action
  54.    return @last_action
  55. end
  56. end
  57.  
  58. class Game_Party
  59. def last_actions
  60.    for actor in @actors
  61.      actor.last_action.kind = actor.current_action.kind
  62.      actor.last_action.basic = actor.current_action.basic
  63.      actor.last_action.forcing = actor.current_action.forcing
  64.      actor.last_action.target_index = actor.current_action.target_index
  65.      actor.last_action.skill_id = actor.current_action.skill_id
  66.      actor.last_action.item_id = actor.current_action.item_id
  67.    end
  68. end
  69. end
  70.  
  71. class Scene_Battle
  72. #--------------------------------------------------------------------------
  73. # ● 开始同伴命令回合
  74. #--------------------------------------------------------------------------
  75. def start_phase2
  76.    # 转移到回合 2
  77.    @phase = 2
  78.    # 设置角色为非选择状态
  79.    @actor_index = -1
  80.    @active_battler = nil
  81.    # 有效化同伴指令窗口
  82.    @party_command_window.active = true
  83.    @party_command_window.visible = true
  84.    # 无效化角色指令窗口
  85.    @actor_command_window.active = false
  86.    @actor_command_window.visible = false
  87.    # 清除主回合标志
  88.    $game_temp.battle_main_phase = false
  89.    # 记录行动
  90.    $game_party.last_actions
  91.    # 清除全体同伴的行动
  92.    $game_party.clear_actions
  93.    # 不能输入命令的情况下
  94.    unless $game_party.inputable?
  95.      # 开始主回合
  96.      start_phase4
  97.    end
  98. end
  99. #--------------------------------------------------------------------------
  100. # ● 刷新画面 (同伴命令回合)
  101. #--------------------------------------------------------------------------
  102. def update_phase2
  103.    # 按下 C 键的情况下
  104.    if Input.trigger?(Input::C)
  105.      # 同伴指令窗口光标位置分支
  106.      case @party_command_window.index
  107.      when 0  # 战斗
  108.        # 演奏确定 SE
  109.        $game_system.se_play($data_system.decision_se)
  110.        # 开始角色的命令回合
  111.        start_phase3
  112.      when 1  # 逃跑
  113.        # 不能逃跑的情况下
  114.        if $game_temp.battle_can_escape == false
  115.          # 演奏冻结 SE
  116.          $game_system.se_play($data_system.buzzer_se)
  117.          return
  118.        end
  119.        # 演奏确定 SE
  120.        $game_system.se_play($data_system.decision_se)
  121.        # 逃走处理
  122.        update_phase2_escape
  123.      end
  124.      return
  125.    end
  126.    #------------------------------
  127.    # 按下 R 键的情况下
  128.    #------------------------------
  129.    if Kboard.keyboard($R_Key_R)
  130.      #如果一号开关打开就禁止重复上回合动作
  131.      if $game_switches[1] == true #开关号可以改,把那个1改成你要的开关号
  132.        # 演奏冻结 SE
  133.        $game_system.se_play($data_system.buzzer_se)
  134.        return
  135.      end
  136.      for a in $game_party.actors
  137.        if a.inputable?
  138.          case a.last_action.kind
  139.          when 0  # 攻击,防御
  140.            #防御
  141.            if a.last_action.basic == 1
  142.              # 设置行动
  143.              a.current_action.kind = 0
  144.              a.current_action.basic = 1
  145.              #攻击
  146.              else
  147.              # 设置行动
  148.              a.current_action.kind = 0
  149.              a.current_action.basic = 0
  150.              a.current_action.target_index = a.last_action.target_index
  151.            end
  152.          when 1  # 特技
  153.          skill_id = a.last_action.skill_id
  154.          if a.skill_learn?(skill_id) and  
  155.            a.skill_can_use?(skill_id)
  156.            # 设置行动
  157.            a.current_action.kind = 1
  158.            a.current_action.skill_id = a.last_action.skill_id
  159.            a.current_action.target_index = a.last_action.target_index
  160.          else
  161.            # 不能使用就攻击
  162.            if $data_skills[skill_id].scope < 3
  163.              a.current_action.kind = 0
  164.              a.current_action.basic = 0
  165.              a.current_action.target_index = a.last_action.target_index
  166.            else
  167.              a.current_action.kind = 0
  168.              a.current_action.basic = 0
  169.              a.current_action.target_index = 0
  170.            end
  171.          end
  172.          when 2  # 物品
  173.            item_id = a.last_action.item_id
  174.            if $game_party.item_can_use?(item_id)
  175.              # 设置行动
  176.              a.current_action.kind = 2
  177.              a.current_action.item_id = a.last_action.item_id
  178.              a.current_action.target_index = a.last_action.target_index
  179.            else
  180.              # 不能使用就攻击
  181.              a.current_action.kind = 0
  182.              a.current_action.basic = 0
  183.              a.current_action.target_index = 0
  184.            end
  185.          end
  186.        end
  187.      end
  188.      # 演奏确定 SE
  189.      $game_system.se_play($data_system.decision_se)
  190.      start_phase4
  191.      return
  192.    end
  193.    #------------------------------
  194.    # 按下 F 键的情况下
  195.    #------------------------------
  196.    if Kboard.keyboard($R_Key_T)
  197.      for a in $game_party.actors
  198.        if a.inputable?
  199.          a.current_action.kind = 0
  200.          a.current_action.basic = 0
  201.          a.current_action.target_index = 0
  202.        end
  203.      end
  204.      # 演奏确定 SE
  205.      $game_system.se_play($data_system.decision_se)
  206.      start_phase4
  207.      return
  208.    end
  209. end
  210. #--------------------------------------------------------------------------
  211. # ● 刷新画面 (角色命令回合 : 基本命令)
  212. #--------------------------------------------------------------------------
  213. def update_phase3_basic_command
  214.    # 按下 B 键的情况下
  215.    if Input.trigger?(Input::B)
  216.      # 演奏取消 SE
  217.      $game_system.se_play($data_system.cancel_se)
  218.      # 转向前一个角色的指令输入
  219.      phase3_prior_actor
  220.      return
  221.    end
  222.    # 按下 C 键的情况下
  223.    if Input.trigger?(Input::C)
  224.      # 角色指令窗口光标位置分之
  225.      case @actor_command_window.index
  226.      when 0  # 攻击
  227.        # 演奏确定 SE
  228.        $game_system.se_play($data_system.decision_se)
  229.        # 设置行动
  230.        @active_battler.current_action.kind = 0
  231.        @active_battler.current_action.basic = 0
  232.        # 开始选择敌人
  233.        start_enemy_select
  234.      when 1  # 特技
  235.        # 演奏确定 SE
  236.        $game_system.se_play($data_system.decision_se)
  237.        # 设置行动
  238.        @active_battler.current_action.kind = 1
  239.        # 开始选择特技
  240.        start_skill_select
  241.      when 2  # 防御
  242.        # 演奏确定 SE
  243.        $game_system.se_play($data_system.decision_se)
  244.        # 设置行动
  245.        @active_battler.current_action.kind = 0
  246.        @active_battler.current_action.basic = 1
  247.        # 转向下一位角色的指令输入
  248.        phase3_next_actor
  249.      when 3  # 物品
  250.        # 演奏确定 SE
  251.        $game_system.se_play($data_system.decision_se)
  252.        # 设置行动
  253.        @active_battler.current_action.kind = 2
  254.        # 开始选择物品
  255.        start_item_select
  256.      end
  257.      return
  258.    end
  259.    #------------------------------
  260.    # 按下 T 建的情况下
  261.    #------------------------------
  262.    if Kboard.keyboard($R_Key_T)
  263.      #如果一号开关打开就禁止重复上回合动作
  264.      if $game_switches[1] == true #开关号可以改,把那个1改成你要的开关号
  265.        # 演奏冻结 SE
  266.        $game_system.se_play($data_system.buzzer_se)
  267.        return
  268.      end
  269.      case @active_battler.last_action.kind
  270.      when 0  # 攻击,防御
  271.        #防御
  272.        if @active_battler.last_action.basic == 1
  273.          # 设置行动
  274.          @active_battler.current_action.kind = 0
  275.          @active_battler.current_action.basic = 1
  276.          # 演奏确定 SE
  277.          $game_system.se_play($data_system.decision_se)
  278.          phase3_next_actor
  279.          #攻击
  280.          else
  281.          # 演奏确定 SE
  282.          $game_system.se_play($data_system.decision_se)
  283.          # 设置行动
  284.          @active_battler.current_action.kind = 0
  285.          @active_battler.current_action.basic = 0
  286.          @active_battler.current_action.target_index = @active_battler.last_action.target_index
  287.          phase3_next_actor
  288.        end
  289.      when 1  # 特技
  290.        skill_id = @active_battler.last_action.skill_id
  291.        if @active_battler.skill_learn?(skill_id) and
  292.          @active_battler.skill_can_use?(skill_id)
  293.          # 设置行动
  294.          @active_battler.current_action.kind = 1
  295.          @active_battler.current_action.skill_id = @active_battler.last_action.skill_id
  296.          @active_battler.current_action.target_index = @active_battler.last_action.target_index
  297.          phase3_next_actor
  298.        else
  299.          # 演奏冻结 SE
  300.          $game_system.se_play($data_system.buzzer_se)
  301.        end
  302.      when 2  # 物品
  303.        item_id = @active_battler.last_action.item_id
  304.        if $game_party.item_can_use?(item_id)
  305.          # 设置行动
  306.          @active_battler.current_action.kind = 2
  307.          @active_battler.current_action.item_id = @active_battler.last_action.item_id
  308.          @active_battler.current_action.target_index = @active_battler.last_action.target_index
  309.          # 演奏确定 SE
  310.          $game_system.se_play($data_system.decision_se)
  311.          phase3_next_actor
  312.        else
  313.          # 演奏冻结 SE
  314.          $game_system.se_play($data_system.buzzer_se)
  315.        end
  316.      end
  317.      return
  318.    end
  319.    #------------------------------
  320.    # 按下 R 键的情况下
  321.    #------------------------------
  322.    if Kboard.keyboard($R_Key_R)
  323.      #如果一号开关打开就禁止重复上回合动作
  324.      if $game_switches[1] == true #开关号可以改,把那个1改成你要的开关号
  325.        # 演奏冻结 SE
  326.        $game_system.se_play($data_system.buzzer_se)
  327.        return
  328.      end
  329.      for a in $game_party.actors
  330.        if a.inputable?
  331.          case a.last_action.kind
  332.          when 0  # 攻击,防御
  333.            #防御
  334.            if a.last_action.basic == 1
  335.              # 设置行动
  336.              a.current_action.kind = 0
  337.              a.current_action.basic = 1
  338.              #攻击
  339.              else
  340.              # 设置行动
  341.              a.current_action.kind = 0
  342.              a.current_action.basic = 0
  343.              a.current_action.target_index = a.last_action.target_index
  344.            end
  345.          when 1  # 特技
  346.          skill_id = a.last_action.skill_id
  347.          if a.skill_learn?(skill_id) and  
  348.            a.skill_can_use?(skill_id)
  349.            # 设置行动
  350.            a.current_action.kind = 1
  351.            a.current_action.skill_id = a.last_action.skill_id
  352.            a.current_action.target_index = a.last_action.target_index
  353.          elsif
  354.            # 不能使用就攻击
  355.            if $data_skills[skill_id].scope < 3
  356.              a.current_action.kind = 0
  357.              a.current_action.basic = 0
  358.              a.current_action.target_index = a.last_action.target_index
  359.            else
  360.              a.current_action.kind = 0
  361.              a.current_action.basic = 0
  362.              a.current_action.target_index = 0
  363.            end
  364.          end
  365.          when 2  # 物品
  366.            item_id = a.last_action.item_id
  367.            if $game_party.item_can_use?(item_id)
  368.              # 设置行动
  369.              a.current_action.kind = 2
  370.              a.current_action.item_id = a.last_action.item_id
  371.              a.current_action.target_index = a.last_action.target_index
  372.            else
  373.              # 不能使用就攻击
  374.              a.current_action.kind = 0
  375.              a.current_action.basic = 0
  376.              a.current_action.target_index = 0
  377.            end
  378.          end
  379.        end
  380.        # 角色的明灭效果 OFF
  381.        if a != nil
  382.          a.blink = false
  383.        end
  384.      end
  385.      # 演奏确定 SE
  386.      $game_system.se_play($data_system.decision_se)
  387.      start_phase4
  388.      return
  389.    end
  390.    #------------------------------
  391.    # 按下 F 键的情况下
  392.    #------------------------------
  393.    if Kboard.keyboard($R_Key_F)
  394.      for a in $game_party.actors
  395.        if a.inputable?
  396.          a.current_action.kind = 0
  397.          a.current_action.basic = 0
  398.          a.current_action.target_index = 0
  399.        end
  400.        # 角色的明灭效果 OFF
  401.        if a != nil
  402.          a.blink = false
  403.        end
  404.      end
  405.      # 演奏确定 SE
  406.      $game_system.se_play($data_system.decision_se)
  407.      start_phase4
  408.      return
  409.    end
  410. end
  411. end
  412. #==============================================================================
  413. # 本脚本来自[url=http://www.66rpg.com]www.66rpg.com[/url],转载和使用请保留此信息  
  414. #==============================================================================

Lv5.捕梦者 (版主)

梦石
1
星屑
23984
在线时间
3339 小时
注册时间
2011-7-8
帖子
3926

开拓者

2
发表于 2017-10-18 19:15:36 | 只看该作者
你的队伍里可能有不出战的队员?

评分

参与人数 1星屑 +30 收起 理由
RyanBern + 30 我很赞同

查看全部评分

熟悉rgss和ruby,xp区版主~
正在填坑:《膜拜组传奇》讲述膜拜组和学霸们的故事。
已上steam:与TXBD合作的Reformers《变革者》
* 战斗调用公共事件 *
* RGSOS 网络脚本 *
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
479
在线时间
30 小时
注册时间
2017-5-30
帖子
56
3
 楼主| 发表于 2017-10-18 20:51:39 | 只看该作者
本帖最后由 樱桃丸子aab 于 2017-10-18 21:04 编辑
guoxiaomi 发表于 2017-10-18 19:15
你的队伍里可能有不出战的队员?

您真是一语中的!我新开游戏不会报错!
那么问题来了

问题1:这个脚本每回合开始的时候会让玩家判断是否用“R”键,所以导致敌人和玩家都卡在画面上固定不动,只有当玩家按了“R”或者回车后画面才开始动(原先应该角色的战斗图会有闪动,敌人也是,现在就卡在那里不动了),请问能否改善这种卡顿。

问题2:经过测试,这个脚本和《去掉“战斗\逃跑”,并把逃跑加入到菜单中》脚本冲突,会导致无法逃跑,脚本如下:

  1. #=======================================================================
  2. # ■ 本脚本来自 www.66rpg.com 转载和使用时请保留此信息
  3. #-----------------------------------------------------------------------
  4. #   脚本功能:去掉战斗开始时候的 战斗/逃跑 的选择过程.
  5. #             并把逃跑加入到角色命令菜单当中
  6. #   脚本作者:后知后觉  2010-8-11 13:46:59
  7. #   使用方法:直接在 Main 前插入即可
  8. #=======================================================================
  9. class Window_PartyCommand < Window_Selectable
  10.   def visible=(value)
  11.     super(false)
  12.   end
  13.   def active=(value)
  14.     super(false)
  15.   end
  16. end
  17. class Scene_Battle
  18.   alias hzhj_old_start_phase1 start_phase1
  19.   def start_phase1
  20.     class << @actor_command_window
  21.       attr_reader :commands
  22.       def commands=(value)
  23.         @commands = value
  24.         @item_max = @commands.size
  25.         self.height = @item_max * 32 + 32
  26.         self.y = [self.y - 32, 0].max
  27.         self.contents.dispose
  28.         self.contents = Bitmap.new(width - 32, height - 32)
  29.         refresh
  30.       end
  31.     end
  32.     commands = @actor_command_window.commands
  33.     unless $game_temp.battle_can_escape
  34.       @actor_command_window.disable_item(commands.size - 1)
  35.     end
  36.     hzhj_old_start_phase1
  37.   end
  38.   alias hzhj_old_start_phase2 start_phase2
  39.   def start_phase2
  40.     hzhj_old_start_phase2
  41.     if @phase == 2
  42.       start_phase3
  43.     end
  44.   end
  45.   alias hzhj_old_update_phase3_basic_command update_phase3_basic_command
  46.   def update_phase3_basic_command
  47.     hzhj_old_update_phase3_basic_command
  48.     if Input.trigger?(13)
  49.       if @actor_command_window.index == @actor_command_window.commands.size - 1
  50.         unless $game_temp.battle_can_escape
  51.           $game_system.se_play($data_system.buzzer_se)
  52.           return
  53.         end
  54.         $game_system.se_play($data_system.decision_se)
  55.         update_phase2_escape
  56.         return
  57.       end
  58.     end
  59.   end
  60. end

  61. #=======================================================================
  62. # ■ 本脚本来自 www.66rpg.com 转载和使用时请保留此信息
  63. #=======================================================================
复制代码
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
36124
在线时间
10712 小时
注册时间
2009-3-15
帖子
4806
4
发表于 2017-10-18 22:28:14 | 只看该作者
樱桃丸子aab 发表于 2017-10-18 20:51
您真是一语中的!我新开游戏不会报错!
那么问题来了

战斗\逃跑脚本放在重复上次命令脚本下面试试..

评分

参与人数 1星屑 +50 收起 理由
RyanBern + 50 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
479
在线时间
30 小时
注册时间
2017-5-30
帖子
56
5
 楼主| 发表于 2017-10-19 01:23:46 | 只看该作者
soulsaga 发表于 2017-10-18 22:28
战斗\逃跑脚本放在重复上次命令脚本下面试试..

您好,感谢您的解答,问题全部解决,对您佩服之极!!!!!!!!!!!!!!!!!!!!!!!!!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

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

GMT+8, 2024-9-21 18:35

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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