设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1410|回复: 2
打印 上一主题 下一主题

[已经解决] 关于图鉴问题…总是报错求解

[复制链接]

Lv1.梦旅人

梦石
0
星屑
153
在线时间
90 小时
注册时间
2011-5-4
帖子
39
跳转到指定楼层
1
发表于 2013-9-19 10:52:47 | 只看该作者 |只看大图 回帖奖励 |正序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
本帖最后由 myownroc 于 2013-9-19 10:58 编辑
  1. #================================================================
  2. # 本脚本来自[url]http://www.66rpg.com/[/url],使用和转载请保留此信息
  3. #===================================================================
  4. #——————————————————————————————————————
  5. #魔物图鉴+介绍
  6. #
  7. #战斗终了时自动添加敌人进入图鉴(class Scene_Battle start_phase5 追加。
  8. #目前与各种战斗系统没有发现冲突)
  9. #不想加入图鉴的怪物设置其“不加入图鉴”属性有效度为A即可
  10. #图鉴完成度的表示功能追加
  11. #SHOW_COMPLETE_TYPE 的数值可以设定
  12. #当为1,显示现有个数/总数,当为2,显示完成百分比,当为3,全显示。
  13. #使用方法:$scene = Scene_MonsterBook.new
  14. #数据库中属性里面那些种族特效的位置,建议把默认的“对 不死”之类改成“不死”,
  15. #不然显示会很奇怪
  16. #由于雷达图的设计问题,只支持8项属性
  17. #默认种族特效处理属性中编号9到编号16,
  18. #如果你做了修改请自行改动380行左右的for i in 9..16这一句代码
  19. #显示各种信息位于630行左右,想不显示的话只要删除相应语句
  20. CHARA_INFO=[]#怪物的介绍,对应怪物id,空格为换行,
  21. #同时也会自动换行,没有写介绍的怪物会自动显示“无详细信息”
  22. #没有信息测试,怪物
  23. #=============
  24. #雷达图相关处理部分
  25. #=============
  26. class Bitmap
  27. def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
  28. distance = (start_x - end_x).abs + (start_y - end_y).abs
  29. if end_color == start_color
  30. for i in 1..distance
  31. x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  32. y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  33. if width == 1
  34. self.set_pixel(x, y, start_color)
  35. else
  36. self.fill_rect(x, y, width, width, start_color)
  37. end
  38. end
  39. else
  40. for i in 1..distance
  41. x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  42. y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  43. r = start_color.red * (distance-i)/distance + end_color.red * i/distance
  44. g = start_color.green * (distance-i)/distance + end_color.green * i/distance
  45. b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance
  46. a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
  47. if width == 1
  48. self.set_pixel(x, y, Color.new(r, g, b, a))
  49. else
  50. self.fill_rect(x, y, width, width, Color.new(r, g, b, a))
  51. end
  52. end
  53. end
  54. end
  55. end
  56. #=============
  57. # Graphic_Def_Elem
  58. #=============
  59. class Window_Base
  60. FONT_SIZE = 18
  61. WORD_ELEMENT_GUARD = "属性有效度"
  62. NUMBER_OF_ELEMENTS = 8
  63. ELEMENT_ORDER = [1,3,10,5,2,12,7,6]
  64. GRAPH_SCALINE_COLOR = Color.new(255, 255, 255, 128)
  65. GRAPH_SCALINE_COLOR_SHADOW = Color.new( 0, 0, 0, 192)
  66. GRAPH_LINE_COLOR = Color.new(255, 255, 64, 255)
  67. GRAPH_LINE_COLOR_MINUS = Color.new( 64, 255, 255, 255)
  68. GRAPH_LINE_COLOR_PLUS = Color.new(255, 64, 64, 255)
  69. end
  70. #——————————————————————————————————————
  71. module Enemy_Book_Config
  72. DROP_ITEM_NEED_ANALYZE = true #显示物品
  73. # EVA_NAME = "回避修正"              #回避修正的名称(因为数据库中没有定义)
  74. SHOW_COMPLETE_TYPE = 3         #图鉴完成率表示方法
  75. end
  76. class Data_MonsterBook
  77. #--------------------------------------------------------------------------
  78. # ● 图鉴用ID設定
  79. #--------------------------------------------------------------------------
  80. def enemy_book_id_set
  81.    data = [0]
  82.    data[1] = 2
  83.    data[2] = 1
  84.    data[3] = 15
  85.    data[4] = 25
  86.    data[5] = 18
  87.    data[6] = 30
  88.    return data
  89. end
  90. end
  91. class Game_Temp
  92. attr_accessor :enemy_book_data
  93. alias temp_enemy_book_data_initialize initialize
  94. def initialize
  95.    temp_enemy_book_data_initialize
  96.    @enemy_book_data = Data_MonsterBook.new
  97. end
  98. end
  99. class Game_Party
  100. #==============================================
  101. #--------------------------------------------------------------------------
  102.   # ● 公開インスタンス変数
  103.   #--------------------------------------------------------------------------
  104.   attr_reader   :actors                   # アクター
  105.   attr_reader   :gold                     # ゴールド
  106.   attr_reader   :steps                    # 歩数
  107.   attr_accessor :mission                  # 任务★★★★★★★★★★★★★
  108.   attr_accessor   :pr                  # 当前章节数★★★★★★★★★★★★★
  109.   attr_reader   :prname
  110.   #--------------------------------------------------------------------------
  111.   # ● オブジェクト初期化
  112.   #--------------------------------------------------------------------------
  113.   def initialize
  114.     # アクターの配列を作成
  115.     @actors = []
  116.     # ゴールドと歩数を初期化
  117.     [url=home.php?mod=space&uid=236945]@gold[/url] = 0
  118.     @steps = 0
  119.     # アイテム、武器、防具の所持数ハッシュを作成
  120.     @items = {}
  121.     @weapons = {}
  122.     @armors = {}
  123.   end
  124. #==============================================
  125. attr_accessor :enemy_info               # 出会った敵情報(図鑑用)
  126. #--------------------------------------------------------------------------
  127. # ● オブジェクト初期化
  128. #--------------------------------------------------------------------------
  129. alias book_info_initialize initialize
  130. def initialize
  131.    book_info_initialize
  132.    @enemy_info = {}
  133. end
  134. #--------------------------------------------------------------------------
  135. # ● エネミー情報の追加(図鑑用)
  136. #     type : 通常遭遇かアナライズか 0:通常 1:アナライズ -1:情報削除
  137. #     0:無遭遇 1:遭遇済 2:アナライズ済
  138. #--------------------------------------------------------------------------
  139. def add_enemy_info(enemy_id, type = 0)
  140.    case type
  141.    when 0
  142.      if @enemy_info[enemy_id] == 2
  143.        return false
  144.      end
  145.      @enemy_info[enemy_id] = 1
  146.    when 1
  147.      @enemy_info[enemy_id] = 2
  148.    when -1
  149.      @enemy_info[enemy_id] = 0
  150.    end
  151. end
  152. #--------------------------------------------------------------------------
  153. # ● 魔物図鑑の最大登録数を取得
  154. #--------------------------------------------------------------------------
  155. def enemy_book_max
  156.    return $game_temp.enemy_book_data.id_data.size - 1
  157. end
  158. #--------------------------------------------------------------------------
  159. # ● 魔物図鑑の現在登録数を取得
  160. #--------------------------------------------------------------------------
  161. def enemy_book_now
  162.    now_enemy_info = @enemy_info.keys
  163.    # 登録無視の属性IDを取得
  164.    no_add = $game_temp.enemy_book_data.no_add_element
  165.    new_enemy_info = []
  166.    for i in now_enemy_info
  167.      enemy = $data_enemies[i]
  168.      next if enemy.name == ""
  169.      if enemy.element_ranks[no_add] == 1
  170.        next
  171.      end
  172.      new_enemy_info.push(enemy.id)
  173.    end
  174.    return new_enemy_info.size
  175. end
  176. #--------------------------------------------------------------------------
  177. # ● 魔物図鑑の完成率を取得
  178. #--------------------------------------------------------------------------
  179. def enemy_book_complete_percentage
  180.    e_max = enemy_book_max.to_f
  181.    e_now = enemy_book_now.to_f
  182.    comp = e_now / e_max * 100
  183.    return comp.truncate
  184. end
  185. end
  186. class Interpreter
  187. def enemy_book_max
  188.    return $game_party.enemy_book_max
  189. end
  190. def enemy_book_now
  191.    return $game_party.enemy_book_now
  192. end
  193. def enemy_book_comp
  194.    return $game_party.enemy_book_complete_percentage
  195. end
  196. end
  197. class Scene_Battle
  198. alias add_enemy_info_start_phase5 start_phase5
  199. def start_phase5
  200.    for enemy in $game_troop.enemies
  201.      # エネミーが隠れ状態でない場合
  202.      unless enemy.hidden
  203.        # 敵遭遇情報追加
  204.        $game_party.add_enemy_info(enemy.id, 0)
  205.      end
  206.    end
  207.    add_enemy_info_start_phase5
  208. end
  209. end
  210. class Window_Base < Window
  211. #--------------------------------------------------------------------------
  212. # ● エネミーの戦闘後獲得アイテムの描画
  213. #--------------------------------------------------------------------------
  214. def draw_enemy_drop_item(enemy, x, y)
  215.    self.contents.font.color = normal_color
  216.    treasures = []
  217.    if enemy.item_id > 0
  218.      treasures.push($data_items[enemy.item_id])
  219.    end
  220.    if enemy.weapon_id > 0
  221.      treasures.push($data_weapons[enemy.weapon_id])
  222.    end
  223.    if enemy.armor_id > 0
  224.      treasures.push($data_armors[enemy.armor_id])
  225.    end
  226.    # 現状ではとりあえず1つのみ描画
  227.    if treasures.size > 0
  228.      item = treasures[0]
  229.      bitmap = RPG::Cache.icon(item.icon_name)
  230.      opacity = 255
  231.      self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  232.      name = treasures[0].name
  233.    else
  234.      self.contents.font.color = disabled_color
  235.      name = "无"
  236.    end
  237.    self.contents.draw_text(x+28, y, 212, 32, name)
  238. end
  239. #--------------------------------------------------------------------------
  240. # ● エネミーの図鑑IDの描画
  241. #--------------------------------------------------------------------------
  242. def draw_enemy_book_id(enemy, x, y)
  243.    self.contents.font.color = normal_color
  244.    id = $game_temp.enemy_book_data.id_data.index(enemy.id)
  245.    self.contents.draw_text(x, y, 32, 32, id.to_s)
  246. end
  247. #--------------------------------------------------------------------------
  248. # ● 敌人简介描绘
  249. #--------------------------------------------------------------------------
  250. def draw_enemy_other(enemy, x, y)
  251.    if CHARA_INFO[enemy.id]==nil
  252.     CHARA_INFO[enemy.id] = "没有相关资料"
  253.   end
  254.    self.contents.font.size=16
  255.    x+=self.contents.text_size("").width
  256.    info = CHARA_INFO[enemy.id]
  257.    #s=info.scan(/./)
  258.     #一行显示21个字
  259.     #for i in s
  260. #      sss = self.contents.text_size(i)
  261.       
  262. #      if  i==" "
  263.     #    y+=16
  264.     #    x=0
  265.      # elsif (x+sss.width)>(width - 32-260)
  266.        # y+=16
  267.        # x=0
  268.        # self.contents.draw_text(x, y, sss.width, sss.height, i)
  269.      #   x+=sss.width
  270.      # else
  271.      # self.contents.draw_text(x, y, sss.width, sss.height, i)
  272.      # x+=sss.width
  273.       end
  274.     end
  275. #  end
  276.    #--------------------------------------------------------------------------
  277. # ● 敌人特技描绘
  278. #--------------------------------------------------------------------------
  279. def draw_enemy_action(enemy, x, y)
  280.    self.contents.font.size=18
  281.    x = 360
  282.    y = 150
  283.    yy=y
  284.    self.contents.font.color = system_color
  285.    self.contents.draw_text(x, yy, 100, 24,"行动列表")
  286.    self.contents.font.color = normal_color
  287.    for action in enemy.actions
  288.      yy+=24
  289.      if action.kind==0
  290.        case action.basic
  291.         when 0
  292.           ac="攻击"
  293.         when 1
  294.           ac="防御"
  295.         when 2
  296.           ac="逃跑"
  297.         when 3
  298.           ac="不行动"
  299.         end
  300.      self.contents.draw_text(x, yy, 160, 24, ac )
  301.      end
  302.      if action.kind==1
  303.      self.contents.draw_text(x, yy, 160, 24, $data_skills[action.skill_id].name )
  304.      end
  305.    end
  306. end
  307. #雷达图描绘
  308.   #===================================================================
  309. #  def draw_actor_element_radar_graph(actor, x, y)
  310. #    radius = 56
  311. #cx = x + radius + FONT_SIZE + 48
  312. #cy = y + radius + FONT_SIZE + 32
  313. #self.contents.font.color = system_color
  314. #self.contents.draw_text(x, y, 104, 32, WORD_ELEMENT_GUARD)
  315. #for loop_i in 0..NUMBER_OF_ELEMENTS
  316. #if loop_i == 0
  317. #else
  318. #@pre_x = @now_x
  319. #@pre_y = @now_y
  320. #@pre_ex = @now_ex
  321. #@pre_ey = @now_ey
  322. #@color1 = @color2
  323. #end
  324. #if loop_i == NUMBER_OF_ELEMENTS
  325. #eo = ELEMENT_ORDER[0]
  326. #else
  327. #eo = ELEMENT_ORDER[loop_i]
  328. #end
  329. #er = actor.element_rate(eo)
  330. #estr = $data_system.elements[eo]
  331. #@color2 = er < 0 ? GRAPH_LINE_COLOR_MINUS : er > 100 ? GRAPH_LINE_COLOR_PLUS : GRAPH_LINE_COLOR
  332. #if er <0
  333. #  then xsh=true
  334. #else xsh=false
  335. #end
  336. #er = er.abs
  337. #th = Math::PI * (0.5 - 2.0 * loop_i / NUMBER_OF_ELEMENTS)
  338. #@now_x = cx + (radius * Math.cos(th)).floor
  339. #@now_y = cy - (radius * Math.sin(th)).floor
  340. #@now_wx = cx + ((radius+FONT_SIZE*2/2) * Math.cos(th)).floor - FONT_SIZE
  341. #@now_wy = cy - ((radius+FONT_SIZE*1/2) * Math.sin(th)).floor - FONT_SIZE/2
  342. #@now_vx = cx + ((radius+FONT_SIZE*6/2) * Math.cos(th)).floor - FONT_SIZE
  343. #@now_vy = cy - ((radius+FONT_SIZE*3/2) * Math.sin(th)).floor - FONT_SIZE/2
  344. #@now_ex = cx + (er*radius/100 * Math.cos(th)).floor
  345. #@now_ey = cy - (er*radius/100 * Math.sin(th)).floor
  346. #if loop_i == 0
  347. #@pre_x = @now_x
  348. #@pre_y = @now_y
  349. #@pre_ex = @now_ex
  350. #@pre_ey = @now_ey
  351. #@color1 = @color2
  352. #else
  353. #end
  354. #next if loop_i == 0
  355. #self.contents.draw_line(cx+1,cy+1, @now_x+1,@now_y+1, GRAPH_SCALINE_COLOR_SHADOW)
  356. #self.contents.draw_line(@pre_x+1,@pre_y+1, @now_x+1,@now_y+1, GRAPH_SCALINE_COLOR_SHADOW)
  357. #self.contents.draw_line(cx,cy, @now_x,@now_y, GRAPH_SCALINE_COLOR)
  358. #self.contents.draw_line(@pre_x,@pre_y, @now_x,@now_y, GRAPH_SCALINE_COLOR)
  359. #self.contents.draw_line(@pre_ex,@pre_ey, @now_ex,@now_ey, @color1, 2, @color2)
  360. #self.contents.font.size = FONT_SIZE
  361. #if xsh == true
  362. #  then self.contents.font.color = Color.new(100,255,128,128)
  363. #  sdd="-"
  364. #else self.contents.font.color = system_color
  365. #  sdd=""
  366. #end
  367. #self.contents.draw_text(@now_wx,@now_wy, FONT_SIZE*2, FONT_SIZE, estr, 1)
  368. #self.contents.font.color = Color.new(255,255,255,128)
  369. #self.contents.draw_text(@now_vx,@now_vy, FONT_SIZE*2, FONT_SIZE, sdd+er.to_s + "%", 2)
  370. #end
  371. #end
  372. #_----------------------------------------------
  373. #def draw_race(enemy,x,y)
  374. #      text="无"
  375. #      text2="无"
  376. #      for i in 9..16
  377. #        if enemy.element_rate(i) == 200
  378. #        text = $data_system.elements[i]
  379. #       end
  380. #        if enemy.element_rate(i) == 150
  381. #        text2 =$data_system.elements[i]
  382. #        end
  383. #      end
  384. #      self.contents.font.color = system_color
  385. #      self.contents.draw_text(x, y, 80, 32,"主要种族")
  386. #      self.contents.font.color = normal_color
  387. #      self.contents.draw_text(x+80, y, 76, 32,text,2)
  388. #      self.contents.font.color = system_color
  389. #      self.contents.draw_text(x+160, y, 80, 32,"次要种族")
  390. #      self.contents.font.color = normal_color
  391. #      self.contents.draw_text(x+80+160, y, 76, 32,text2,2)
  392. #end
  393.   
  394. #--------------------------------------------------------------------------
  395. # ● エネミーの名前の描画
  396. #     enemy : エネミー
  397. #     x     : 描画先 X 座標
  398. #     y     : 描画先 Y 座標
  399. #--------------------------------------------------------------------------
  400. def draw_enemy_name(enemy, x, y)
  401.    self.contents.font.color = normal_color
  402.    self.contents.draw_text(x, y, 152, 32, enemy.name)
  403. end
  404. #--------------------------------------------------------------------------
  405. # ● エネミーグラフィックの描画(アナライズ)
  406. #     enemy : エネミー
  407. #     x     : 描画先 X 座標
  408. #     y     : 描画先 Y 座標
  409. #--------------------------------------------------------------------------
  410. def draw_enemy_graphic(enemy, x, y, opacity = 255)
  411. end
  412. #--------------------------------------------------------------------------
  413. # ● エネミーの獲得EXPの描画
  414. #     enemy : エネミー
  415. #     x     : 描画先 X 座標
  416. #     y     : 描画先 Y 座標
  417. #--------------------------------------------------------------------------
  418. def draw_enemy_exp(enemy, x, y)
  419.    self.contents.font.color = system_color
  420.    self.contents.draw_text(x, y, 120, 32, "经验")
  421.    self.contents.font.color = normal_color
  422.    self.contents.draw_text(x + 120, y, 36, 32, enemy.exp.to_s, 2)
  423. end
  424. #--------------------------------------------------------------------------
  425. # ● エネミーの獲得GOLDの描画
  426. #     enemy : エネミー
  427. #     x     : 描画先 X 座標
  428. #     y     : 描画先 Y 座標
  429. #--------------------------------------------------------------------------
  430. def draw_enemy_gold(enemy, x, y)
  431.    self.contents.font.color = system_color
  432.    self.contents.draw_text(x, y, 120, 32, "掉落金钱")
  433.    self.contents.font.color = normal_color
  434.    self.contents.draw_text(x + 120, y, 36, 32, enemy.gold.to_s, 2)
  435. end
  436. #end
  437. class Game_Enemy_Book < Game_Enemy
  438. #--------------------------------------------------------------------------
  439. # ● オブジェクト初期化
  440. #--------------------------------------------------------------------------
  441. def initialize(enemy_id)
  442.    super(2, 1)#ダミー
  443.    @enemy_id = enemy_id
  444.    enemy = $data_enemies[@enemy_id]
  445.    @battler_name = enemy.battler_name
  446.    @battler_hue = enemy.battler_hue
  447.    @hp = maxhp
  448.    @sp = maxsp
  449. end
  450.   #--------------------------------------------------------------------------
  451.   # ● 获取名称
  452.   #--------------------------------------------------------------------------
  453.   def name
  454.     return $data_enemies[@enemy_id].name
  455.   end
  456. end
  457. class Data_MonsterBook
  458. attr_reader :id_data
  459. #--------------------------------------------------------------------------
  460. # ● オブジェクト初期化
  461. #--------------------------------------------------------------------------
  462. def initialize
  463.    @id_data = enemy_book_id_set
  464. end
  465. #--------------------------------------------------------------------------
  466. # ● 図鑑用登録無視属性取得
  467. #--------------------------------------------------------------------------
  468. def no_add_element
  469.    no_add = 0
  470.    # 登録無視の属性IDを取得
  471.    for i in 1...$data_system.elements.size
  472.      if $data_system.elements[i] =~ /不加入图鉴/
  473.        no_add = i
  474.        break
  475.      end
  476.    end
  477.    return no_add
  478. end
  479. #--------------------------------------------------------------------------
  480. # ● 図鑑用敵ID設定
  481. #--------------------------------------------------------------------------
  482. def enemy_book_id_set
  483.    data = [0]
  484.    no_add = no_add_element
  485.    # 登録無視の属性IDを取得
  486.    for i in 1...$data_enemies.size
  487.      enemy = $data_enemies[i]
  488.      next if enemy.name == ""
  489.      if enemy.element_ranks[no_add] == 1
  490.        next
  491.      end
  492.      data.push(enemy.id)
  493.    end
  494.    return data
  495. end
  496. end
  497. class Window_MonsterBook < Window_Selectable
  498. attr_reader   :data
  499. #--------------------------------------------------------------------------
  500. # ● オブジェクト初期化
  501. #--------------------------------------------------------------------------
  502. def initialize(index=0)
  503.    super(0, 64, 640, 416)
  504.    self.opacity=0
  505.    @column_max = 2
  506.    @book_data = $game_temp.enemy_book_data
  507.    @data = @book_data.id_data.dup
  508.    @data.shift
  509.    #@data.sort!
  510.    @item_max = @data.size
  511.    self.index = 0
  512.    refresh if @item_max > 0
  513. end
  514. #--------------------------------------------------------------------------
  515. # ● 遭遇データを取得
  516. #--------------------------------------------------------------------------
  517. def data_set
  518.    data = $game_party.enemy_info.keys
  519.    data.sort!
  520.    newdata = []
  521.    for i in data
  522.      next if $game_party.enemy_info[i] == 0
  523.      # 図鑑登録無視を考慮
  524.      if book_id(i) != nil
  525.        newdata.push(i)
  526.      end
  527.    end
  528.    return newdata
  529. end
  530. #--------------------------------------------------------------------------
  531. # ● 表示許可取得
  532. #--------------------------------------------------------------------------
  533. def show?(id)
  534.    if $game_party.enemy_info[id] == 0 or $game_party.enemy_info[id] == nil
  535.      return false
  536.    else
  537.      return true
  538.    end
  539. end
  540. #--------------------------------------------------------------------------
  541. # ● 図鑑用ID取得
  542. #--------------------------------------------------------------------------
  543. def book_id(id)
  544.    return @book_data.index(id)
  545. end
  546. #--------------------------------------------------------------------------
  547. # ● エネミー取得
  548. #--------------------------------------------------------------------------
  549. def item
  550.    return @data[self.index]
  551. end
  552. #--------------------------------------------------------------------------
  553. # ● リフレッシュ
  554. #--------------------------------------------------------------------------
  555. def refresh
  556.    if self.contents != nil
  557.      self.contents.dispose
  558.      self.contents = nil
  559.    end
  560.    self.contents = Bitmap.new(width - 32, row_max * 32)
  561.    #項目数が 0 でなければビットマップを作成し、全項目を描画
  562.    if @item_max > 0
  563.      for i in 0...@item_max
  564.       draw_item(i)
  565.      end
  566.    end
  567. end
  568. #--------------------------------------------------------------------------
  569. # ● 項目の描画
  570. #     index : 項目番号
  571. #--------------------------------------------------------------------------
  572. def draw_item(index)
  573.    enemy = $data_enemies[@data[index]]
  574.    return if enemy == nil
  575.    x = 4 + index % 2 * (288 + 32)
  576.    y = index / 2 * 32
  577.    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  578.    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  579.    self.contents.font.color = normal_color
  580.    draw_enemy_book_id(enemy, x, y)
  581.    if show?(enemy.id)
  582.      self.contents.draw_text(x + 28+16, y, 212, 32, enemy.name, 0)
  583.    else
  584.      self.contents.draw_text(x + 28+16, y, 212, 32, "-----", 0)
  585.      return
  586.    end
  587.    if analyze?(@data[index])
  588.      self.contents.font.color = text_color(3)
  589.      self.contents.draw_text(x + 256, y, 24, 32, "済", 2)
  590.    end
  591. end
  592. #--------------------------------------------------------------------------
  593. # ● アナライズ済かどうか
  594. #--------------------------------------------------------------------------
  595. def analyze?(enemy_id)
  596.    if $game_party.enemy_info[enemy_id] == 2
  597.      return true
  598.    else
  599.      return false
  600.    end
  601. end
  602. end
  603. class Window_MonsterBook_Info < Window_Base
  604. include Enemy_Book_Config
  605. #--------------------------------------------------------------------------
  606. # ● オブジェクト初期化
  607. #--------------------------------------------------------------------------
  608. def initialize
  609.    super(0, 0+64, 640, 480-64)
  610.    self.opacity=0
  611.    self.contents = Bitmap.new(width - 32, height - 32)
  612.    
  613. end
  614. #--------------------------------------------------------------------------
  615. # ● リフレッシュ
  616. #--------------------------------------------------------------------------
  617. def refresh(enemy_id)
  618.    self.contents.clear
  619.     testname = @actor.id.to_s
  620.     #bitmap = Bitmap.new("Graphics/pictures/怪物图鉴")
  621.     src_rect = Rect.new(16, 80, 640, 480)
  622. #    self.contents.blt(0, 0, bitmap, src_rect)
  623.    self.contents.font.size = 22
  624.    enemy = Game_Enemy_Book.new(enemy_id)
  625.    @gra = Sprite_Enemy_Graphic.new(nil,enemy)
  626.    @gra.z = 120      #怪物图片
  627.    draw_enemy_book_id(enemy, 4, 0)    #各种详细信息
  628.    draw_enemy_name(enemy, 48, 0)
  629.    draw_actor_hp(enemy, 288, 0)
  630.    draw_actor_sp(enemy, 288+160, 0)
  631.    self.contents.font.size=18
  632. #   draw_actor_parameter(enemy, 288    ,  25, 0)
  633.    self.contents.font.color = system_color
  634. #   self.contents.draw_text(288+160, 25, 120, 32, EVA_NAME)
  635.    self.contents.font.color = normal_color
  636. #   self.contents.draw_text(288+160 + 120, 25, 36, 32, enemy.eva.to_s, 2)
  637.    draw_actor_parameter(enemy, 288    ,  40, 3)
  638.    draw_actor_parameter(enemy, 288+160,  40, 4)
  639.    draw_actor_parameter(enemy, 288    ,  65, 5)
  640.    draw_actor_parameter(enemy, 288+160,  65, 6)
  641. #   draw_actor_parameter(enemy, 288    , 100, 1)
  642.    draw_actor_parameter(enemy, 288, 90, 2)
  643.    draw_enemy_exp(enemy, 288, 115)
  644.    draw_enemy_gold(enemy, 288+160, 115)
  645. #   draw_race(enemy, 288, 150)
  646.    #--------------------------------------------------------------------
  647.    draw_enemy_other(enemy, 0, 280)  #简介文字
  648.    draw_enemy_action(enemy,200, 30)  #显示敌人行动
  649. #   draw_actor_element_radar_graph(enemy, 360, 180)#雷达图
  650.    #--------------------------------------------------------------------
  651.    if DROP_ITEM_NEED_ANALYZE==true  #掉落物品
  652.      self.contents.font.color = system_color
  653.         self.contents.font.size=16
  654.      self.contents.draw_text(0, 235, 96, 32, "掉落物品")
  655.      draw_enemy_drop_item(enemy, 128, 235)
  656.      self.contents.font.color = normal_color
  657.         self.contents.font.size=18
  658.       end      
  659.     end
  660. def cl
  661.        @gra.dispose
  662. end
  663. #--------------------------------------------------------------------------
  664. # ● アナライズ済かどうか
  665. #--------------------------------------------------------------------------
  666. def analyze?(enemy_id)
  667.    if $game_party.enemy_info[enemy_id] == 2
  668.      return true
  669.    else
  670.      return false
  671.    end
  672. end
  673. end
  674. class Scene_MonsterBook
  675. include Enemy_Book_Config
  676. #--------------------------------------------------------------------------
  677. # ● メイン処理
  678. #--------------------------------------------------------------------------
  679. def main
  680.     怪物图鉴 = Sprite.new
  681. #    怪物图鉴.bitmap = Bitmap.new("Graphics/pictures/怪物图鉴.png")
  682.     怪物图鉴.opacity=255
  683.    $game_temp.enemy_book_data = Data_MonsterBook.new
  684.    # ウィンドウを作成
  685.    @title_window = Window_Base.new(0, 0, 640, 64)
  686.    @title_window.contents = Bitmap.new(640 - 32, 64 - 32)
  687.    @title_window.contents.draw_text(4, 0, 320, 32, "降妖谱", 0)
  688.     @title_window.opacity=0
  689.    if SHOW_COMPLETE_TYPE != 0
  690.      case SHOW_COMPLETE_TYPE
  691.      when 1
  692.        e_now = $game_party.enemy_book_now
  693.        e_max = $game_party.enemy_book_max
  694.        text = e_now.to_s + "/" + e_max.to_s
  695.      when 2
  696.        comp = $game_party.enemy_book_complete_percentage
  697.        text = comp.to_s + "%"
  698.      when 3
  699.        e_now = $game_party.enemy_book_now
  700.        e_max = $game_party.enemy_book_max
  701.        comp = $game_party.enemy_book_complete_percentage
  702.        text = e_now.to_s + "/" + e_max.to_s + " " + comp.to_s + "%"
  703.      end
  704.      if text != nil
  705.        @title_window.contents.draw_text(320, 0, 288, 32,  text, 2)
  706.      end
  707.    end
  708.    @main_window = Window_MonsterBook.new
  709.    @main_window.active = true
  710.    # インフォウィンドウを作成 (不可視・非アクティブに設定)
  711.    @info_window = Window_MonsterBook_Info.new
  712.    @info_window.z = 110
  713.    @info_window.visible = false
  714.    @info_window.active = false
  715.    @visible_index = 0
  716.    # トランジション実行
  717.    Graphics.transition
  718.    # メインループ
  719.    loop do
  720.      # ゲーム画面を更新
  721.      Graphics.update
  722.      # 入力情報を更新
  723.      Input.update
  724.      # フレーム更新
  725. #     if Kboard.keyboard($R_Key_F6)
  726. #       Screen::shot1
  727.   #      Audio.se_play("Audio/SE/"+"camera",100,100)
  728. #     end
  729.      update
  730.      # 画面が切り替わったらループを中断
  731.      if $scene != self
  732.        break
  733.      end
  734.    end
  735.    # トランジション準備
  736.    Graphics.freeze
  737.    # ウィンドウを解放
  738.    @main_window.dispose
  739.    @info_window.dispose
  740.    @title_window.dispose
  741. end
  742. #--------------------------------------------------------------------------
  743. # ● フレーム更新
  744. #--------------------------------------------------------------------------
  745. def update
  746.    # ウィンドウを更新
  747.    @main_window.update
  748.    @info_window.update
  749. #   gra.update
  750.    if @info_window.active
  751.      update_info
  752.      return
  753.    end
  754.    # メインウィンドウがアクティブの場合: update_target を呼ぶ
  755.    if @main_window.active
  756.      update_main
  757.      return
  758.    end
  759. end
  760. #--------------------------------------------------------------------------
  761. # ● フレーム更新 (メインウィンドウがアクティブの場合)
  762. #--------------------------------------------------------------------------
  763. def update_main
  764.    # B ボタンが押された場合
  765.    if Input.trigger?(Input::B)
  766.      # キャンセル SE を演奏
  767.      $game_system.se_play($data_system.cancel_se)
  768.      $scene = Scene_Menu.new(2)
  769.      return
  770.    end
  771.    # C ボタンが押された場合
  772.    if Input.trigger?(Input::C)
  773.      if @main_window.item == nil or @main_window.show?(@main_window.item) == false
  774.        # ブザー SE を演奏
  775.        $game_system.se_play($data_system.buzzer_se)
  776.        return
  777.      end
  778.      # 決定 SE を演奏
  779.      $game_system.se_play($data_system.decision_se)
  780.      @main_window.active = false
  781.      @info_window.active = true
  782.      @info_window.visible = true
  783.      @visible_index = @main_window.index
  784.      @info_window.refresh(@main_window.item)
  785.      return
  786.    end
  787. end
  788. #--------------------------------------------------------------------------
  789. # ● フレーム更新 (インフォウィンドウがアクティブの場合)
  790. #--------------------------------------------------------------------------
  791. def update_info
  792.    # B ボタンが押された場合
  793.    if Input.trigger?(Input::B)
  794.      # キャンセル SE を演奏
  795.      $game_system.se_play($data_system.cancel_se)
  796.      @main_window.active = true
  797.      @info_window.active = false
  798.      @info_window.visible = false
  799.      @info_window.cl
  800.      return
  801.    end
  802.    # C ボタンが押された場合
  803.    if Input.trigger?(Input::C)
  804.      # 決定 SE を演奏
  805.      #$game_system.se_play($data_system.decision_se)
  806.      return
  807.    end
  808.    if Input.trigger?(Input::L)
  809.      # 決定 SE を演奏
  810.      $game_system.se_play($data_system.decision_se)
  811.      loop_end = false
  812.      while loop_end == false
  813.        if @visible_index != 0
  814.          @visible_index -= 1
  815.        else
  816.          @visible_index = @main_window.data.size - 1
  817.        end
  818.        loop_end = true if @main_window.show?(@main_window.data[@visible_index])
  819.      end
  820.      id = @main_window.data[@visible_index]
  821.      @info_window.refresh(id)
  822.      return
  823.    end
  824.    if Input.trigger?(Input::R)
  825.      # 決定 SE を演奏
  826.      $game_system.se_play($data_system.decision_se)
  827.      loop_end = false
  828.      while loop_end == false
  829.        if @visible_index != @main_window.data.size - 1
  830.          @visible_index += 1
  831.        else
  832.          @visible_index = 0
  833.        end
  834.        loop_end = true if @main_window.show?(@main_window.data[@visible_index])
  835.      end
  836.      id = @main_window.data[@visible_index]
  837.      @info_window.refresh(id)
  838.      return
  839.    end
  840. end
  841. end
  842. #==================================================================
  843. # 本脚本来自[url]http://www.66rpg.com/[/url],使用和转载请保留此信息
  844. #==================================================================
  845. class Sprite_Enemy_Graphic< Sprite
  846.   attr_accessor :enemy
  847.   #--------------------------------------------------------------------------
  848.   # ● オブジェクト初期化
  849.   #--------------------------------------------------------------------------
  850. def initialize(viewport,enemy)
  851.     super(viewport)
  852.     if @enemy != enemy
  853.       self.bitmap = RPG::Cache.battler(enemy.battler_name, enemy.battler_hue)     
  854.       cw = self.bitmap.width
  855.       ch = self.bitmap.height
  856.     if cw>ch
  857.      self.zoom_x=1
  858.      self.zoom_y=1
  859.    else
  860.      self.zoom_x=1
  861.      self.zoom_y=1     
  862.    end
  863.      self.x=150-cw/2
  864.      self.y=210-ch/2
  865.       @enemy=enemy
  866.     end
  867.   end
  868.   #--------------------------------------------------------------------------
  869.   # ● 解放
  870.   #--------------------------------------------------------------------------
  871.   def dispose
  872.     if self.bitmap != nil
  873.       self.bitmap.dispose
  874.     end
  875.     super
  876.   end
  877.   #--------------------------------------------------------------------------
  878.   # ● フレーム更新
  879.   #--------------------------------------------------------------------------
  880.   def refresh(enemy)
  881.   end
  882. end
复制代码
这个脚本使用后 总是出现


这个@enemy_info.keys是什么作用…为什么会报错呢…
求解

点评

大量代码要用代码框引用,你应该是点错了。。。  发表于 2013-9-19 11:00

Lv1.梦旅人

梦石
0
星屑
153
在线时间
90 小时
注册时间
2011-5-4
帖子
39
3
 楼主| 发表于 2013-9-19 13:12:28 | 只看该作者
我找到了… 和地图名字显示 的脚本冲突… 果断删地图名显示…
图鉴脚本大好
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
9280
在线时间
2504 小时
注册时间
2011-5-20
帖子
15389

开拓者

2
发表于 2013-9-19 12:53:27 | 只看该作者
和你的其他脚本冲突了,把工程发上来看看,新手的话真心不推荐用这类脚本,因为原版脚本与90%的其他脚本冲突···

点评

了解…那我用那个比较普通的怪物图鉴脚本好了… 功能少很多… 谢谢提示  发表于 2013-9-19 13:05

评分

参与人数 1星屑 +60 收起 理由
myownroc + 60 新版主膜拜chd大神。。。

查看全部评分

[img]http://service.t.sina.com.cn/widget/qmd/5339802982/c02e16bd/7.png
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-9-23 05:25

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表