赞 | 0 |
VIP | 77 |
好人卡 | 306 |
积分 | 1 |
经验 | 85662 |
最后登录 | 2023-11-23 |
在线时间 | 1782 小时 |
Lv1.梦旅人 虱子
- 梦石
- 0
- 星屑
- 121
- 在线时间
- 1782 小时
- 注册时间
- 2010-6-19
- 帖子
- 3597
|
本帖最后由 Wind2010 于 2011-5-13 12:07 编辑
求错误信息
LZ的脚本怎么这个奇怪...试试用这个- #==============================================================================
- # ☆★☆ 提取放置物脚本(强化) ☆★☆
- #------------------------------------------------------------------------------
- # - 美兽
- # - 2007.4.12
- #------------------------------------------------------------------------------
- # 爱护环境,人人有责,现实中切勿乱丢垃圾。
- #------------------------------------------------------------------------------
- #------------------------------------------------------------------------------
- # 脚本原理:
- # 是从仓库地图中提取事件,将其拷贝放入指定的位置,
- # 依此达成随时随地生成新事件的功能,如此可节省大量用RGSS编写事件所消耗的体力,很多地方写的
- # 很保守,尽量减少冲突几率。。
- # 此为强化版,可实现新事件的保存,但代价是冲突的随之增大,若只想单纯实现ARPG
- # 一类的物品掉落,场所移动后便清除,请使用简洁版。
- #------------------------------------------------------------------------------
- =begin
- Note:
-
- 一:生成物品主方法:
- Drop_Item.make_events(map_id,event_id,item_x,item_y,save=false)
- map_id : 仓库地图的ID。
- event_id : 仓库中对应事件的ID。
- item_x、item_y :新事件的X与Y坐标
- save : 是否存储标志;
- 默认为false,即不存储,场所移动等转换场景后事件会消失;
- true 为存储,取档、关机、登火星,返回后事件仍存在。
-
- 二:删除事件方法:
- 事件名若包含"delete"字段,则执行完毕会立即自我清除;
- 注:任何事件皆如此。
- 三:必掌握语句:
- $game_map.events[@event_id]
- $game_player
- 事件的脚本使用,表示“本事件”和“角色”,主要为取得事件的坐标,
- 取得“本事件”X与Y坐标:$game_map.events[@event_id].event.x
- $game_map.events[@event_id].event.y
- 取得“角色”X与Y坐标:$game_player.x
- $game_player.y
- 例如,在某事件左侧生成2号地图的2号事件并永久存储,写法如下。
- x = $game_map.events[@event_id].event.x
- y = $game_map.events[@event_id].event.y
- Drop_Item.make_events(2,2,x-1,y,true)
- 四:备注:
- 此脚本用法十分灵活,种植、建设、舍弃、掉宝等功能都可用以达成。
- =end
- #==============================================================================
- module Drop_Item
-
- def self.make_events(map_id,event_id,item_x,item_y,save=false)
- return unless self.is_map?
- map = self.map_data_load(map_id)
- temp = Marshal.load(Marshal.dump(map))
- if !$game_system.map_events_number
- $game_system.map_events_number = {}
- end
- sum = $game_system.map_events_number
- m_id = $game_map.map_id
- sum[m_id] == nil ? sum[m_id] = 2000 : sum[m_id] += 1
- new_event_id = sum[m_id]
- temp.events[event_id].id = new_event_id
- temp.events[event_id].x,temp.events[event_id].y = item_x,item_y
- $game_map.events[new_event_id] = Game_Event.new(m_id,temp.events[event_id])
- if save
- now_map = self.map_data_load(m_id)
- now_map.events[new_event_id] = temp.events[event_id]
- self.map_data_save(m_id,now_map)
- end
- refresh_map
- end
-
-
- def self.map_data_init
- for i in 1..999
- begin
- map = load_data(sprintf("Data/Map%03d.rxdata", i))
- rescue Errno::ENOENT
- next
- end
- $game_system.map_data[i] = Marshal.load(Marshal.dump(map))
- end
- end
-
- def self.map_data_save(map_id,event)
- $game_system.map_data[$game_map.map_id] = event
- end
- def self.map_data_load(map_id)
- if !$game_system.map_data
- $game_system.map_data = {}
- self.map_data_init
- end
- return $game_system.map_data[map_id]
- end
-
- def self.delete_events(event_id)
- return unless self.is_map?
- $game_map.events.delete(event_id)
- self.refresh_map
- end
-
- def self.refresh_map
- return unless self.is_map?
- $scene.spriteset.dispose
- $scene.spriteset = Spriteset_Map.new
- end
-
- def self.is_map?
- (return true) if $scene.is_a?(Scene_Map)
- return false
- end
- end
- class Game_Map
-
- def setup(map_id)
- @map_id = map_id
- #@map = load_data(sprintf("Data/Map%03d.rxdata", @map_id))
- @map = Drop_Item.map_data_load(@map_id)
- tileset = $data_tilesets[@map.tileset_id]
- @tileset_name = tileset.tileset_name
- @autotile_names = tileset.autotile_names
- @panorama_name = tileset.panorama_name
- @panorama_hue = tileset.panorama_hue
- @fog_name = tileset.fog_name
- @fog_hue = tileset.fog_hue
- @fog_opacity = tileset.fog_opacity
- @fog_blend_type = tileset.fog_blend_type
- @fog_zoom = tileset.fog_zoom
- @fog_sx = tileset.fog_sx
- @fog_sy = tileset.fog_sy
- @battleback_name = tileset.battleback_name
- @passages = tileset.passages
- @priorities = tileset.priorities
- @terrain_tags = tileset.terrain_tags
- @display_x = 0
- @display_y = 0
- @need_refresh = false
- @events = {}
- for i in @map.events.keys
- @events[i] = Game_Event.new(@map_id, @map.events[i])
- end
- @common_events = {}
- for i in 1...$data_common_events.size
- unless $data_common_events[i].trigger == 0
- @common_events[i] = Game_CommonEvent.new(i)
- end
- end
- @fog_ox = 0
- @fog_oy = 0
- @fog_tone = Tone.new(0, 0, 0, 0)
- @fog_tone_target = Tone.new(0, 0, 0, 0)
- @fog_tone_duration = 0
- @fog_opacity_duration = 0
- @fog_opacity_target = 0
- @scroll_direction = 2
- @scroll_rest = 0
- @scroll_speed = 4
- end
-
- end
- class Interpreter
-
- def command_end
- @list = nil
- if @main and @event_id > 0
- if $scene.is_a?(Scene_Map)
- # Drop_Item.delete_events(@event_id)
- # now_map = Drop_Item.map_data_load($game_map.map_id)
- # now_map.events.delete(@event_id)
- # Drop_Item.map_data_save($game_map.map_id,now_map)
- end
- end
- end
-
- end
- class Game_System
-
- attr_accessor :map_events_number
- attr_accessor :map_data
-
- end
- class Scene_Map
-
- attr_accessor :spriteset
-
- end
复制代码 |
|