赞 | 12 |
VIP | 107 |
好人卡 | 6 |
积分 | 4 |
经验 | 31122 |
最后登录 | 2024-6-29 |
在线时间 | 1606 小时 |
Lv2.观梦者 傻♂逼
- 梦石
- 0
- 星屑
- 374
- 在线时间
- 1606 小时
- 注册时间
- 2007-3-13
- 帖子
- 6562
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
没错,这个是ForVX的版本哦~~
嘿嘿,加入了事件编辑功能,对地图数据的储存进行了优化,而且可以兼容没添加这个脚本的版本游戏(比如补丁,{/gg})
冲突:
存档类
自动存档
----------------------
修改会自动保存
----------------------
功能
----------------------
copy_ev
把mapid1的id的事件拷贝到mapid的x,y的位置
----------------------
editbymap
editbymap(操作地图id,资源地图id,起始x,起始y,资源地图起始x,资源地图起始y,资源地图结束x,资源地图结束y)
----------------------
不再提供edit方法,由于VX中进行edit非常的麻烦。。。
0000000000000000000000
----------------------
万恶的代码
-----------------------
- #废弃代码
- module Map
- def self.new(w,h,id)
- $save_hash[id] = RPG::Map.new(w,h)
- return id
- end
- end
- #######################################################
- #注意,如果你想修改远景图什么的请使用$save_hash[地图id]
- $save_hash = {}
- #==============================================================================
- # ■ Game_Map
- #------------------------------------------------------------------------------
- # 处理地图的类。包含卷动以及可以通行的判断功能。本类的实例请参考 $game_map 。
- #==============================================================================
- class Game_Map
- #--------------------------------------------------------------------------
- # ● 定义实例变量
- #--------------------------------------------------------------------------
- attr_reader :screen # 地图画面状态
- attr_reader :interpreter # 地图事件解释器
- attr_reader :display_x # 画面 X 座标 * 256
- attr_reader :display_y # 画面 Y 座标 * 256
- attr_reader :parallax_name # 远景图文件名
- attr_reader :passages # 通行列表
- attr_accessor :events # 事件
- attr_reader :vehicles # 交通工具
- attr_accessor :need_refresh # 需要刷新标志
- attr_accessor :map
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- @screen = Game_Screen.new
- @interpreter = Game_Interpreter.new(0, true)
- @map_id = 0
- @display_x = 0
- @display_y = 0
- create_vehicles
- end
- #--------------------------------------------------------------------------
- # ● 设置
- # map_id : 地图 ID
- #--------------------------------------------------------------------------
- def setup(map_id)
- @map_id = map_id
- $save_hash[@map_id] = load_data(sprintf("Data/Map%03d.rvdata", @map_id)) if $save_hash[@map_id] == nil
- @map = $save_hash[@map_id]
- @display_x = 0
- @display_y = 0
- @passages = $data_system.passages
- referesh_vehicles
- setup_events
- setup_scroll
- setup_parallax
- @need_refresh = false
- end
- end
- #==============================================================================
- # ■ Scene_File
- #------------------------------------------------------------------------------
- # 存档画面及读档画面的类。
- #==============================================================================
- class Scene_File < Scene_Base
- #--------------------------------------------------------------------------
- # ● 写入存档数据
- # file : 写入存档对象(已开启)
- #--------------------------------------------------------------------------
- def write_save_data(file)
- characters = []
- for actor in $game_party.members
- characters.push([actor.character_name, actor.character_index])
- end
- $game_system.save_count += 1
- $game_system.version_id = $data_system.version_id
- @last_bgm = RPG::BGM::last
- @last_bgs = RPG::BGS::last
- Marshal.dump(characters, file)
- Marshal.dump(Graphics.frame_count, file)
- Marshal.dump(@last_bgm, file)
- Marshal.dump(@last_bgs, file)
- Marshal.dump($game_system, file)
- Marshal.dump($game_message, file)
- Marshal.dump($game_switches, file)
- Marshal.dump($game_variables, file)
- Marshal.dump($game_self_switches, file)
- Marshal.dump($game_actors, file)
- Marshal.dump($game_party, file)
- Marshal.dump($game_troop, file)
- Marshal.dump($game_map, file)
- Marshal.dump($game_player, file)
- #
- Marshal.dump($save_hash, file)
- #
- end
- #--------------------------------------------------------------------------
- # ● 读出存档数据
- # file : 读出存档对象(已开启)
- #--------------------------------------------------------------------------
- def read_save_data(file)
- characters = Marshal.load(file)
- Graphics.frame_count = Marshal.load(file)
- @last_bgm = Marshal.load(file)
- @last_bgs = Marshal.load(file)
- $game_system = Marshal.load(file)
- $game_message = Marshal.load(file)
- $game_switches = Marshal.load(file)
- $game_variables = Marshal.load(file)
- $game_self_switches = Marshal.load(file)
- $game_actors = Marshal.load(file)
- $game_party = Marshal.load(file)
- $game_troop = Marshal.load(file)
- $game_map = Marshal.load(file)
- $game_player = Marshal.load(file)
- begin
- $save_hash = Marshal.load(file)
- rescue
- $save_hash = {}
- end
- if $game_system.version_id != $data_system.version_id
- $game_map.setup($game_map.map_id)
- $game_player.center($game_player.x, $game_player.y)
- end
- end
- end
- #==============================================================================
- # ■ Scene_Map
- #------------------------------------------------------------------------------
- # 处理地图画面的类。
- #==============================================================================
- class Scene_Map < Scene_Base
- def refresh_spriteset
- @spriteset.dispose
- @spriteset = Spriteset_Map.new
- end
- end
- #
- #editbymap(操作地图id,资源地图id,起始x,起始y,资源地图起始x,资源地图起始y,资源地图结束x,资源地图结束y)
- #
- def editbymap(map_id,map_id1,x,y,x1,y1,x2,y2)
- $save_hash[map_id1] = load_data(sprintf("Data/Map%03d.rvdata", map_id1)) if $save_hash[map_id1] == nil
- ziyuan = $save_hash[map_id1]
- $save_hash[map_id] = load_data(sprintf("Data/Map%03d.rvdata", map_id)) if $save_hash[map_id] == nil
- yyy = y
- for zz in [0,1,2]
- for xx in x1..x2
- for yy in y1..y2
- $save_hash[map_id].data[x,y,zz] = ziyuan.data[xx,yy,zz]
- y = y +1
- end
- x = x + 1
- y = yyy
- end
- end
- end
- #
- #把mapid1的id的事件拷贝到mapid的x,y的位置
- #
- def copy_ev(map_id,x,y,map_id1,id)
- begin
- $save_hash[map_id1] = load_data(sprintf("Data/Map%03d.rvdata", map_id1)) if $save_hash[map_id1] == nil
- ziyuan = $save_hash[map_id1]
- $save_hash[map_id] = load_data(sprintf("Data/Map%03d.rvdata", map_id)) if $save_hash[map_id] == nil
- c = ziyuan.events[id].clone
- c.id = $save_hash[map_id].events.size+1
- c.x = x
- c.y = y
- $save_hash[map_id].events[c.id] = c
- if $game_map.map_id == map_id
- $game_map.events[c.id] = Game_Event.new(c.id, $game_map.map.events[c.id])
- $game_map.need_refresh = true
- $game_map.update
- if $scene.is_a?(Scene_Map)
- $scene.refresh_spriteset
- end
- end
- return true
- end
- return false
- end
复制代码 |
|