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

Project1

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

[已经过期] 游戏出错,是啥情况引起的

[复制链接]

Lv3.寻梦者

梦石
0
星屑
2180
在线时间
1011 小时
注册时间
2015-10-17
帖子
1285
跳转到指定楼层
1
发表于 2023-10-5 16:42:29 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 fjm 于 2023-10-5 16:45 编辑

用了下面这个脚本后,有时候正常,有时候出现下面情况,是啥引起的

[pre lang="ruby"]#RTAB战斗系统 For RPG Maker VX Ace 编写者:SLICK

#encoding:utf-8
#==============================================================================
# ■ Scene_Battle
#------------------------------------------------------------------------------
#  战斗画面
#==============================================================================

class Scene_Battle < Scene_Base
  attr_accessor :cp_quota
  attr_accessor :rtab_wait
  attr_accessor :active_members
  #--------------------------------------------------------------------------
  # ● 开始处理
  #--------------------------------------------------------------------------
  def start
    super
    @cp_quota = 0
    create_spriteset
    create_all_windows
    BattleManager.method_wait_for_message = method(:wait_for_message)
  end
  #--------------------------------------------------------------------------
  # ● 战斗开始
  #--------------------------------------------------------------------------
  def battle_start
    @rtab_wait = true
    @active_members = []
    BattleManager.battle_start
    set_cp_quota
    process_event
    #start_party_command_selection
  end
  #--------------------------------------------------------------------------
  # ● 获取敌我双方人物的平均行动速度并决定CP槽的Quota值
  #--------------------------------------------------------------------------
  def set_cp_quota
    sss = 0.0
    for iii in $game_party.members
      sss += iii.param(6)
    end
    sss /= $game_party.members.size
    @cp_quota = sss * 200
    @spriteset.cp_quota = @cp_quota
    for iii in $game_party.members + $game_troop.members
      iii.cp_quota = @cp_quota
    end
  end
  #--------------------------------------------------------------------------
  # ● 进行下一个指令输入
  #--------------------------------------------------------------------------
  def next_command
    if BattleManager.next_command
      start_actor_command_selection
    else
      turn_start(@active_members)
    end
  end
  #--------------------------------------------------------------------------
  # ● 返回上一个指令输入
  #--------------------------------------------------------------------------
  def prior_command
    if BattleManager.prior_command
      start_actor_command_selection
    else
      start_party_command_selection
    end
  end
  #--------------------------------------------------------------------------
  # ● 更新画面
  #--------------------------------------------------------------------------
  def update
    super
    if BattleManager.in_turn?
      process_event
      process_action
    else
      if @rtab_wait
        for iii in $game_party.members + $game_troop.members
          iii.in_turn = false
          iii.rtab_cp += iii.param(6)
          if iii.rtab_cp >= iii.cp_quota
            @active_members.push(iii)
            iii.in_turn = true
          end
        end
        if @active_members.size > 0
          @rtab_wait = false
          start_party_command_selection
        end
      end
    end
    BattleManager.judge_win_loss
  end
  #--------------------------------------------------------------------------
  # ● 回合开始
  #--------------------------------------------------------------------------
  def turn_start(members)
    @party_command_window.close
    @actor_command_window.close
    @status_window.unselect
    @subject = nil
    BattleManager.turn_start(members)
    @log_window.wait
    @log_window.clear
  end
  #--------------------------------------------------------------------------
  # ● 回合结束
  #--------------------------------------------------------------------------
  def turn_end
    @active_members.each do |battler|
      battler.on_turn_end
      refresh_status
      @log_window.display_auto_affected_status(battler)
      @log_window.wait_and_clear
    end
    BattleManager.turn_end
    process_event
    @rtab_wait = true
    @active_members = []
  end
  #--------------------------------------------------------------------------
  # ● 处理战斗行动
  #--------------------------------------------------------------------------
  def process_action
    return if scene_changing?
    if !@subject || [email protected]_action
      @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 start_party_command_selection
    unless scene_changing?
      refresh_status
      @status_window.unselect
      @status_window.open
      if BattleManager.input_start
        BattleManager.clear_actor
        BattleManager.next_command
        @status_window.select(BattleManager.actor.index)
        @actor_command_window.setup(BattleManager.actor)
      else
        @party_command_window.deactivate
        @actor_command_window.close
        turn_start(@active_members)
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 生成角色指令窗口
  #--------------------------------------------------------------------------
  def create_actor_command_window
    @actor_command_window = Window_ActorCommand.new
    @actor_command_window.viewport = @info_viewport
    @actor_command_window.set_handler(:attack, method(:command_attack))
    @actor_command_window.set_handler(:skill,  method(:command_skill))
    @actor_command_window.set_handler(:guard,  method(:command_guard))
    @actor_command_window.set_handler(:item,   method(:command_item))
    @actor_command_window.set_handler(:cancel, method(:prior_command))
    @actor_command_window.set_handler(:escape, method(:command_escape))
    @actor_command_window.x = Graphics.width
  end
  #--------------------------------------------------------------------------
  # ● 指令“撤退”
  #--------------------------------------------------------------------------
  def command_escape
    unless BattleManager.process_escape
      turn_start(@active_members)
      for iii in @active_members
        iii.rtab_cp = 0
      end
    end
  end
end

#encoding:utf-8
#==============================================================================
# ■ Window_ActorCommand
#------------------------------------------------------------------------------
#  战斗画面中,选择角色行动的窗口。
#==============================================================================

class Window_ActorCommand < Window_Command
  #--------------------------------------------------------------------------
  # ● 生成指令列表
  #--------------------------------------------------------------------------
  def make_command_list
    return unless @actor
    add_attack_command
    add_skill_commands
    add_guard_command
    add_item_command
    add_escape_command
  end
  #--------------------------------------------------------------------------
  # ● 添加撤退指令
  #--------------------------------------------------------------------------
  def add_escape_command
    add_command(Vocab::escape, :escape, BattleManager.can_escape?)
  end
end

#encoding:utf-8
#==============================================================================
# ■ BattleManager
#------------------------------------------------------------------------------
#  战斗过程的管理器。
#==============================================================================

module BattleManager
  #--------------------------------------------------------------------------
  # ● 战斗开始
  #--------------------------------------------------------------------------
  def self.battle_start
    $game_system.battle_count += 1
    $game_party.on_battle_start
    $game_troop.on_battle_start
    $game_troop.enemy_names.each do |name|
      $game_message.add(sprintf(Vocab::Emerge, name))
    end
    if @preemptive
      $game_message.add(sprintf(Vocab::Preemptive, $game_party.name))
    elsif @surprise
      $game_message.add(sprintf(Vocab::Surprise, $game_party.name))
    end
    wait_for_message
  end
  #--------------------------------------------------------------------------
  # ● 遇敌时的处理
  #--------------------------------------------------------------------------
  def self.on_encounter
    @preemptive = false
    @surprise = false
  end
  #--------------------------------------------------------------------------
  # ● 回合开始
  #--------------------------------------------------------------------------
  def self.turn_start(members)
    @phase = :turn
    clear_actor
    $game_troop.increase_turn(members)
    make_action_orders(members)
  end
  #--------------------------------------------------------------------------
  # ● 生成行动顺序
  #--------------------------------------------------------------------------
  def self.make_action_orders(members)
    @action_battlers = []
    for iii in $game_party.members
      if members.include?(iii)
        @action_battlers.push(iii) unless @surprise
      end
    end
    for iii in $game_troop.members
      if members.include?(iii)
        @action_battlers.push(iii) unless @preemptive
      end
    end
    @action_battlers.each {|battler| battler.make_speed }
    @action_battlers.sort! {|a,b| b.speed - a.speed }
  end
end

#encoding:utf-8
#==============================================================================
# ■ Game_Battler
#------------------------------------------------------------------------------
#  处理战斗者的类。Game_Actor 和 Game_Enemy 类的父类。
#==============================================================================

class Game_Battler < Game_BattlerBase
  attr_accessor :turn_count
  attr_accessor :rtab_cp
  attr_accessor :cp_quota
  attr_accessor :in_turn
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  alias neoinitialize initialize
  def initialize
    @turn_count = 0
    @rtab_cp = 0
    @cp_quota = 100
    @in_turn = false
    neoinitialize
  end
  #--------------------------------------------------------------------------
  # ● 战斗开始处理
  #--------------------------------------------------------------------------
  def on_battle_start
    @turn_count = 0
    @rtab_cp = 0
    @cp_quota = 100
    @in_turn = false
    init_tp unless preserve_tp?
  end
  #--------------------------------------------------------------------------
  # ● 处理伤害
  #    调用前需要设置好
  #    @result.hp_damage   @result.mp_damage
  #    @result.hp_drain    @result.mp_drain
  #--------------------------------------------------------------------------
  def execute_damage(user)
    on_damage(@result.hp_damage) if @result.hp_damage > 0
    self.hp -= @result.hp_damage
    self.mp -= @result.mp_damage
    user.hp += @result.hp_drain
    user.mp += @result.mp_drain
    # 受伤后计算CP退后量
    cpback = @result.hp_damage + @result.mp_damage
    cpback = (cpback < 0 ? 0 : cpback)
    pent = 100.0 * cpback / self.mhp
    cppentback = ((0.1 + pent / 10) * self.cp_quota / 100).to_i
    @rtab_cp -= cppentback
    @rtab_cp = (@rtab_cp < 0 ? 0 : @rtab_cp)
  end
  #--------------------------------------------------------------------------
  # ● 判定是否可以输入指令
  #--------------------------------------------------------------------------
  def inputable?
    normal? && !auto_battle? && @in_turn
  end
  #--------------------------------------------------------------------------
  # ● 回合结束处理
  #--------------------------------------------------------------------------
  def on_turn_end
    @result.clear
    regenerate_all
    update_state_turns
    update_buff_turns
    remove_states_auto(2)
    # 该角色的回合计数加1并清空CP
    return unless SceneManager.scene_is?(Scene_Battle)
    @turn_count += 1
    @rtab_cp = 0
  end
end

#encoding:utf-8
#==============================================================================
# ■ Game_Troop
#------------------------------------------------------------------------------
#  管理敌群和战斗相关资料的类,也可执行如战斗事件管理之类的功能。
#   本类的实例请参考 $game_troop 。
#==============================================================================

class Game_Troop < Game_Unit
  #--------------------------------------------------------------------------
  # ● 增加回合
  #--------------------------------------------------------------------------
  def increase_turn(members)
    troop.pages.each {|page| @event_flags

555555566666.png (41.29 KB, 下载次数: 23)

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

本版积分规则

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

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

GMT+8, 2024-11-23 05:11

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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