Project1

标题: 简易的区域自动事件…… [打印本页]

作者: 冰舞蝶恋    时间: 2010-10-13 21:43
标题: 简易的区域自动事件……
本帖最后由 冰舞蝶恋 于 2010-10-14 13:05 编辑


就这样设定,玩家走进区域就会自动执行事件!
  1. #====================================================
  2. # ■Auto_Start_Event
  3. #----------------------------------------------------
  4. # 区域自动事件
  5. #====================================================

  6. =begin
  7. 使用方法:设置区域,区域名为eventxx,其中xx为事件ID
  8.           则角色走入区域后会执行xx事件。
  9. 注意事项:通过设置移动路线走入不会启动,场所移动时也不会启动事件。
  10. =end

  11. #==============================================================================
  12. # ■ Game_Player
  13. #------------------------------------------------------------------------------
  14. #  处理主角的类。事件启动的判定、以及地图的滚动等功能。
  15. # 本类的实例请参考 $game_player。
  16. #==============================================================================

  17. class Game_Player < Game_Character
  18.   #--------------------------------------------------------------------------
  19.   # ● 判断正面的事件启动
  20.   #     triggers : 目标队列
  21.   #--------------------------------------------------------------------------
  22.   alias auto_start_check_touch_event check_touch_event
  23.   def check_touch_event
  24.    
  25.     auto_start_check_touch_event
  26.      for area in $data_areas.values
  27.        if in_area?(area)
  28.          id = area.name.split("event")[1].to_i
  29.          if id != 0
  30.            $game_map.events[id].start
  31.          end
  32.        end
  33.         
  34.      end
  35.    
  36.   end#check_event_trigger_there(triggers)
  37. end#class Game_Player < Game_Character
复制代码

作者: 874609281    时间: 2010-10-14 12:24
挺好
作者: 红灯    时间: 2010-10-14 20:58
楼主进步神速啊,这个似乎跟这个教程重复?
http://rpg.blue/thread-157840-1-1.html
作者: 429259591    时间: 2010-10-14 21:00
看来,我也要去学脚本了
作者: 神行者    时间: 2011-7-17 12:01
提示: 作者被禁止或删除 内容自动屏蔽
作者: 忧雪の伤    时间: 2011-7-17 13:06
恩,冰舞姐进步神速,知道用别名了,我以为你还继续重定义下去……
作者: 怨念之魂    时间: 2011-9-21 02:57
提示: 作者被禁止或删除 内容自动屏蔽
作者: 九夜神尊    时间: 2011-9-21 08:56
怨念之魂 发表于 2011-9-21 02:57
测试结果

A图 利用此脚本,事件A顺利启动

联系我好了QQ371453839




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1