| 
 
| 赞 | 5 |  
| VIP | 620 |  
| 好人卡 | 38 |  
| 积分 | 70 |  
| 经验 | 125468 |  
| 最后登录 | 2015-7-27 |  
| 在线时间 | 1666 小时 |  
 Lv4.逐梦者 
	梦石0 星屑6955 在线时间1666 小时注册时间2008-10-29帖子6710 
 | 
| 设置在第 60 行.是一个哈希表. 以队伍的id为键(就是 => 符号的左边)
 以数组为值.这里称之为 数组A吧.
 数组A里装的仍然是数组.就叫 数组B.
 数组B里放3个整数单元.依次为 公共事件ID,TurnA,TrunB
 数组A里可以放多个数组B.
 啊.额.没看明白的话直接看 60-62行吧 我预先设置了 1 2 3 号队伍的样板.
 这楼帖出来的脚本除了改了设置方法外.还改了一个东西来适应那个战斗系统.复制代码#==============================================================================
# ■ 战斗中刷新指定公共事件
#------------------------------------------------------------------------------
#   作者:后知后觉 2011-3-31
#==============================================================================
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle
  alias hzhj_old_main_for_common_event main
  alias hzhj_old_setup_battle_event_for_common_event setup_battle_event
  alias hzhj_old_cp_turn_count_for_common_event cp_turn_count
  #--------------------------------------------------------------------------
  # ● 主处理
  #--------------------------------------------------------------------------
  def main
    $data_troops[$game_temp.battle_troop_id].hzhj_set_new_parameters
    @hzhj_events = $data_troops[$game_temp.battle_troop_id].hzhj_events
    @hzhj_turns = $data_troops[$game_temp.battle_troop_id].hzhj_turns
    @hzhj_flags = Array.new
    hzhj_old_main_for_common_event
  end
  #--------------------------------------------------------------------------
  # ● 设置战斗事件
  #--------------------------------------------------------------------------
  def setup_battle_event
    if $game_system.battle_interpreter.running?
      return
    end
    if not @hzhj_events.empty?
      for i in 0...@hzhj_events.size
        next if @hzhj_flags[i]
        n = $game_temp.battle_turn
        a = @hzhj_turns[i][0]
        b = @hzhj_turns[i][1]
        if (b == 0 and n != a) or
           (b > 0 and (n < 1 or n < a or n % b != a % b))
          next
        end
        $game_system.battle_interpreter.setup(@hzhj_events[i].list, 0)
        @hzhj_flags[i] = true
        return
      end
    end
    hzhj_old_setup_battle_event_for_common_event
  end
  #--------------------------------------------------------------------------
  # ● 开始主回合
  #--------------------------------------------------------------------------
  def cp_turn_count
    hzhj_old_cp_turn_count_for_common_event
    @hzhj_flags.clear
  end
end
module RPG
  class Troop
    CommonEventId = {1 => [[2, 0, 1]],
                     2 => [[2, 0, 0]],
                     3 => [[2, 0, 2], [4, 0, 2]]}
    def hzhj_events
      hzhj_set_new_parameters if @hzhj_events.nil?
      return @hzhj_events
    end
    def hzhj_turns
      hzhj_set_new_parameters if @hzhj_turns.nil?
      return @hzhj_turns
    end
    def hzhj_set_new_parameters
      return if not @hzhj_events.nil?
      @hzhj_events = Array.new
      @hzhj_turns = Array.new
      return if CommonEventId[@id].nil?
      for i in 0...CommonEventId[@id].size
        temp_e = CommonEventId[@id][i]
        @hzhj_events[i] = $data_common_events[temp_e[0]]
        @hzhj_turns[i] = Array.new
        @hzhj_turns[i][0] = temp_e[1]
        @hzhj_turns[i][1] = temp_e[2]
      end
    end
  end
end
我上面那楼帖的脚本在你的战斗系统里有个毛病.所以做了下修正.
 | 
 |