查看: 3330|回复: 2

[已经解决] 关于事件保存位置脚本(已自行解决orz)

[复制链接]
梦石
10
星屑
60
在线时间
337 小时
注册时间
2014-4-4
回帖
137
发表于 2014-11-30 21:50:16 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 auttbutt 于 2014-11-30 21:58 编辑

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

[pre lang="ruby" line="1"]#==============================================================================
# ■ Game_Event
#------------------------------------------------------------------------------
#  处理事件的类。拥有条件判断、事件页的切换、并行处理、执行事件等功能。
#   在 Game_Map 类的内部使用。
#==============================================================================

class Game_Event < Game_Character
  # 改为true将会变成保存被标记为不保存的事件
  INVERSE_MARK = false
  #--------------------------------------------------------------------------
  # ● 是否储存位置
  #--------------------------------------------------------------------------
  def save_pos?
    return true unless @list
    return true if @list[0].code != 108
    return (@list[0].parameters[0].include?("不保存事件位置") == INVERSE_MARK)
  end
end
#==============================================================================
# ■ Game_Map
#------------------------------------------------------------------------------
#  管理地图的类。拥有卷动地图以及判断通行度的功能。
#   本类的实例请参考 $game_map 。
#==============================================================================

class Game_Map
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  alias save_event_pos_initialize initialize
  def initialize
    save_event_pos_initialize
    @event_pos = {}
  end
  #--------------------------------------------------------------------------
  # ● 设置
  #--------------------------------------------------------------------------
  alias save_event_pos_setup setup
  def setup(map_id)
    save_event_pos
    save_event_pos_setup(map_id)
    load_event_pos
  end
  #--------------------------------------------------------------------------
  # ● 保存事件位置
  #--------------------------------------------------------------------------
  def save_event_pos
    return if @map_id == 0
    @event_pos[@map_id] ||= []
    @events.each{|i,e|
    if e.save_pos?
      @event_pos[@map_id] = [e.x,e.y,e.direction]
    else
      @event_pos[@map_id] = nil
    end
    }
  end
  #--------------------------------------------------------------------------
  # ● 读取事件位置
  #--------------------------------------------------------------------------
  def load_event_pos
    return if @map_id == 0
    @event_pos[@map_id] ||= []
    @events.each{|i,e|
      next unless @event_pos[@map_id]
      e.moveto(@event_pos[@map_id][0],@event_pos[@map_id][1])
      e.set_direction(@event_pos[@map_id][2])
    }
  end
end[/pre]

新作短十作品~《前夜祭-哀魔女之诗》
地址:https://rpg.blue/thread-383776-1-1.html
梦石
10
星屑
60
在线时间
337 小时
注册时间
2014-4-4
回帖
137
 楼主| 发表于 2014-11-30 21:57:58 | 显示全部楼层
好吧,又再次自行解决orz

新作短十作品~《前夜祭-哀魔女之诗》
地址:https://rpg.blue/thread-383776-1-1.html
回复

使用道具 举报

故九江太守

梦石
0
星屑
314
在线时间
2158 小时
注册时间
2012-12-5
回帖
4323
发表于 2014-11-30 22:28:21 | 显示全部楼层
名字带<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
复制代码

评分

参与人数 1星屑 +200 收起 理由
VIPArcher + 200 塞糖

查看全部评分

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部