赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 18 |
经验 | 0 |
最后登录 | 2025-4-3 |
在线时间 | 341 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 1792
- 在线时间
- 341 小时
- 注册时间
- 2019-7-25
- 帖子
- 12
|
本帖最后由 新之梦 于 2022-6-22 15:15 编辑
复制脚本是有复制的事件不能使用独立开关的BUG,所以要用1.1版本的复制脚本- #encoding:utf-8
- #==============================================================================
- # ■ 在游戏运行中复制事件 V1.1
- #------------------------------------------------------------------------------
- # V1.1 修正复制事件无法开启独立开关的错误
- #
- # 使用说明:
- # copy_map_event(map_id, event_id, x, y)
- # 复制特定地图的特定事件 到坐标 x y
- # 如果x, y坐标不填,事件就复制到原本的坐标
- # 示例 copy_map_event(2, 1) # 复制地图2的事件1
- # copy_map_event(3, 2, 0, 0) # 复制地图3的事件2到坐标(0,0)
- #
- # remove_copy_event(map_id, event_id)
- # 移除从特定地图复制过来的事件,如果复制了多个则全部移除
- # 需要一个一个移除使用下面的方法
- #
- # remove_map_event(事件id)
- # 移除指定id的事件
- # 复制过来的事件id为 当前地图事件id最大值 + 1
- #==============================================================================
- class Game_Interpreter
- def copy_map_event(map_id, event_id, x = nil, y = nil)
- map_filename = sprintf("Data/Map%03d.rvdata2", map_id)
- if true
- event = load_data(map_filename).events[event_id]
- if event
- event = Game_Event.new($game_map.map_id, event)
- event_id = $game_map.events.keys.max + 1
- event_id += $game_map.copy_map_events.size if $game_map.copy_map_events
- event.event_copy_setup(event_id, x, y)
- $game_map.prepare_copy_event(event)
- end
- end
- end
- def remove_copy_event(map_id, event_id)
- $game_map.events.each_value {|event|
- if event.copy_id == event_id && event.map_id == map_id
- $game_map.prepare_remove_event(event)
- end
- }
- end
- def remove_map_event(event_id)
- event = $game_map.events[event_id]
- $game_map.prepare_remove_event(event) if event
- end
- alias_method :copy_map_event_command_123, :command_123
- def process_copy_self_switch(event)
- event.copy_self_switch ||= {}
- event.copy_self_switch[@params[0]] = (@params[1] == 0)
- all_off = true
- event.copy_self_switch.each_value {|key| break all_off = false if key}
- event.copy_self_switch = nil if all_off
- $game_map.need_refresh = true
- end
- end
- class Spriteset_Map
- def add_copy_event(event)
- @character_sprites.push(Sprite_Character.new(@viewport1, event))
- end
- def remove_copy_event(event)
- @character_sprites.each {|sprite|
- if sprite.character == event
- @character_sprites.delete(sprite)
- sprite.dispose
- return
- end
- }
- end
- end
- class Scene_Map
- attr(:spriteset)
- end
- class Game_Map
- attr(:copy_map_events)
- def prepare_copy_event(event)
- @copy_map_events ||= {}
- @tile_events.push(event) if event.tile?
- @copy_map_events[event] = true
- end
- def prepare_remove_event(event)
- @copy_map_events ||= {}
- @tile_events.delete(event) if event.tile?
- @copy_map_events[event] = false
- end
- alias_method :copy_map_events_update_events, :update_events
- def update_events
- copy_map_events_update_events
- if @copy_map_events
- delete_ids = []
- in_map = SceneManager.scene_is?(Scene_Map)
- @copy_map_events.each {|event, copy|
- if copy
- @events[event.id] = event
- SceneManager.scene.spriteset.add_copy_event(event) if in_map
- else
- delete_ids.push(event.id)
- SceneManager.scene.spriteset.remove_copy_event(event) if in_map
- end
- }
- delete_ids.each {|id| @events.delete(id)}
- @copy_map_events = nil
- end
- end
- end
- class Game_Event
- attr(:copy_id, :map_id)
- attr_accessor :copy_self_switch
- def event_copy_setup(id, x, y)
- @copy_id = @id
- @id = id
- moveto(x, y) if x && y
- end
- def update #注意:方法覆盖
- super
- check_event_trigger_auto
- return unless @interpreter
- @interpreter.setup(@list, @id) unless @interpreter.running?
- @interpreter.update
- end
- def conditions_met?(page) #注意:方法覆盖
- c = page.condition
-
- if c.switch1_valid
- if c.switch1_id == 3
- return false unless $game_e[[@id,"found"]] == true
- else
- return false unless $game_switches[c.switch1_id]
- end
- end
- if c.switch2_valid
- if c.switch2_id == 3
- return false unless $game_e[[@id,"found"]] == true
- else
- return false unless $game_switches[c.switch2_id]
- end
- end
-
- if c.variable_valid
- return false if $game_variables[c.variable_id] < c.variable_value
- end
- if c.self_switch_valid
- return false unless @copy_self_switch ?
- @copy_self_switch[c.self_switch_ch] :
- $game_self_switches[[map_id, @id, c.self_switch_ch]]
- end
- if c.item_valid
- item = $data_items[c.item_id]
- return false unless $game_party.has_item?(item)
- end
- if c.actor_valid
- actor = $game_actors[c.actor_id]
- return false unless $game_party.members.include?(actor)
- end
- return true
- end
- end
复制代码
这个我试过,复制过来的事件,可以正常使用独立开关。 |
|