赞 | 6 |
VIP | 0 |
好人卡 | 0 |
积分 | 11 |
经验 | 0 |
最后登录 | 2022-3-24 |
在线时间 | 26 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 1122
- 在线时间
- 26 小时
- 注册时间
- 2021-2-19
- 帖子
- 30
|
事件名改成preserve即可保存
- class << DataManager
- alias yami_create_game_objects create_game_objects
- alias yami_make_save_contents make_save_contents
- alias yami_extract_save_contents extract_save_contents
- def create_game_objects
- $YAMI_PRESERVED_EVENTS = {}
- yami_create_game_objects
- end
- def make_save_contents
- contents = yami_make_save_contents
- contents[:YAMI_PRESERVED_EVENTS] = $YAMI_PRESERVED_EVENTS
- contents
- end
- def extract_save_contents(contents)
- yami_extract_save_contents(contents)
- $YAMI_PRESERVED_EVENTS = contents[:YAMI_PRESERVED_EVENTS]
- end
- end
- class Game_Map
- attr_reader :map
- end
- class Scene_Map
- alias yami_pre_transfer pre_transfer
- alias yami_post_transfer post_transfer
- def pre_transfer
- $game_map.events.each_value do |e|
- if $game_map.map.events[e.id].name.include?("preserve")
- $YAMI_PRESERVED_EVENTS[[$game_map.map_id,e.id]] = [e.x,e.y]
- end
- end
- yami_pre_transfer
- end
- def post_transfer
- $YAMI_PRESERVED_EVENTS.each_pair do |k, v|
- if $game_map.map_id == k[0]
- $game_map.events[k[1]].moveto(v[0], v[1])
- end
- end
- yami_post_transfer
- end
- end
复制代码 |
|