查看: 2879|回复: 32

[已经解决] 战斗复活的问题

[复制链接]
梦石
0
星屑
2245
在线时间
1015 小时
注册时间
2015-10-17
回帖
1077
发表于 2017-1-23 13:32:09 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 fjm 于 2017-1-24 11:30 编辑

我方角色挂了,拉起来后,当前回合不会战斗,怎样才能使其当前回合也能战斗

点评

fjm
我发sidew代码老是提示内部错误,就发了下面这个链接,我就用了这个战斗脚本,没其他的了  发表于 2017-1-24 11:51
关于这个,我需要看你的战斗系统脚本(因为关系到追加角色回合)。最好是附上Scripts.rvdata2(如果不想公开可以私讯)。  发表于 2017-1-24 11:34
fjm
记得以前玩梦幻西游,人物拉起来当前回合就能打  发表于 2017-1-23 16:11
fjm
是回合制  发表于 2017-1-23 16:07
另外根据版规A-10-d,你这帖明显严重资讯不足。战斗系统用啥,回合机制是怎样的,插件脚本呢?啥都没提供。我们这儿可没通灵师。  发表于 2017-1-23 14:32
梦石
0
星屑
2245
在线时间
1015 小时
注册时间
2015-10-17
回帖
1077
 楼主| 发表于 2017-1-24 11:48:53 | 显示全部楼层
回复

使用道具 举报

梦石
0
星屑
6891
在线时间
7027 小时
注册时间
2013-11-2
回帖
1263

开拓者剧作品鉴家

发表于 2017-1-24 13:27:07 | 显示全部楼层
根据提供的范例大致弄出了效果:

[pre lang="ruby"]
module BattleManager
  class << self
   
    def revive_input_set(actor)
      @revive_input = true
      $game_party.members.each_with_index do |v,i|
        if v.id == actor.id
          @revive_actor_index = i
          break
        end  
      end  
    end
   
    def revive_input
      @revive_input
    end
   
    def revive_input_start
      @revive_input_start
    end
   
    def setup_revive_input
      @revive_input_start = true
      @actor_index = @revive_actor_index
      actor.make_actions
      @revive_input = false
    end
   
    def inject_revive_actor
      @action_battlers.insert(0,actor)
    end
   
    alias :rev_next_command :next_command
    def next_command
      if @revive_input_start
        inject_revive_actor
        @revive_input_start = false
        return false
      end  
      rev_next_command
    end

    alias :rev_prior_command :prior_command
    def prior_command
      return false if @revive_input_start
      rev_prior_command
    end
  
    def in_turn?
      return false if @revive_input_start
      @phase == :turn
    end
  
  end
end

class Scene_Battle < Scene_Base
  
  def process_action
    return if scene_changing?
    if !@subject || !@subject.current_action
      if BattleManager.revive_input
          BattleManager.setup_revive_input
          start_actor_command_selection
          return
      end  
      @subject = BattleManager.next_subject  
    end
    return turn_end unless @subject
    if @subject.current_action
      @subject.current_action.prepare
      if @subject.current_action.valid?
        @status_window.open
        execute_action
      end
      @subject.remove_current_action
    end
    process_action_end unless @subject.current_action
  end
  
  def prior_command
    if BattleManager.prior_command
      start_actor_command_selection
    elsif BattleManager.revive_input_start
        @actor_command_window.activate
    else  
        start_party_command_selection
    end
  end  
  
end  

class Game_Actor
  
  def revive
                @hp = 1 if @hp == 0
    return if !$game_party.in_battle
    BattleManager.revive_input_set(self)
        end
  
end  
[/pre]

在范例内测试没问题,复活的角色会立刻获得行动机会。
回复

使用道具 举报

梦石
0
星屑
2245
在线时间
1015 小时
注册时间
2015-10-17
回帖
1077
 楼主| 发表于 2017-1-24 16:25:40 | 显示全部楼层
RaidenInfinity 发表于 2017-1-24 13:27
根据提供的范例大致弄出了效果:

非常感谢,测试了下,效果出来了,可是复活的队友一旦战斗就出错,还有就是原本设置了自动战斗的队员拉起来后,
就会变回手动的了,这两个问题能解决吗
6111.jpg

点评

收到了,下载中  发表于 2017-1-24 17:23
fjm
打错字,是消息收到没  发表于 2017-1-24 17:22
fjm
已经发消息了,有受到没  发表于 2017-1-24 17:22
因为我用默认的工程测试是没问题的。自动战斗的话,这个是真的没考虑到。  发表于 2017-1-24 16:59
复活的队友战斗出错可能是真的有脚本撞到的问题(也许别的脚本出事)。建议提供Scripts.rvdata2(压缩了放度盘,要公开还是私讯可以选择)  发表于 2017-1-24 16:58
回复

使用道具 举报

梦石
0
星屑
6891
在线时间
7027 小时
注册时间
2013-11-2
回帖
1263

开拓者剧作品鉴家

发表于 2017-1-24 18:01:17 | 显示全部楼层
本帖最后由 RaidenInfinity 于 2017-1-25 20:39 编辑

自动战斗已经修正,单人多次行动复活已修正

[pre lang="ruby"]
module BattleManager
  class << self

    alias :rev_init_members :init_members
    def init_members
      @revive_input = []
      @revive_input_start = []
      @revive_actor_index = []
    end
   
    def revive_input_set(actor)
      @revive_input.push(true)
      $game_party.members.each_with_index do |v,i|
        if v.id == actor.id
          @revive_actor_index.push(i)
          break
        end  
      end  
    end

    def revive_input
      @revive_input[0]
    end

    def revive_input_start
      @revive_input_start[0]
    end

    def setup_revive_input
      @revive_input.shift
      @actor_index = @revive_actor_index.shift
      actor.make_actions
      if actor.auto_battle?
        actor.make_auto_battle_actions
        inject_revive_actor
      else
        @revive_input_start.push(true)
        SceneManager.scene.start_actor_command_selection
      end
    end

    def inject_revive_actor
      actor.make_speed
      @action_battlers.push(actor)
      @action_battlers.sort! {|a,b| b.speed - a.speed }
    end

    alias :rev_next_command :next_command
    def next_command
      if revive_input_start
        inject_revive_actor
        @revive_input_start.shift
        return false
      end  
      rev_next_command
    end

    alias :rev_prior_command :prior_command
    def prior_command
      return false if revive_input_start
      rev_prior_command
    end

    def in_turn?
      return false if revive_input_start
      @phase == :turn
    end

  end
end

class Scene_Battle < Scene_Base

  def process_action
    return if scene_changing?
    if !@subject || !@subject.current_action
      if BattleManager.revive_input
          BattleManager.setup_revive_input
          return
      end  
      @subject = BattleManager.next_subject  
    end
    return turn_end unless @subject
    if @subject.current_action
      @subject.current_action.prepare
      if @subject.current_action.valid?
        @status_window.open
        execute_action
      end
      @subject.remove_current_action
    end
    process_action_end unless @subject.current_action
  end

  def prior_command
    if BattleManager.prior_command
      start_actor_command_selection
    elsif BattleManager.revive_input_start
        @actor_command_window.activate
    else  
        start_party_command_selection
    end
  end  

end  

class Game_Actor

  def revive
                @hp = 1 if @hp == 0
    return if !$game_party.in_battle
    BattleManager.revive_input_set(self)
        end

end
[/pre]

必须把它放在所有插件脚本的最后面(你的工程的情况是自动战斗脚本后面)。
此外,报错用了提供的工程但还是没遇到过,所以无法确认有这个状况/顺利排除。

点评

fjm
多谢分享,像我现在不懂脚本,所以都不知道那些脚本的功能,想自己改都感觉无从下手  发表于 2017-1-25 21:22
只要透彻地理解RMVA默认脚本各部分的运作原理,就能在不引起效率问题(如绘制太多东西)的前提下呼风唤雨。这些原理/感想我会在脚本教程里分享。  发表于 2017-1-25 21:17
fjm
非常感谢,问题解决了,感觉版主真是无所不能啊.  发表于 2017-1-25 21:08
目前是可以单个角色单回合多次使用复活了。(一次过复活全队的技能/物品理论上也可以用了)  发表于 2017-1-25 20:40
fjm
就是打BOSS的时候,有时候运气不好,一下子挂了好几个,只能全部拉起来,要不然没法打了,一个角色负责复活,一个奶妈负责回复,其余角色图省力都设置自动  发表于 2017-1-25 20:11

评分

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

查看全部评分

回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部