66RPG
本站首页
制作教程
文章作品
制作素材
原创游戏区
周边下载
本站论坛
 ※ 站内搜索
栏 目:
方 式:
关键词:
  
 ※ 教程分类
 RMXP 图文教学
 初级教学
 中级教学
 高级教学
 个人创意与研究
 RMXP 录像教学
 新人入门录像
 零散录像教学
 商业素材使用录像 ★
 周边教学
 美工 与 音乐
 RMXP 脚本发布
 游戏系统修改
 地图效果类
 战斗系统相关
 全新系统类
 API与高难度类
 RMVX 制作教学
 RMVX 初级教学
 RMVX 中级教程
 RMVX 高级教程
 RMVX 综合制作展
 ※ 无图目录 (按点击量横排序)


-- 66RPG全内容文字目录 --


 ※ 近期特色教学
区域遇敌-脚本简洁版 ( 66RPG, RPG MAKER XP教程 )
 本站首页→制作教程→地图效果类

区域遇敌-脚本简洁版


教程作者:★_茄孓
首发网址:点此进入本教学的原始帖
适宜用户:RMXP用户
技术通用度:★★★★★
技术应用复杂度:40 (满分150分)
学习的理解难度:40 (满分150分)

 作者的话:

类型 0 = 单独区域遇敌, 1 = 区域遇敌+普通遇敌 , 2 = 普通遇敌
使用方法在脚本中,比较简便使用

范例下载:
http://bbs.66rpg.com/upload_program/files/区域遇敌-脚本简洁版_96142428.rar

 教学正文:

=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



关键字:

发布日期:2008-8-6 22:19:43 点击量:1


 上一篇:角色选择界面
 下一篇:没有下一条记录
关于我们
支援本站
友情连接
站点目录
站内搜索



WWW.66RPG.COM,2005-2013 ^o^

备案序号:京ICP备05035415号



 
Web www.66rpg.com bbs.66rpg.com