Project1

标题: 关于事件保存位置脚本(已自行解决orz) [打印本页]

作者: auttbutt    时间: 2014-11-30 21:50
标题: 关于事件保存位置脚本(已自行解决orz)
本帖最后由 auttbutt 于 2014-11-30 21:58 编辑

关于下面这个脚本,由于咱是脚本渣,求大大教我怎么样才能设置不保存某个事件?(完全看不懂QAQ)

RUBY 代码复制
  1. #==============================================================================
  2. # ■ Game_Event
  3. #------------------------------------------------------------------------------
  4. #  处理事件的类。拥有条件判断、事件页的切换、并行处理、执行事件等功能。
  5. #   在 Game_Map 类的内部使用。
  6. #==============================================================================
  7.  
  8. class Game_Event < Game_Character
  9.   # 改为true将会变成保存被标记为不保存的事件
  10.   INVERSE_MARK = false
  11.   #--------------------------------------------------------------------------
  12.   # ● 是否储存位置
  13.   #--------------------------------------------------------------------------
  14.   def save_pos?
  15.     return true unless @list
  16.     return true if @list[0].code != 108
  17.     return (@list[0].parameters[0].include?("不保存事件位置") == INVERSE_MARK)
  18.   end
  19. end
  20. #==============================================================================
  21. # ■ Game_Map
  22. #------------------------------------------------------------------------------
  23. #  管理地图的类。拥有卷动地图以及判断通行度的功能。
  24. #   本类的实例请参考 $game_map 。
  25. #==============================================================================
  26.  
  27. class Game_Map
  28.   #--------------------------------------------------------------------------
  29.   # ● 初始化对象
  30.   #--------------------------------------------------------------------------
  31.   alias save_event_pos_initialize initialize
  32.   def initialize
  33.     save_event_pos_initialize
  34.     @event_pos = {}
  35.   end
  36.   #--------------------------------------------------------------------------
  37.   # ● 设置
  38.   #--------------------------------------------------------------------------
  39.   alias save_event_pos_setup setup
  40.   def setup(map_id)
  41.     save_event_pos
  42.     save_event_pos_setup(map_id)
  43.     load_event_pos
  44.   end
  45.   #--------------------------------------------------------------------------
  46.   # ● 保存事件位置
  47.   #--------------------------------------------------------------------------
  48.   def save_event_pos
  49.     return if @map_id == 0
  50.     @event_pos[@map_id] ||= []
  51.     @events.each{|i,e|
  52.     if e.save_pos?
  53.       @event_pos[@map_id][i] = [e.x,e.y,e.direction]
  54.     else
  55.       @event_pos[@map_id][i] = nil
  56.     end
  57.     }
  58.   end
  59.   #--------------------------------------------------------------------------
  60.   # ● 读取事件位置
  61.   #--------------------------------------------------------------------------
  62.   def load_event_pos
  63.     return if @map_id == 0
  64.     @event_pos[@map_id] ||= []
  65.     @events.each{|i,e|
  66.       next unless @event_pos[@map_id][i]
  67.       e.moveto(@event_pos[@map_id][i][0],@event_pos[@map_id][i][1])
  68.       e.set_direction(@event_pos[@map_id][i][2])
  69.     }
  70.   end
  71. end


作者: auttbutt    时间: 2014-11-30 21:57
好吧,又再次自行解决orz
作者: 你最珍贵    时间: 2014-11-30 22:28
名字带<BC>的保存事件
  1. class Game_Map
  2. alias old_setup setup
  3. def setup(jiong)
  4.   if @lv_x == nil
  5.     @lv_x = []
  6.     @lv_y = []
  7.     @lv_direction = []
  8.   end
  9.   if @lv_x[jiong]==nil
  10.       @lv_x[jiong]=[]
  11.       @lv_y[jiong]=[]
  12.       @lv_direction[jiong]=[]
  13.   end
  14.   old_setup(jiong)
  15. end
  16. def lv_x(one,two)
  17.   return @lv_x[one][two]
  18. end
  19. def lv_y(one,two)
  20.   return @lv_y[one][two]
  21. end
  22. def lv_x2(one,two,three)
  23.   @lv_x[one][two]=three
  24. end
  25. def lv_y2(one,two,three)
  26.   @lv_y[one][two]=three
  27. end
  28. def lv_direction(one,two)
  29.   return @lv_direction[one][two]
  30. end
  31. def lv_direction2(one,two,three)
  32.   @lv_direction[one][two]=three
  33. end
  34. end


  35. class Game_Event
  36. attr_reader   :id
  37. attr_reader   :map_id
  38. alias old_update update
  39. def update
  40.   old_update
  41.   $game_map.lv_x2(@map_id,@id,self.x)
  42.   $game_map.lv_y2(@map_id,@id,self.y)
  43.   $game_map.lv_direction2(@map_id,@id,self.direction)
  44. end
  45. def initialize(map_id, event)
  46.   super()
  47.   @map_id = map_id
  48.   @event = event
  49.   @id = @event.id
  50.   @erased = false
  51.   @starting = false
  52.   @through = true
  53.   if $game_map.lv_x(@map_id,@id)!=nil and @event.name =~ "<BC>"
  54.     @event.x = $game_map.lv_x(@map_id,@id)
  55.     @event.y = $game_map.lv_y(@map_id,@id)
  56.     @direction = $game_map.lv_direction(@map_id,@id)
  57.   end
  58.   moveto(@event.x, @event.y)
  59.   refresh
  60. end
  61. end
复制代码





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