| 
 
| 赞 | 2 |  
| VIP | 2 |  
| 好人卡 | 4 |  
| 积分 | 1 |  
| 经验 | 96076 |  
| 最后登录 | 2015-12-27 |  
| 在线时间 | 93 小时 |  
 Lv1.梦旅人 
	梦石0 星屑50 在线时间93 小时注册时间2008-5-16帖子745 | 
| 
类型 0 = 单独区域遇敌, 1 = 区域遇敌+普通遇敌 , 2 = 普通遇敌
x
加入我们,或者,欢迎回来。您需要 登录 才可以下载或查看,没有帐号?注册会员  使用方法在脚本中,比较简便使用!
 
 
 看到事件设置区域敌人好象很麻烦,所以写了个脚本简洁版的......
 好象很不理想的方法,但是写成了{/gg}
 好了不多说!
 贴脚本
 
 复制代码=begin
 ■ 区域遇敌-脚本版 By 茄子
 联系QQ 9244579
 
 
 轻松设置某个区域遇敌的敌人ID
 在每个地图上放一个并行事件
 事件内容为脚本(也就是设置该地图的敌人)
 如:
 
 Control_Enemys::RANGS = [  
 [1,[0,3],[0,3]],   
 数据分别为 
 [数据库里敌人队伍1,[起始X坐标0,目的X坐标3],[起始Y坐标0,目的Y坐标3]]
 ==>该敌人ID=1)<==     ================>该敌人遇到的范围<=============
 该ID是数据库中队伍的ID,不是敌人的ID。
 遇敌概率还是在地图上设置
 如果不需要区域遇敌,类型 0 = 单独区域遇敌, 1 = 区域遇敌+普通遇敌 , 2 = 普通遇敌
 普通遇敌遇到的就是你原来在地图上设置的敌人了。
 Control_Enemys::TYPE = 2
 ]
 设置完后在最后需要设置现在地图原来的敌人编号
 
 如:
 
 原来地图设置敌人两个编号为 1 2 都是幽灵
 Control_Enemys::OLD_ENEMYS = [1,2] 这样以便返回以前的敌人。
 
 
=end
module Control_Enemys
OLD_ENEMYS = [1,2]
RANGS =  [  
[1,[0,3],[0,3]],
[4,[16,19],[0,3]]
]
TYPE = 0
end
class Game_Player
  attr_writer :encounter_count
end
class Game_Map
  attr_writer :encounter_list
end
class Scene_Map
  def update
    loop do
      $game_map.update
      $game_system.map_interpreter.update
      $game_player.update
      $game_system.update
      $game_screen.update
      unless $game_temp.player_transferring
        break
      end
      transfer_player
      if $game_temp.transition_processing
        break
      end
    end
    @spriteset.update
    @message_window.update
    if $game_temp.gameover
      $scene = Scene_Gameover.new
      return
    end
    if $game_temp.to_title
      $scene = Scene_Title.new
      return
    end
    if $game_temp.transition_processing
      $game_temp.transition_processing = false
      if $game_temp.transition_name == ""
        Graphics.transition(20)
      else
        Graphics.transition(40, "Graphics/Transitions/" +
          $game_temp.transition_name)
      end
    end
    if $game_temp.message_window_showing
      return
    end
    if Control_Enemys::TYPE == 1
      if $game_player.encounter_count == 0 and Control_Enemys::OLD_ENEMYS != []
      unless $game_system.map_interpreter.running? or
             $game_system.encounter_disabled   
        n = rand(Control_Enemys::OLD_ENEMYS.size)
        troop_id = Control_Enemys::OLD_ENEMYS[n]
        if $data_troops[troop_id] != nil
          $game_temp.battle_calling = true
          $game_temp.battle_troop_id = troop_id
          $game_temp.battle_can_escape = true
          $game_temp.battle_can_lose = false
          $game_temp.battle_proc = nil
         end
        end
      end  
    end  
    else
     for i in Control_Enemys::RANGS
      if $game_player.x >= i[1][0] and $game_player.x <= i[1][1] and
       $game_player.y >= i[2][0] and $game_player.y <= i[2][1]
      if $game_player.encounter_count == 0 and i[0] != []
      unless $game_system.map_interpreter.running? or
             $game_system.encounter_disabled
        enemys = []
        enemys.push(i[0])
        n = rand(enemys.size)
        troop_id = enemys[n]
        if $data_troops[troop_id] != nil
          $game_temp.battle_calling = true
          $game_temp.battle_troop_id = troop_id
          $game_temp.battle_can_escape = true
          $game_temp.battle_can_lose = false
          $game_temp.battle_proc = nil
         end
        end
       end  
     end
   end
    if Control_Enemys::TYPE == 2
     if $game_player.encounter_count == 0 and $game_map.encounter_list != []
      unless $game_system.map_interpreter.running? or
             $game_system.encounter_disabled
        n = rand($game_map.encounter_list.size)
        troop_id = $game_map.encounter_list[n]
        if $data_troops[troop_id] != nil
          $game_temp.battle_calling = true
          $game_temp.battle_troop_id = troop_id
          $game_temp.battle_can_escape = true
          $game_temp.battle_can_lose = false
          $game_temp.battle_proc = nil
        end
      end
    end
   end
    if Input.trigger?(Input::B)
      unless $game_system.map_interpreter.running? or
        $game_system.menu_disabled
        $game_temp.menu_calling = true
        $game_temp.menu_beep = true
      end
    end
    if $DEBUG and Input.press?(Input::F9)
      $game_temp.debug_calling = true
    end
    unless $game_player.moving?
      if $game_temp.battle_calling
        call_battle
      elsif $game_temp.shop_calling
        call_shop
      elsif $game_temp.name_calling
        call_name
      elsif $game_temp.menu_calling
        call_menu
      elsif $game_temp.save_calling
        call_save
      elsif $game_temp.debug_calling
        call_debug
      end
    end
  end
end
然后在放个范例吧
 这样比较好容易上手。
 点我下载范例
 
 | 
 |