赞 | 0 |
VIP | 8 |
好人卡 | 0 |
积分 | 1 |
经验 | 5594 |
最后登录 | 2017-5-24 |
在线时间 | 244 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 244 小时
- 注册时间
- 2008-1-25
- 帖子
- 312
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
- #==============================================================================
- #地图图鉴系统,clavia版。
- #版本V1.1
- #效果如下:
- #*记录除去特指不记入图鉴的地图内所有工程中的地图。
- #*可查询收集到的地图所有可以遇到的敌人,并且按照数据库自动排序~
- #*用不同的颜色表示特殊敌人(默认红色为boss,浅蓝色为标记的特殊敌人(自作主张认为是稀有敌人啦~))
- #*图鉴中可以显示光标指着的地图的战斗背景(嗯~算是增强效果的设定吧,不过也花费了些功夫。)
- #使用方法:复制此脚本所有内容,右键单击脚本编辑器中的main,选插入,粘贴到空白的脚本页即可。
- #不记入图鉴的地图和是否显示背景在下面定义。
- #在数据库最后一页增加属性“BOSS”和“稀有”来实现敌人的特殊标记
- #BOSS属性有效度为A的敌人在图鉴中用红色表示
- #稀有属性有效度为A的敌人在图鉴中用浅蓝色表示
- #调用方法:$scene = Scene_mapbook.new
- #如果事件名称为"hidden",战斗处理中的敌人将不会显示在图鉴里。
- #冲突性:修改了Scene_Title,解释器中的场所移动,有一些了……
- #修改的地方还算比较“冷僻”,冲突可能不算很大吧,嗯嗯~~
- #版权嘛……
- #还是算了吧,脚本是方便大家使用的,能有更多人受益的话我也不追究了~
- #==============================================================================
- HIDDEN = [ ]#不计算在图鉴内的地图的id,不同id之间要用英文逗号隔开哦~(数组数组)
- BACK_EXIST = true#是否显示战斗背景
- #==============================================================================
- # ■ Game_System
- #------------------------------------------------------------------------------
- # 附加内容。
- #==============================================================================
- class Game_System
- attr_accessor :mapbook
- alias book3 initialize
- def initialize
- book3
- @mapbook = [ ]
- end
- def gain_map(val)
- $game_system.mapbook.push(val)
- end
- end
- #==============================================================================
- # ■ Game_Event
- #------------------------------------------------------------------------------
- # 处理事件的类。条件判断、事件页的切换、并行处理、执行事件功能
- # 在 Game_Map 类的内部使用。
- #==============================================================================
- class Game_Event < Game_Character
- #——————————————————————————————————————
- # 用来返回名称
- #——————————————————————————————————————
- def name
- return @event.name
- end
- def name=(newname)
- @event.name = newname
- end
- end
- #==============================================================================
- # ■ Interpreter
- #------------------------------------------------------------------------------
- # 附加内容。
- #==============================================================================
- class Interpreter
- #--------------------------------------------------------------------------
- # ● 场所移动
- #--------------------------------------------------------------------------
- def command_201
- # 战斗中的情况
- if $game_temp.in_battle
- # 继续
- return true
- end
- # 场所移动中、信息显示中、过渡处理中的情况下
- if $game_temp.player_transferring or
- $game_temp.message_window_showing or
- $game_temp.transition_processing
- # 结束
- return false
- end
- # 设置场所移动标志
- $game_temp.player_transferring = true
- # 指定方法为 [直接指定] 的情况下
- if @parameters[0] == 0
- # 设置主角的移动目标
- $game_temp.player_new_map_id = @parameters[1]
- $game_temp.player_new_x = @parameters[2]
- $game_temp.player_new_y = @parameters[3]
- $game_temp.player_new_direction = @parameters[4]
- $game_system.gain_map(@parameters[1]) if !$game_system.mapbook.include?(@parameters[1])#calvia
- # 指定方法为 [使用变量指定] 的情况下
- else
- # 设置主角的移动目标
- $game_temp.player_new_map_id = $game_variables[@parameters[1]]
- $game_temp.player_new_x = $game_variables[@parameters[2]]
- $game_temp.player_new_y = $game_variables[@parameters[3]]
- $game_temp.player_new_direction = @parameters[4]
- $game_system.gain_map($game_variables[@parameters[1]]) if !$game_system.mapbook.include?($game_variables[@parameters[1]])#calvia
- end
- # 推进索引
- @index += 1
- # 有淡入淡出的情况下
- if @parameters[5] == 0
- # 准备过渡
- Graphics.freeze
- # 设置过渡处理中标志
- $game_temp.transition_processing = true
- $game_temp.transition_name = ""
- end
- # 结束
- return false
- end
- end
- #==============================================================================
- # ■ Scene_Title
- #------------------------------------------------------------------------------
- # 附加内容。
- #==============================================================================
- class Scene_Title
- alias calvia_title_main main
- def main
- # 读取地图信息文件
- $data_mapinfos = load_data("Data/MapInfos.rxdata")
- calvia_title_main
- end
- #--------------------------------------------------------------------------
- # ● 命令 : 新游戏
- #--------------------------------------------------------------------------
- def command_new_game
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 停止 BGM
- Audio.bgm_stop
- # 重置测量游戏时间用的画面计数器
- Graphics.frame_count = 0
- # 生成各种游戏对像
- $game_temp = Game_Temp.new
- $game_system = Game_System.new
- $game_switches = Game_Switches.new
- $game_variables = Game_Variables.new
- $game_self_switches = Game_SelfSwitches.new
- $game_screen = Game_Screen.new
- $game_actors = Game_Actors.new
- $game_party = Game_Party.new
- $game_troop = Game_Troop.new
- $game_map = Game_Map.new
- $game_player = Game_Player.new
- # 设置初期同伴位置
- $game_party.setup_starting_members
- # 设置初期位置的地图
- $game_map.setup($data_system.start_map_id)
- $game_system.gain_map($data_system.start_map_id)#calvia
- # 主角向初期位置移动
- $game_player.moveto($data_system.start_x, $data_system.start_y)
- # 刷新主角
- $game_player.refresh
- # 执行地图设置的 BGM 与 BGS 的自动切换
- $game_map.autoplay
- # 刷新地图 (执行并行事件)
- $game_map.update
- # 切换地图画面
- $scene = Scene_Map.new
- end
- end
- #==============================================================================
- # ■ Window_Help
- #------------------------------------------------------------------------------
- # 特技及物品的说明、角色的状态显示的窗口。
- #==============================================================================
- class Window_maphelp < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 640, 64)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.back_opacity = 160
- self.contents.draw_text(4, 0,640 - 32, 32,"地点图鉴")
- end
- #--------------------------------------------------------------------------
- # ● 设置文本
- # text : 窗口显示的字符串
- # align : 对齐方式 (0..左对齐、1..中间对齐、2..右对齐)
- #--------------------------------------------------------------------------
- def set_text(text)
- # 如果文本和对齐方式的至少一方与上次的不同
- if text != @text
- # 再描绘文本
- self.contents.clear
- self.contents.font.color = normal_color
- self.contents.draw_text(4, 0,640 - 32, 32,"地图图鉴")
- self.contents.draw_text(480, 0,640 - 32, 32,"完成度")
- self.contents.draw_text(548, 0,48, 32,"#{text}",1)
- self.contents.draw_text(595, 0,640 - 32, 32,"%")
- @text = text
- self.visible = true
- end
- end
- end
- #==============================================================================
- # ■ Window_Skill
- #------------------------------------------------------------------------------
- # 特技画面、战斗画面、显示可以使用的特技浏览的窗口。
- #==============================================================================
- class Window_maplist < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # actor : 角色
- #--------------------------------------------------------------------------
- def initialize
- super(0,64, 280,416)
- self.back_opacity = 160
- @column_max = 1
- @have = $game_system.mapbook
- @hidden = HIDDEN
- refresh
- self.index = 0
- end
- #--------------------------------------------------------------------------
- # ● 获取特技
- #--------------------------------------------------------------------------
- def skill
- if @have.include?(@data[self.index])
- return @data[self.index]
- else
- return false
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @data = []
- for i in 1...$data_mapinfos.size + 1
- skill = $data_mapinfos[i].order
- if skill != nil and [email protected]?(skill)
- @data.push(skill)
- end
- end
- # 如果项目数不是 0 就生成位图、重新描绘全部项目
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 32)
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 描绘项目
- # index : 项目编号
- #--------------------------------------------------------------------------
- def draw_item(index)
- skill = @data[index]
- self.contents.font.color = normal_color
- #x = 4 + index * (288 + 32)
- y = index * 32
- rect = Rect.new(x, y, self.width / @column_max - 32, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- if @have.include?(skill)
- self.contents.draw_text(32, y, 204, 32, $data_mapinfos[skill].name, 0)
- else
- self.contents.draw_text(32, y, 204, 32,"- - - - - - - - -", 0)
- end
- end
- end
- #==============================================================================
- # ■ Window_Gold
- #------------------------------------------------------------------------------
- # 显示金钱的窗口。
- #==============================================================================
- class Window_mapmain < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化窗口
- #--------------------------------------------------------------------------
- def initialize
- super(280, 64, 360,416)
- self.back_opacity = 160
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.size = 16
- for i in 0...$data_system.elements.size
- if $data_system.elements[i] == "BOSS"
- @boss = i
- end
- if $data_system.elements[i] == "稀有"
- @xy = i
- end
- end
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- self.contents.font.color = normal_color
- self.contents.fill_rect(Rect.new(0,4,self.width,24), Color.new(0,51,255, 200))
- self.contents.draw_text(0,0,self.width- 32,32,"存在的魔物",1)
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def set_map(map)
- @map2 = map
- self.contents.clear
- self.contents.font.color = normal_color
- self.contents.fill_rect(Rect.new(0,4,self.width,24), Color.new(0,51,255, 200))
- self.contents.draw_text(0,0,self.width- 32,32,"存在的魔物",1)
- @a = 0
- @c = 0
- @b = []
- @d = []
- @map = load_data(sprintf("Data/Map%03d.rxdata",@map2))
- for i in @map.encounter_list
- for j in $data_troops[i].members
- @b.push(j.enemy_id)
- end
- end
- for i in [email protected]
- for j in @map.events[i].pages
- for l in j.list
- if l.code == 301 and @map.events[i].name != "hidden"
- for m in $data_troops[l.parameters[0]].members
- @b.push(m.enemy_id)
- end
- end
- end
- end
- end
- @b.uniq!
- @b.sort!
- for k in @b
- self.contents.font.color = normal_color
- if @boss != nil
- if $data_enemies[k].element_ranks[@boss] == 1
- self.contents.font.color = Color.new(255,51,0,255)
- end
- end
- if @xy != nil
- if $data_enemies[k].element_ranks[@xy] == 1
- self.contents.font.color = Color.new(0,238,255,255)
- end
- end
- self.contents.draw_text(@c * 164 + 8, @a*32 + 32,164 - 16,32,$data_enemies[k].name,1)
- @a += 1
- if @a > 10
- @c += 1
- @a = 0
- end
- end
- end
- end
- #==============================================================================
- # ■ Scene_handbook
- #------------------------------------------------------------------------------
- # 处理地名图鉴的类。
- #==============================================================================
- class Scene_mapbook
- def main
- @help_window = Window_maphelp.new
- @list_window = Window_maplist.new
- @main_window = Window_mapmain.new
- @back = Sprite.new
- if @list_window.skill != false
- @map = load_data(sprintf("Data/Map%03d.rxdata",@list_window.skill))
- @main_window.set_map(@list_window.skill)
- if BACK_EXIST == true and $data_tilesets[@map.tileset_id].battleback_name != ""
- @back.bitmap = Bitmap.new("Graphics/Battlebacks/#{$data_tilesets[@map.tileset_id].battleback_name}")
- @back.zoom_y = (480 / @back.bitmap.height.to_f)
- @back.x = 0
- @back.y = 0
- end
- end
- over = ((($game_system.mapbook - HIDDEN).size / ($data_mapinfos.size - HIDDEN.size).to_f)*100).round
- @help_window.set_text("#{over}")
- # 执行过渡
- Graphics.transition
- # 主循环
- loop do
- # 刷新游戏画面
- Graphics.update
- # 刷新输入信息
- Input.update
- # 刷新画面
- update
- # 如果画面切换的话就中断循环
- if $scene != self
- break
- end
- end
- Graphics.freeze
- @help_window.dispose
- @list_window.dispose
- @main_window.dispose
- @back.dispose
- end
- def update
- @help_window.update
- @list_window.update
- @main_window.update
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- $scene = Scene_Map.new
- end
- if @list_window.skill != false and (Input.press?(Input::UP) or Input.press?(Input::DOWN))
- @main_window.set_map(@list_window.skill)
- @map = load_data(sprintf("Data/Map%03d.rxdata",@list_window.skill))
- if BACK_EXIST == true and $data_tilesets[@map.tileset_id].battleback_name != ""
- @back.bitmap = Bitmap.new("Graphics/Battlebacks/#{$data_tilesets[@map.tileset_id].battleback_name}")
- @back.zoom_y = (480 / @back.bitmap.height.to_f)
- @back.x = 0
- @back.y = 0
- end
-
- if $data_tilesets[@map.tileset_id].battleback_name == ""
- @back.bitmap.clear if @back.bitmap != nil
- end
- elsif @list_window.skill == false and (Input.press?(Input::UP) or Input.press?(Input::DOWN))
- @main_window.refresh
- @back.bitmap.clear if @back.bitmap != nil
- @back.update if @back.is_a?(Sprite)
- end
- rescue Errno::ENOENT
- end
- end
- #==============================================================================
- #只是收尾哦
- #==============================================================================
复制代码
for j in @map.events.pages <====脚本提示出错
出的错为 未定义的方法pages
在哪里可以定义这东西,怎么写?
此贴于 2008-9-2 11:15:28 被版主darkten提醒,请楼主看到后对本贴做出回应。 |
|