赞 | 93 |
VIP | 0 |
好人卡 | 13 |
积分 | 80 |
经验 | 53314 |
最后登录 | 2024-12-18 |
在线时间 | 1184 小时 |
Lv4.逐梦者
- 梦石
- 0
- 星屑
- 7986
- 在线时间
- 1184 小时
- 注册时间
- 2007-7-29
- 帖子
- 2055
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
29-3-2008 v0.02
- 修正物品显示小Bug一个,感谢雪流星提供
28-3-2008 v0.01
- 接受小柯的建议,改用上下切换图片与资料
- 因为站上有关Game_Enemy的脚本过多,以防冲突,更改备注方式
- 在敌人的备注里添加:[备注 n]
- n 为要显示的介绍内容
- 里面的备注简体繁体通用,英文也行,为note
- 在怪物列表里添加号数
- 如有任何不明白,请看范例
最近被我姐烦得装了RMVX,可却摆着不用,就顺便弄一个图鉴出来好了。
次脚本的主要目的是要让那些新手知道许多简单的脚本语句就可以完成一些大型脚本,
所以此次的界面与排版等完全没有经过深思,就只是乱排一通。
- #===========================================================================
- # 一、将想显示的属性设定好,是一个数组,最多六个
- # 二、设定不显示的怪物编号
- # 四、在数据库里设置备注成为怪物说明
- # 三、在事件上使用脚本:$Scene = Scene_EnemyDex.new 进入图鉴
- #===========================================================================
- $属性显示 = [9,10,11,12,13,14]
- $不显示的怪物 = []
- #---------------------------------------------------------------------------
- # 对Game_Party添加新的定义
- #---------------------------------------------------------------------------
- class Game_Party
- #-------------------------------------------------------------------------
- # 出示化实例变量
- #-------------------------------------------------------------------------
- attr_accessor :enemy_view
- #-------------------------------------------------------------------------
- # 初始化
- #-------------------------------------------------------------------------
- alias new_initialize initialize
- def initialize
- new_initialize
- @enemy_view = []
- for i in 1...$data_enemies.size
- @enemy_view[i] = 0
- end
- end
- #-------------------------------------------------------------------------
- # 打开图鉴
- #-------------------------------------------------------------------------
- def add_enemy_view(n)
- if n == "all"
- for i in 1...$data_enemies.size
- @enemy_view[i] += 1
- end
- else
- @enemy_view[n] += 1
- end
- end
- end
- #---------------------------------------------------------------------------
- # 新建图鉴窗口
- #---------------------------------------------------------------------------
- class Window_EnemyDex_Info < Window_Base
- #-------------------------------------------------------------------------
- # 初始化
- #-------------------------------------------------------------------------
- def initialize(id)
- super(0,56,544,360)
- @id = id
- @now_id = 0
- @element = $属性显示
- refresh
- end
- #-------------------------------------------------------------------------
- # 刷新
- #-------------------------------------------------------------------------
- def refresh
- if @now_id != @id
- self.contents.clear
- draw_enemy_name(@id)
- draw_enemy_hp(@id)
- draw_enemy_mp(@id)
- draw_enemy_atk(@id)
- draw_enemy_def(@id)
- draw_enemy_spi(@id)
- draw_enemy_agi(@id)
- draw_enemy_hit(@id)
- draw_enemy_eva(@id)
- draw_enemy_exp(@id)
- draw_enemy_gold(@id)
- draw_enemy_item1(@id)
- draw_enemy_item2(@id)
- draw_enemy_levitate(@id)
- draw_enemy_has_critical(@id)
- draw_enemy_element_ranks(@id)
- draw_enemy_action(@id)
- end
- @now_id = @id
- end
- #-------------------------------------------------------------------------
- # 名字
- #-------------------------------------------------------------------------
- def draw_enemy_name(id)
- self.contents.font.color = Color.new(255,255,0,255)
- self.contents.draw_text(0,0,160,24,$data_enemies[id].name)
- end
- #-------------------------------------------------------------------------
- # 生命
- #-------------------------------------------------------------------------
- def draw_enemy_hp(id)
- self.contents.font.color = system_color
- self.contents.draw_text(0,24,40,24,"HP")
- self.contents.font.color = normal_color
- self.contents.draw_text(40,24,80,24,$data_enemies[id].maxhp)
- end
- #-------------------------------------------------------------------------
- # 精神
- #-------------------------------------------------------------------------
- def draw_enemy_mp(id)
- self.contents.font.color = system_color
- self.contents.draw_text(0,48,40,24,"MP")
- self.contents.font.color = normal_color
- self.contents.draw_text(40,48,80,24,$data_enemies[id].maxmp)
- end
- #-------------------------------------------------------------------------
- # 图像
- #-------------------------------------------------------------------------
- def draw_enemy_picture(id)
- bitmap = Cache.battler($data_enemies[id].battler_name,$data_enemies[id].battler_hue)
- src_rect = Rect.new(0,0,bitmap.width,bitmap.height)
- self.contents.blt(((self.width-32)-bitmap.width)/2,((self.height-32)-bitmap.height)/2,bitmap,src_rect)
- end
- #-------------------------------------------------------------------------
- # 攻击
- #-------------------------------------------------------------------------
- def draw_enemy_atk(id)
- self.contents.font.color = Color.new(255,128,128,255)
- self.contents.draw_text(0,72,60,24,"攻击力")
- self.contents.font.color = normal_color
- self.contents.draw_text(80,72,80,24,$data_enemies[id].atk,2)
- end
- #-------------------------------------------------------------------------
- # 防御
- #-------------------------------------------------------------------------
- def draw_enemy_def(id)
- self.contents.font.color = Color.new(255,128,128,255)
- self.contents.draw_text(0,96,60,24,"防御力")
- self.contents.font.color = normal_color
- self.contents.draw_text(80,96,80,24,$data_enemies[id].def,2)
- end
- #-------------------------------------------------------------------------
- # 精神
- #-------------------------------------------------------------------------
- def draw_enemy_spi(id)
- self.contents.font.color = Color.new(255,128,128,255)
- self.contents.draw_text(0,120,60,24,"精神力")
- self.contents.font.color = normal_color
- self.contents.draw_text(80,120,80,24,$data_enemies[id].spi,2)
- end
- #-------------------------------------------------------------------------
- # 敏捷
- #-------------------------------------------------------------------------
- def draw_enemy_agi(id)
- self.contents.font.color = Color.new(255,128,128,255)
- self.contents.draw_text(0,144,60,24,"敏捷力")
- self.contents.font.color = normal_color
- self.contents.draw_text(80,144,80,24,$data_enemies[id].agi,2)
- end
- #-------------------------------------------------------------------------
- # 命中
- #-------------------------------------------------------------------------
- def draw_enemy_hit(id)
- self.contents.font.color = Color.new(255,128,255,255)
- self.contents.draw_text(0,168,60,24,"命中率")
- self.contents.font.color = normal_color
- self.contents.draw_text(80,168,80,24,$data_enemies[id].hit,2)
- end
- #-------------------------------------------------------------------------
- # 回避
- #-------------------------------------------------------------------------
- def draw_enemy_eva(id)
- self.contents.font.color = Color.new(255,128,255,255)
- self.contents.draw_text(0,192,60,24,"回避率")
- self.contents.font.color = normal_color
- self.contents.draw_text(80,192,80,24,$data_enemies[id].eva,2)
- end
- #-------------------------------------------------------------------------
- # 经验
- #-------------------------------------------------------------------------
- def draw_enemy_exp(id)
- self.contents.font.color = Color.new(240,255,130,255)
- self.contents.draw_text(0,216,60,24,"经验值")
- self.contents.font.color = normal_color
- self.contents.draw_text(80,216,80,24,$data_enemies[id].exp,2)
- end
- #-------------------------------------------------------------------------
- # 金钱
- #-------------------------------------------------------------------------
- def draw_enemy_gold(id)
- self.contents.font.color = Color.new(240,255,130,255)
- self.contents.draw_text(0,240,60,24,"金钱")
- self.contents.font.color = normal_color
- self.contents.draw_text(80,240,80,24,$data_enemies[id].gold,2)
- end
- #-------------------------------------------------------------------------
- # 物品1
- #-------------------------------------------------------------------------
- def draw_enemy_item1(id)
- self.contents.font.color = Color.new(128,255,128,255)
- self.contents.draw_text(0,264,60,24,"物品一")
- self.contents.font.color = normal_color
- case $data_enemies[id].drop_item1.kind
- when 0
- self.contents.draw_text(80,264,80,24,"无",2)
- when 1
- self.contents.draw_text(80,264,80,24,$data_items[$data_enemies[id].drop_item1.item_id].name,2)
- when 2
- self.contents.draw_text(80,264,80,24,$data_weapons[$data_enemies[id].drop_item1.weapon_id].name,2)
- when 3
- self.contents.draw_text(80,264,80,24,$data_armors[$data_enemies[id].drop_item1.armor_id].name,2)
- end
- end
- #-------------------------------------------------------------------------
- # 物品2
- #-------------------------------------------------------------------------
- def draw_enemy_item2(id)
- self.contents.font.color = Color.new(128,255,128,255)
- self.contents.draw_text(0,288,60,24,"物品二")
- self.contents.font.color = normal_color
- case $data_enemies[id].drop_item2.kind
- when 0
- self.contents.draw_text(80,288,80,24,"无",2)
- when 1
- self.contents.draw_text(80,288,80,24,$data_items[$data_enemies[id].drop_item2.item_id].name,2)
- when 2
- self.contents.draw_text(80,288,80,24,$data_weapons[$data_enemies[id].drop_item2.weapon_id].name,2)
- when 3
- self.contents.draw_text(80,288,80,24,$data_armors[$data_enemies[id].drop_item2.armor_id].name,2)
- end
- end
- #-------------------------------------------------------------------------
- # 空中
- #-------------------------------------------------------------------------
- def draw_enemy_levitate(id)
- self.contents.font.color = $data_enemies[id].levitate == true ? Color.new(255,255,0,255) : Color.new(150,150,150,255)
- self.contents.draw_text(200,264,160,24,"配置在空中")
- end
- #-------------------------------------------------------------------------
- # 重击
- #-------------------------------------------------------------------------
- def draw_enemy_has_critical(id)
- self.contents.font.color = $data_enemies[id].has_critical == true ? Color.new(255,255,0,255) : Color.new(150,150,150,255)
- self.contents.draw_text(200,288,160,24,"有会心一击")
- end
- #-------------------------------------------------------------------------
- # 属性
- #-------------------------------------------------------------------------
- def draw_enemy_element_ranks(id)
- self.contents.font.color = Color.new(255,180,255,255)
- self.contents.draw_text(380,0,60,24,"属性")
- self.contents.font.color = normal_color
- x = 0
- for i in @element
- self.contents.draw_text(380,x*48+24,80,24,$data_system.elements[i])
- case $data_enemies[id].element_ranks[i]
- when 1
- percent = "200%"
- width = 100
- c1 = Color.new(255,255,64,255)
- c2 = Color.new(255,128,128,255)
- when 2
- percent = "150%"
- width = 75
- c1 = Color.new(255,255,64,255)
- c2 = Color.new(255,128,128,255)
- when 3
- percent = "100%"
- width = 50
- c1 = Color.new(255,255,64,255)
- c2 = Color.new(128,255,128,255)
- when 4
- percent = "50%"
- width = 25
- c1 = Color.new(255,128,128,255)
- c2 = Color.new(255,255,64,255)
- when 5
- percent = "0%"
- width = 0
- c1 = Color.new(255,128,128,255)
- c2 = Color.new(255,255,64,255)
- when 6
- percent = "-100%"
- width = 100
- c1 = Color.new(255,128,255,255)
- c2 = Color.new(128,255,128,255)
- end
- a = 380
- b = 6
- for i in 0...12
- self.contents.fill_rect(a,x*48+48+b,100,1,Color.new(0,0,0,200))
- a += 0.5
- b += 1
- end
- self.contents.gradient_fill_rect(380,x*48+48+6,width,1,c1,c2)
- self.contents.gradient_fill_rect(380.5,x*48+48+7,width,1,c1,c2)
- self.contents.gradient_fill_rect(381,x*48+48+8,width,1,c1,c2)
- self.contents.gradient_fill_rect(381.5,x*48+48+9,width,1,c1,c2)
- self.contents.gradient_fill_rect(382,x*48+48+10,width,1,c1,c2)
- self.contents.gradient_fill_rect(382.5,x*48+48+11,width,1,c1,c2)
- self.contents.gradient_fill_rect(383,x*48+48+12,width,1,c1,c2)
- self.contents.gradient_fill_rect(383.5,x*48+48+13,width,1,c1,c2)
- self.contents.gradient_fill_rect(384,x*48+48+14,width,1,c1,c2)
- self.contents.gradient_fill_rect(384.5,x*48+48+15,width,1,c1,c2)
- self.contents.gradient_fill_rect(385,x*48+48+16,width,1,c1,c2)
- self.contents.gradient_fill_rect(385.5,x*48+48+17,width,1,c1,c2)
- self.contents.draw_text(380,x*48+40,100,24,percent,2)
- x += 1
- break if x >= 6
- end
- end
- #-------------------------------------------------------------------------
- # 行动
- #-------------------------------------------------------------------------
- def draw_enemy_action(id)
- self.contents.font.color = Color.new(0,255,255,255)
- self.contents.draw_text(200,0,60,24,"行动")
- self.contents.font.color = normal_color
- x = 1
- for action in $data_enemies[id].actions
- if action.kind == 0
- case action.basic
- when 0
- self.contents.draw_text(200,x*24,160,24,"#{x}. "+"攻击")
- when 1
- self.contents.draw_text(200,x*24,160,24,"#{x}. "+"防御")
- when 2
- self.contents.draw_text(200,x*24,160,24,"#{x}. "+"逃跑")
- when 3
- self.contents.draw_text(200,x*24,160,24,"#{x}. "+"待机")
- end
- else
- self.contents.draw_text(200,x*24,160,24,"#{x}. "+$data_skills[action.skill_id].name)
- end
- x += 1
- break if x >= 11
- end
- end
- end
- #---------------------------------------------------------------------------
- # 新建图鉴窗口
- #---------------------------------------------------------------------------
- class Window_EnemyDex_Intro < Window_Base
- #-------------------------------------------------------------------------
- # 初始化
- #-------------------------------------------------------------------------
- def initialize(id)
- super(0,56,544,360)
- @id = id
- @now_id = 0
- refresh
- end
- #-------------------------------------------------------------------------
- # 刷新
- #-------------------------------------------------------------------------
- def refresh
- if @now_id != @id
- self.contents.clear
- draw_enemy_picture(@id)
- end
- @now_id = @id
- end
- #-------------------------------------------------------------------------
- # 图像
- #-------------------------------------------------------------------------
- def draw_enemy_picture(id)
- bitmap = Cache.battler($data_enemies[id].battler_name,$data_enemies[id].battler_hue)
- src_rect = Rect.new(0,0,bitmap.width,bitmap.height)
- self.contents.blt(((self.width-32)-bitmap.width)/2,((self.height-32)-bitmap.height)/2,bitmap,src_rect)
- end
- end
- #---------------------------------------------------------------------------
- # 选择窗口
- #---------------------------------------------------------------------------
- class Window_EnemyDex < Window_Selectable
- #-------------------------------------------------------------------------
- # 初始化
- #-------------------------------------------------------------------------
- def initialize
- super(0,56,544,360)
- @column_max = 2
- self.index = 0
- refresh
- end
- #-------------------------------------------------------------------------
- # 获取敌人
- #-------------------------------------------------------------------------
- def enemy
- return @data[self.index]
- end
- #-------------------------------------------------------------------------
- # 刷新
- #-------------------------------------------------------------------------
- def refresh
- @data = []
- for i in 1...$data_enemies.size
- if !$不显示的怪物.include?(i)
- @data.push($data_enemies[i])
- end
- end
- @item_max = @data.size
- create_contents
- for i in 0...@item_max
- draw_item(i)
- end
- end
- #-------------------------------------------------------------------------
- # 显示
- #-------------------------------------------------------------------------
- def draw_item(index)
- rect = item_rect(index)
- self.contents.clear_rect(rect)
- enemy = @data[index]
- if $game_party.enemy_view[enemy.id] > 0
- rect.width -= 4
- self.contents.draw_text(rect.x+4,rect.y,(self.width-32)/2,24,"#{index+1}. " + enemy.name)
- else
- rect.width -= 4
- self.contents.draw_text(rect.x+4,rect.y,(self.width-32)/2,24,"----------------")
- end
- end
- #-------------------------------------------------------------------------
- # 帮助
- #-------------------------------------------------------------------------
- def update_help
- view = $game_party.enemy_view[enemy.id]
- @help_window.set_text(view > 0 ? "编号 #{enemy.id}" : "----------------")
- end
- end
- #---------------------------------------------------------------------------
- # 图鉴
- #---------------------------------------------------------------------------
- class Scene_EnemyDex < Scene_Base
- #-------------------------------------------------------------------------
- # 处理
- #-------------------------------------------------------------------------
- def start
- create_menu_background
- @help_window = Window_Help.new
- @enemydex_window = Window_EnemyDex.new
- @enemydex_window.help_window = @help_window
- @enemydex_window.active = true
- @enemydex_info_window = Window_EnemyDex_Info.new(@enemydex_window.enemy.id)
- @enemydex_info_window.visible = false
- @enemydex_intro_window = Window_EnemyDex_Intro.new(@enemydex_window.enemy.id)
- @enemydex_intro_window.visible = false
- end
- #--------------------------------------------------------------------------
- # ● 结束处理
- #--------------------------------------------------------------------------
- def terminate
- super
- dispose_menu_background
- @help_window.dispose
- @enemydex_window.dispose
- @enemydex_info_window.dispose
- @enemydex_intro_window.dispose
- end
- #--------------------------------------------------------------------------
- # ● 更新画面
- #--------------------------------------------------------------------------
- def update
- super
- update_menu_background
- @help_window.update
- @enemydex_window.update
- @enemydex_info_window.update
- @enemydex_intro_window.update
- return select_enemy if @enemydex_window.active
- return in_info if @enemydex_info_window.visible
- return in_intro if @enemydex_intro_window.visible
- end
- #--------------------------------------------------------------------------
- # 选择敌人
- #--------------------------------------------------------------------------
- def select_enemy
- if Input.trigger?(Input::B)
- Sound.play_cancel
- $scene = Scene_Map.new
- end
- if Input.trigger?(Input::C)
- if $game_party.enemy_view[@enemydex_window.enemy.id] > 0
- Sound.play_decision
- @enemydex_window.active = false
- @enemydex_window.visible = false
- @enemydex_intro_window = Window_EnemyDex_Intro.new(@enemydex_window.enemy.id)
- @enemydex_intro_window.visible = true
- else
- Sound.play_buzzer
- end
- end
- end
- #--------------------------------------------------------------------------
- # 详情察看
- #--------------------------------------------------------------------------
- def in_info
- view = $game_party.enemy_view[@enemydex_window.enemy.id]
- @help_window.set_text("发现数:#{view}")
- if Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN)
- @enemydex_window.visible = false
- @enemydex_intro_window = Window_EnemyDex_Intro.new(@enemydex_window.enemy.id)
- @enemydex_intro_window.visible = true
- @enemydex_info_window.visible = false
- end
- if Input.trigger?(Input::B) or Input.trigger?(Input::C)
- Sound.play_cancel
- @enemydex_window.visible = true
- @enemydex_window.active = true
- @enemydex_info_window.visible = false
- @help_window.set_text(view > 0 ? "编号 #{@enemydex_window.enemy.id}" : "----------------")
- end
- end
- #--------------------------------------------------------------------------
- # 详情察看
- #--------------------------------------------------------------------------
- def in_intro
- @b = ""
- text = @enemydex_window.enemy.note.dup
- text.split(/[\r\n]+/).each { |line|
- if line =~ /\[(note|备注|備註) \w+\]/
- a = line.split(/ /)[1]
- while ((c = a.slice!(/./m)) != nil)
- @b += c if c != "]"
- end
- end;}
- @b = @b != "" ? @b : "资料不详"
- @help_window.set_text(@b)
- if Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN)
- @enemydex_window.visible = false
- @enemydex_info_window = Window_EnemyDex_Info.new(@enemydex_window.enemy.id)
- @enemydex_info_window.visible = true
- @enemydex_intro_window.visible = false
- end
- if Input.trigger?(Input::B) or Input.trigger?(Input::C)
- Sound.play_cancel
- @enemydex_window.visible = true
- @enemydex_window.active = true
- @enemydex_intro_window.visible = false
- view = $game_party.enemy_view[@enemydex_window.enemy.id]
- @help_window.set_text(view > 0 ? "编号 #{@enemydex_window.enemy.id}" : "----------------")
- end
- end
- end
- #----------------------------------------------------------------------------
- # 追加定义
- #----------------------------------------------------------------------------
- class Scene_Battle
- alias new_battle_end battle_end
- def battle_end(result)
- if result == 0
- for enemy in $game_troop.members
- $game_party.add_enemy_view(enemy.enemy_id)
- end
- end
- new_battle_end(result)
- end
- end
复制代码
v0.00 范例下载:Project 02 - EnemyDex v0.00.rar
v0.01 范例下载:Project 02 - EnemyDex v0.01.rar
v0.02 范例下载:Project 02 - EnemyDex v0.02.rar
|
|