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

Project1

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

[已经过期] 关于怪物图鉴的运行问题

[复制链接]

Lv1.梦旅人

梦石
0
星屑
112
在线时间
117 小时
注册时间
2012-7-23
帖子
41
跳转到指定楼层
1
发表于 2012-8-21 20:23:16 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
昨天一个个测试了下,发现如果用默认的数据库就没事,而用我自己录入新数据的数据库就不行了,是脚本跟数据库冲突了吗?



我用的是以下这个脚本:并通过物品调用公共事件来调出图鉴,前面什么都好就是当我在图鉴上也就是这张图的时候 我按确定,然后他跳出了这个
这是怎么一回事,应该怎么解决呢?

下面是我用的那个脚本:
#================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#===================================================================
#——————————————————————————————————————
#魔物图鉴+介绍
#
#战斗终了时自动添加敌人进入图鉴(class Scene_Battle start_phase5 追加。

#目前与各种战斗系统没有发现冲突)
#不想加入图鉴的怪物设置其“不加入图鉴”属性有效度为A即可
#图鉴完成度的表示功能追加
#SHOW_COMPLETE_TYPE 的数值可以设定
#当为1,显示现有个数/总数,当为2,显示完成百分比,当为3,全显示。
#使用方法:$scene = Scene_MonsterBook.new
#数据库中属性里面那些种族特效的位置,建议把默认的“对 不死”之类改成“不死”,

#不然显示会很奇怪
#由于雷达图的设计问题,只支持8项属性
#默认种族特效处理属性中编号9到编号16,

#如果你做了修改请自行改动380行左右的for i in 9..16这一句代码
#显示各种信息位于630行左右,想不显示的话只要删除相应语句
CHARA_INFO=[]#怪物的介绍,对应怪物id,空格为换行,

#同时也会自动换行,没有写介绍的怪物会自动显示“无详细信息”
CHARA_INFO[1] = "怪物介绍1"
CHARA_INFO[2] = "怪物介绍2"
CHARA_INFO[3] = "生活在潮湿的沼泽地区的变异生物,性情凶暴,经常会袭击各种路过的生物"
#没有信息测试,4号怪物
#=============
#雷达图相关处理部分
#=============
class Bitmap
def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
distance = (start_x - end_x).abs + (start_y - end_y).abs
if end_color == start_color
for i in 1..distance
x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
if width == 1
self.set_pixel(x, y, start_color)
else
self.fill_rect(x, y, width, width, start_color)
end
end
else
for i in 1..distance
x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
r = start_color.red * (distance-i)/distance + end_color.red * i/distance
g = start_color.green * (distance-i)/distance + end_color.green * i/distance
b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance
a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
if width == 1
self.set_pixel(x, y, Color.new(r, g, b, a))
else
self.fill_rect(x, y, width, width, Color.new(r, g, b, a))
end
end
end
end
end
#=============
# Graphic_Def_Elem
#=============
class Window_Base
FONT_SIZE = 18
WORD_ELEMENT_GUARD = "属性有效度"
NUMBER_OF_ELEMENTS = 8
ELEMENT_ORDER = [1,3,8,5,2,4,7,6]
GRAPH_SCALINE_COLOR = Color.new(255, 255, 255, 128)
GRAPH_SCALINE_COLOR_SHADOW = Color.new( 0, 0, 0, 192)
GRAPH_LINE_COLOR = Color.new(255, 255, 64, 255)
GRAPH_LINE_COLOR_MINUS = Color.new( 64, 255, 255, 255)
GRAPH_LINE_COLOR_PLUS = Color.new(255, 64, 64, 255)
end

#——————————————————————————————————————
module Enemy_Book_Config
DROP_ITEM_NEED_ANALYZE = true #显示物品
EVA_NAME = "回避修正"              #回避修正的名称(因为数据库中没有定义)
SHOW_COMPLETE_TYPE = 3         #图鉴完成率表示方法
end
class Data_MonsterBook
#--------------------------------------------------------------------------
# ● 图鉴用ID設定
#--------------------------------------------------------------------------
def enemy_book_id_set
   data = [0]
   data[1] = 2
   data[2] = 1
   data[3] = 15
   data[4] = 25
   data[5] = 18
   data[6] = 30
   return data
end
end
class Game_Temp
attr_accessor :enemy_book_data
alias temp_enemy_book_data_initialize initialize
def initialize
   temp_enemy_book_data_initialize
   @enemy_book_data = Data_MonsterBook.new
end
end

class Game_Party
#==============================================
#--------------------------------------------------------------------------
  # ● 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_reader   :actors                   # アクター
  attr_reader   :gold                     # ゴールド
  attr_reader   :steps                    # 歩数
  attr_accessor :mission                  # 任务★★★★★★★★★★★★★
  attr_accessor   :pr                  # 当前章节数★★★★★★★★★★★★★
  attr_reader   :prname
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    # アクターの配列を作成
    @actors = []
    # ゴールドと歩数を初期化
    @gold = 0
    @steps = 0
    # アイテム、武器、防具の所持数ハッシュを作成
    @items = {}
    @weapons = {}
    @armors = {}
  end
#==============================================
attr_accessor :enemy_info               # 出会った敵情報(図鑑用)

#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias book_info_initialize initialize
def initialize
   book_info_initialize
   @enemy_info = {}
end

#--------------------------------------------------------------------------
# ● エネミー情報の追加(図鑑用)
#     type : 通常遭遇かアナライズか 0:通常 1:アナライズ -1:情報削除
#     0:無遭遇 1:遭遇済 2:アナライズ済
#--------------------------------------------------------------------------
def add_enemy_info(enemy_id, type = 0)
   case type
   when 0
     if @enemy_info[enemy_id] == 2
       return false
     end
     @enemy_info[enemy_id] = 1
   when 1
     @enemy_info[enemy_id] = 2
   when -1
     @enemy_info[enemy_id] = 0
   end
end
#--------------------------------------------------------------------------
# ● 魔物図鑑の最大登録数を取得
#--------------------------------------------------------------------------
def enemy_book_max
   return $game_temp.enemy_book_data.id_data.size - 1
end
#--------------------------------------------------------------------------
# ● 魔物図鑑の現在登録数を取得
#--------------------------------------------------------------------------
def enemy_book_now
   now_enemy_info = @enemy_info.keys
   # 登録無視の属性IDを取得
   no_add = $game_temp.enemy_book_data.no_add_element
   new_enemy_info = []
   for i in now_enemy_info
     enemy = $data_enemies
     next if enemy.name == ""
     if enemy.element_ranks[no_add] == 1
       next
     end
     new_enemy_info.push(enemy.id)
   end
   return new_enemy_info.size
end
#--------------------------------------------------------------------------
# ● 魔物図鑑の完成率を取得
#--------------------------------------------------------------------------
def enemy_book_complete_percentage
   e_max = enemy_book_max.to_f
   e_now = enemy_book_now.to_f
   comp = e_now / e_max * 100
   return comp.truncate
end
end

class Interpreter
def enemy_book_max
   return $game_party.enemy_book_max
end
def enemy_book_now
   return $game_party.enemy_book_now
end
def enemy_book_comp
   return $game_party.enemy_book_complete_percentage
end
end

class Scene_Battle
alias add_enemy_info_start_phase5 start_phase5
def start_phase5
   for enemy in $game_troop.enemies
     # エネミーが隠れ状態でない場合
     unless enemy.hidden
       # 敵遭遇情報追加
       $game_party.add_enemy_info(enemy.id, 0)
     end
   end
   add_enemy_info_start_phase5
end
end

class Window_Base < Window
#--------------------------------------------------------------------------
# ● エネミーの戦闘後獲得アイテムの描画
#--------------------------------------------------------------------------
def draw_enemy_drop_item(enemy, x, y)
   self.contents.font.color = normal_color
   treasures = []
   if enemy.item_id > 0
     treasures.push($data_items[enemy.item_id])
   end
   if enemy.weapon_id > 0
     treasures.push($data_weapons[enemy.weapon_id])
   end
   if enemy.armor_id > 0
     treasures.push($data_armors[enemy.armor_id])
   end
   # 現状ではとりあえず1つのみ描画
   if treasures.size > 0
     item = treasures[0]
     bitmap = RPG::Cache.icon(item.icon_name)
     opacity = 255
     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
     name = treasures[0].name
   else
     self.contents.font.color = disabled_color
     name = "无"
   end
   self.contents.draw_text(x+28, y, 212, 32, name)
end
#--------------------------------------------------------------------------
# ● エネミーの図鑑IDの描画
#--------------------------------------------------------------------------
def draw_enemy_book_id(enemy, x, y)
   self.contents.font.color = normal_color
   id = $game_temp.enemy_book_data.id_data.index(enemy.id)
   self.contents.draw_text(x, y, 32, 32, id.to_s)
end
#--------------------------------------------------------------------------
# ● 敌人简介描绘
#--------------------------------------------------------------------------
def draw_enemy_other(enemy, x, y)
   if CHARA_INFO[enemy.id]==nil
    CHARA_INFO[enemy.id] = "没有相关资料"
  end
   self.contents.font.size=16
   x+=self.contents.text_size("").width
   info = CHARA_INFO[enemy.id]
   s=info.scan(/./)
    #一行显示21个字
    for i in s
      sss = self.contents.text_size(i)
      
      if  i==" "
        y+=16
        x=0
      elsif (x+sss.width)>(width - 32-260)
        y+=16
        x=0
        self.contents.draw_text(x, y, sss.width, sss.height, i)
        x+=sss.width
      else
      self.contents.draw_text(x, y, sss.width, sss.height, i)
      x+=sss.width
      end
    end
  end
   #--------------------------------------------------------------------------
# ● 敌人特技描绘
#--------------------------------------------------------------------------
def draw_enemy_action(enemy, x, y)
   self.contents.font.size=16
   yy=y
   self.contents.font.color = system_color
   self.contents.draw_text(x, yy, 80, 18,"行动列表")
   self.contents.font.color = normal_color
   for action in enemy.actions
     yy+=18
     if action.kind==0
       case action.basic
        when 0
          ac="普通攻击"
        when 1
          ac="防御"
        when 2
          ac="逃跑"
        when 3
          ac="无"
        end
     self.contents.draw_text(x, yy, 160, 18, ac )
     end
     if action.kind==1
     self.contents.draw_text(x, yy, 160, 18, $data_skills[action.skill_id].name )
     end
   end
end
#雷达图描绘
  #===================================================================
  def draw_actor_element_radar_graph(actor, x, y)
    radius = 56
cx = x + radius + FONT_SIZE + 48
cy = y + radius + FONT_SIZE + 32
self.contents.font.color = system_color
self.contents.draw_text(x, y, 104, 32, WORD_ELEMENT_GUARD)
for loop_i in 0..NUMBER_OF_ELEMENTS
if loop_i == 0

else
@pre_x = @now_x
@pre_y = @now_y
@pre_ex = @now_ex
@pre_ey = @now_ey
@color1 = @color2
end
if loop_i == NUMBER_OF_ELEMENTS
eo = ELEMENT_ORDER[0]
else
eo = ELEMENT_ORDER[loop_i]
end
er = actor.element_rate(eo)
estr = $data_system.elements[eo]
@color2 = er < 0 ? GRAPH_LINE_COLOR_MINUS : er > 100 ? GRAPH_LINE_COLOR_PLUS : GRAPH_LINE_COLOR
if er <0
  then xsh=true
else xsh=false
end
er = er.abs
th = Math::PI * (0.5 - 2.0 * loop_i / NUMBER_OF_ELEMENTS)
@now_x = cx + (radius * Math.cos(th)).floor
@now_y = cy - (radius * Math.sin(th)).floor
@now_wx = cx + ((radius+FONT_SIZE*2/2) * Math.cos(th)).floor - FONT_SIZE
@now_wy = cy - ((radius+FONT_SIZE*1/2) * Math.sin(th)).floor - FONT_SIZE/2
@now_vx = cx + ((radius+FONT_SIZE*6/2) * Math.cos(th)).floor - FONT_SIZE
@now_vy = cy - ((radius+FONT_SIZE*3/2) * Math.sin(th)).floor - FONT_SIZE/2
@now_ex = cx + (er*radius/100 * Math.cos(th)).floor
@now_ey = cy - (er*radius/100 * Math.sin(th)).floor
if loop_i == 0
@pre_x = @now_x
@pre_y = @now_y
@pre_ex = @now_ex
@pre_ey = @now_ey
@color1 = @color2
else

end
next if loop_i == 0
self.contents.draw_line(cx+1,cy+1, @now_x+1,@now_y+1, GRAPH_SCALINE_COLOR_SHADOW)
self.contents.draw_line(@pre_x+1,@pre_y+1, @now_x+1,@now_y+1, GRAPH_SCALINE_COLOR_SHADOW)
self.contents.draw_line(cx,cy, @now_x,@now_y, GRAPH_SCALINE_COLOR)
self.contents.draw_line(@pre_x,@pre_y, @now_x,@now_y, GRAPH_SCALINE_COLOR)
self.contents.draw_line(@pre_ex,@pre_ey, @now_ex,@now_ey, @color1, 2, @color2)
self.contents.font.size = FONT_SIZE
if xsh == true
  then self.contents.font.color = Color.new(100,255,128,128)
  sdd="-"
else self.contents.font.color = system_color
  sdd=""
end
self.contents.draw_text(@now_wx,@now_wy, FONT_SIZE*2, FONT_SIZE, estr, 1)
self.contents.font.color = Color.new(255,255,255,128)
self.contents.draw_text(@now_vx,@now_vy, FONT_SIZE*2, FONT_SIZE, sdd+er.to_s + "%", 2)
end
end
#_----------------------------------------------
def draw_race(enemy,x,y)
      text="无"
      text2="无"
      for i in 1..8
        if enemy.element_rate(i) == 200
        text = $data_system.elements
        end
        if enemy.element_rate(i) == 150
        text2 =$data_system.elements
        end
      end
      self.contents.font.color = system_color
      self.contents.draw_text(x, y, 80, 32,"主要种族")
      self.contents.font.color = normal_color
      self.contents.draw_text(x+80, y, 76, 32,text,2)
      self.contents.font.color = system_color
      self.contents.draw_text(x+160, y, 80, 32,"次要种族")
      self.contents.font.color = normal_color
      self.contents.draw_text(x+80+160, y, 76, 32,text2,2)
end
  
#--------------------------------------------------------------------------
# ● エネミーの名前の描画
#     enemy : エネミー
#     x     : 描画先 X 座標
#     y     : 描画先 Y 座標
#--------------------------------------------------------------------------
def draw_enemy_name(enemy, x, y)
   self.contents.font.color = normal_color
   self.contents.draw_text(x, y, 152, 32, enemy.name)
end
#--------------------------------------------------------------------------
# ● エネミーグラフィックの描画(アナライズ)
#     enemy : エネミー
#     x     : 描画先 X 座標
#     y     : 描画先 Y 座標
#--------------------------------------------------------------------------
def draw_enemy_graphic(enemy, x, y, opacity = 255)

end
#--------------------------------------------------------------------------
# ● エネミーの獲得EXPの描画
#     enemy : エネミー
#     x     : 描画先 X 座標
#     y     : 描画先 Y 座標
#--------------------------------------------------------------------------
def draw_enemy_exp(enemy, x, y)
   self.contents.font.color = system_color
   self.contents.draw_text(x, y, 120, 32, "EXP")
   self.contents.font.color = normal_color
   self.contents.draw_text(x + 120, y, 36, 32, enemy.exp.to_s, 2)
end
#--------------------------------------------------------------------------
# ● エネミーの獲得GOLDの描画
#     enemy : エネミー
#     x     : 描画先 X 座標
#     y     : 描画先 Y 座標
#--------------------------------------------------------------------------
def draw_enemy_gold(enemy, x, y)
   self.contents.font.color = system_color
   self.contents.draw_text(x, y, 120, 32, "掉落金钱")
   self.contents.font.color = normal_color
   self.contents.draw_text(x + 120, y, 36, 32, enemy.gold.to_s, 2)
end
end

class Game_Enemy_Book < Game_Enemy
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(enemy_id)
   super(2, 1)#ダミー
   @enemy_id = enemy_id
   enemy = $data_enemies[@enemy_id]
   @battler_name = enemy.battler_name
   @battler_hue = enemy.battler_hue
   @hp = maxhp
   @sp = maxsp
end
end

class Data_MonsterBook
attr_reader :id_data
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
   @id_data = enemy_book_id_set
end
#--------------------------------------------------------------------------
# ● 図鑑用登録無視属性取得
#--------------------------------------------------------------------------
def no_add_element
   no_add = 0
   # 登録無視の属性IDを取得
   for i in 1...$data_system.elements.size
     if $data_system.elements =~ /不加入图鉴/
       no_add = i
       break
     end
   end
   return no_add
end
#--------------------------------------------------------------------------
# ● 図鑑用敵ID設定
#--------------------------------------------------------------------------
def enemy_book_id_set
   data = [0]
   no_add = no_add_element
   # 登録無視の属性IDを取得
   for i in 1...$data_enemies.size
     enemy = $data_enemies
     next if enemy.name == ""
     if enemy.element_ranks[no_add] == 1
       next
     end
     data.push(enemy.id)
   end
   return data
end
end


class Window_MonsterBook < Window_Selectable
attr_reader   :data
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(index=0)
   super(0, 64, 640, 416)
   @column_max = 2
   @book_data = $game_temp.enemy_book_data
   @data = @book_data.id_data.dup
   @data.shift
   #@data.sort!
   @item_max = @data.size
   self.index = 0
   refresh if @item_max > 0
end
#--------------------------------------------------------------------------
# ● 遭遇データを取得
#--------------------------------------------------------------------------
def data_set
   data = $game_party.enemy_info.keys
   data.sort!
   newdata = []
   for i in data
     next if $game_party.enemy_info == 0
     # 図鑑登録無視を考慮
     if book_id(i) != nil
       newdata.push(i)
     end
   end
   return newdata
end
#--------------------------------------------------------------------------
# ● 表示許可取得
#--------------------------------------------------------------------------
def show?(id)
   if $game_party.enemy_info[id] == 0 or $game_party.enemy_info[id] == nil
     return false
   else
     return true
   end
end
#--------------------------------------------------------------------------
# ● 図鑑用ID取得
#--------------------------------------------------------------------------
def book_id(id)
   return @book_data.index(id)
end
#--------------------------------------------------------------------------
# ● エネミー取得
#--------------------------------------------------------------------------
def item
   return @data[self.index]
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
   if self.contents != nil
     self.contents.dispose
     self.contents = nil
   end
   self.contents = Bitmap.new(width - 32, row_max * 32)
   #項目数が 0 でなければビットマップを作成し、全項目を描画
   if @item_max > 0
     for i in 0...@item_max
      draw_item(i)
     end
   end
end
#--------------------------------------------------------------------------
# ● 項目の描画
#     index : 項目番号
#--------------------------------------------------------------------------
def draw_item(index)
   enemy = $data_enemies[@data[index]]
   return if enemy == nil
   x = 4 + index % 2 * (288 + 32)
   y = index / 2 * 32
   rect = Rect.new(x, y, self.width / @column_max - 32, 32)
   self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
   self.contents.font.color = normal_color
   draw_enemy_book_id(enemy, x, y)
   if show?(enemy.id)
     self.contents.draw_text(x + 28+16, y, 212, 32, enemy.name, 0)
   else
     self.contents.draw_text(x + 28+16, y, 212, 32, "-----", 0)
     return
   end
   if analyze?(@data[index])
     self.contents.font.color = text_color(3)
     self.contents.draw_text(x + 256, y, 24, 32, "済", 2)
   end
end
#--------------------------------------------------------------------------
# ● アナライズ済かどうか
#--------------------------------------------------------------------------
def analyze?(enemy_id)
   if $game_party.enemy_info[enemy_id] == 2
     return true
   else
     return false
   end
end
end


class Window_MonsterBook_Info < Window_Base
include Enemy_Book_Config
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
   super(0, 0+64, 640, 480-64)
   self.back_opacity=255
   self.contents = Bitmap.new(width - 32, height - 32)
   
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh(enemy_id)
   self.contents.clear
   self.contents.font.size = 22
   enemy = Game_Enemy_Book.new(enemy_id)
   @gra = Sprite_Enemy_Graphic.new(nil,enemy)
   @gra.z = 120      #怪物图片
   draw_enemy_book_id(enemy, 4, 0)    #各种详细信息
   draw_enemy_name(enemy, 48, 0)
   draw_actor_hp(enemy, 288, 0)
   draw_actor_sp(enemy, 288+160, 0)
   self.contents.font.size=18
   draw_actor_parameter(enemy, 288    ,  25, 0)
   self.contents.font.color = system_color
   self.contents.draw_text(288+160, 25, 120, 32, EVA_NAME)
   self.contents.font.color = normal_color
   self.contents.draw_text(288+160 + 120, 25, 36, 32, enemy.eva.to_s, 2)
   draw_actor_parameter(enemy, 288    ,  50, 3)
   draw_actor_parameter(enemy, 288+160,  50, 4)
   draw_actor_parameter(enemy, 288    ,  75, 5)
   draw_actor_parameter(enemy, 288+160,  75, 6)
   draw_actor_parameter(enemy, 288    , 100, 1)
   draw_actor_parameter(enemy, 288+160, 100, 2)
   draw_enemy_exp(enemy, 288, 125)
   draw_enemy_gold(enemy, 288+160, 125)
   draw_race(enemy, 288, 150)
   #--------------------------------------------------------------------
   draw_enemy_other(enemy, 0, 280)  #简介文字
   draw_enemy_action(enemy,200, 30)  #显示敌人行动
   draw_actor_element_radar_graph(enemy, 360, 180)#雷达图
   #--------------------------------------------------------------------
   if DROP_ITEM_NEED_ANALYZE==true  #掉落物品
     self.contents.font.color = system_color
        self.contents.font.size=16
     self.contents.draw_text(0, 235, 96, 32, "掉落物品")
     draw_enemy_drop_item(enemy, 128, 235)
     self.contents.font.color = normal_color
        self.contents.font.size=18
      end      
    end
def cl
       @gra.dispose
end
#--------------------------------------------------------------------------
# ● アナライズ済かどうか
#--------------------------------------------------------------------------
def analyze?(enemy_id)
   if $game_party.enemy_info[enemy_id] == 2
     return true
   else
     return false
   end
end
end


class Scene_MonsterBook
include Enemy_Book_Config
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
def main
   $game_temp.enemy_book_data = Data_MonsterBook.new
   # ウィンドウを作成
   @title_window = Window_Base.new(0, 0, 640, 64)
   @title_window.contents = Bitmap.new(640 - 32, 64 - 32)
   @title_window.contents.draw_text(4, 0, 320, 32, "魔物图鉴", 0)
   if SHOW_COMPLETE_TYPE != 0
     case SHOW_COMPLETE_TYPE
     when 1
       e_now = $game_party.enemy_book_now
       e_max = $game_party.enemy_book_max
       text = e_now.to_s + "/" + e_max.to_s
     when 2
       comp = $game_party.enemy_book_complete_percentage
       text = comp.to_s + "%"
     when 3
       e_now = $game_party.enemy_book_now
       e_max = $game_party.enemy_book_max
       comp = $game_party.enemy_book_complete_percentage
       text = e_now.to_s + "/" + e_max.to_s + " " + comp.to_s + "%"
     end
     if text != nil
       @title_window.contents.draw_text(320, 0, 288, 32,  text, 2)
     end
   end
   @main_window = Window_MonsterBook.new
   @main_window.active = true
   # インフォウィンドウを作成 (不可視・非アクティブに設定)
   @info_window = Window_MonsterBook_Info.new
   @info_window.z = 110
   @info_window.visible = false
   @info_window.active = false
   @visible_index = 0
   # トランジション実行
   Graphics.transition
   # メインループ
   loop do
     # ゲーム画面を更新
     Graphics.update
     # 入力情報を更新
     Input.update
     # フレーム更新
     update
     # 画面が切り替わったらループを中断
     if $scene != self
       break
     end
   end
   # トランジション準備
   Graphics.freeze
   # ウィンドウを解放
   @main_window.dispose
   @info_window.dispose
   @title_window.dispose
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
   # ウィンドウを更新
   @main_window.update
   @info_window.update
#   gra.update
   if @info_window.active
     update_info
     return
   end
   # メインウィンドウがアクティブの場合: update_target を呼ぶ
   if @main_window.active
     update_main
     return
   end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_main
   # B ボタンが押された場合
   if Input.trigger?(Input::B)
     # キャンセル SE を演奏
     $game_system.se_play($data_system.cancel_se)
     $scene = Scene_Menu.new(7)
     return
   end
   # C ボタンが押された場合
   if Input.trigger?(Input::C)
     if @main_window.item == nil or @main_window.show?(@main_window.item) == false
       # ブザー SE を演奏
       $game_system.se_play($data_system.buzzer_se)
       return
     end
     # 決定 SE を演奏
     $game_system.se_play($data_system.decision_se)
     @main_window.active = false
     @info_window.active = true
     @info_window.visible = true
     @visible_index = @main_window.index
     @info_window.refresh(@main_window.item)
     return
   end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (インフォウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_info
   # B ボタンが押された場合
   if Input.trigger?(Input::B)
     # キャンセル SE を演奏
     $game_system.se_play($data_system.cancel_se)
     @main_window.active = true
     @info_window.active = false
     @info_window.visible = false
     @info_window.cl
     return
   end
   # C ボタンが押された場合
   if Input.trigger?(Input::C)
     # 決定 SE を演奏
     #$game_system.se_play($data_system.decision_se)
     return
   end
   if Input.trigger?(Input::L)
     # 決定 SE を演奏
     $game_system.se_play($data_system.decision_se)
     loop_end = false
     while loop_end == false
       if @visible_index != 0
         @visible_index -= 1
       else
         @visible_index = @main_window.data.size - 1
       end
       loop_end = true if @main_window.show?(@main_window.data[@visible_index])
     end
     id = @main_window.data[@visible_index]
     @info_window.refresh(id)
     return
   end
   if Input.trigger?(Input::R)
     # 決定 SE を演奏
     $game_system.se_play($data_system.decision_se)
     loop_end = false
     while loop_end == false
       if @visible_index != @main_window.data.size - 1
         @visible_index += 1
       else
         @visible_index = 0
       end
       loop_end = true if @main_window.show?(@main_window.data[@visible_index])
     end
     id = @main_window.data[@visible_index]
     @info_window.refresh(id)
     return
   end
end
end
#==================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==================================================================
class Sprite_Enemy_Graphic< Sprite
  attr_accessor :enemy
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize(viewport,enemy)
    super(viewport)
    if @enemy != enemy
      self.bitmap = RPG::Cache.battler(enemy.battler_name, enemy.battler_hue)
      cw = self.bitmap.width
      ch = self.bitmap.height
    if cw>ch
     self.zoom_x=200.0/cw
     self.zoom_y=200.0/cw
   else
     self.zoom_x=200.0/ch
     self.zoom_y=200.0/ch     
   end
     self.x=10
     self.y=110
      @enemy=enemy
    end
  end
  #--------------------------------------------------------------------------
  # ● 解放
  #--------------------------------------------------------------------------
  def dispose
    if self.bitmap != nil
      self.bitmap.dispose
    end
    super
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  def refresh(enemy)
  end
end

1.png (462.06 KB, 下载次数: 2)

1.png

评分

参与人数 1星屑 +200 收起 理由
hcm + 200 补回

查看全部评分

Lv1.梦旅人

虱子

梦石
0
星屑
121
在线时间
1782 小时
注册时间
2010-6-19
帖子
3597
2
发表于 2012-8-21 21:03:47 | 只看该作者
试试新开个存档

http://rpg.blue/thread-175056-1-2.html
PVZ型塔防物一个
http://rpg.blue/thread-155199-1-2.html
RMXP技术讨论区手动认可帖,得到答案请认可
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
112
在线时间
117 小时
注册时间
2012-7-23
帖子
41
3
 楼主| 发表于 2012-8-21 21:28:45 | 只看该作者
Wind2010 发表于 2012-8-21 21:03
试试新开个存档

这是图鉴界面呃,不是存档。。

点评

怎么新开个存档呢?  发表于 2012-8-21 22:13
那应该怎么办?  发表于 2012-8-21 22:12
图鉴对游戏数据进行了修改,所以可能导致旧存档没有该数值而出错  发表于 2012-8-21 22:07
回复

使用道具 举报

Lv2.观梦者

梦石
0
星屑
558
在线时间
377 小时
注册时间
2012-7-10
帖子
1283
4
发表于 2012-8-21 22:26:55 | 只看该作者
重新开始新的游戏
再重新呼叫图鉴试试

点评

重复N遍,都是这样  发表于 2012-8-21 23:24
太久没有来6R了,都是新面孔啊。
帮忙宣传游戏ing,虽说不常上线。
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
48 小时
注册时间
2011-10-21
帖子
31
5
发表于 2012-8-22 23:40:55 | 只看该作者
使用公共事件调出图鉴的脚本改成这样
  1. $game_party.enemy_info = {} if
  2. $game_party.enemy_info.nil?
  3. $scene = Scene_MonsterBook.new
复制代码
你再测试看看行不行?

这是应对原有存档没有这一相关数据的处理方法,如果还是不行的话我也没办法了

点评

还是不行啊,感觉跟存档应该没啥关系  发表于 2012-8-25 10:56
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
76 小时
注册时间
2012-7-4
帖子
120
6
发表于 2012-8-23 21:52:48 | 只看该作者
我觉得是那个脚步里面的问题
别人编写的时候,只是把默认的那些素材编了进去,
所以你自己的素材就不行
我也不知道对不对
===================
我也是猜测

点评

嗯,就是这个意思  发表于 2012-8-25 12:34
不太懂你的意识 你是说,在别的工程里面,用那个脚本。自己导入素材就可以 而你现在运行的工程,用那个脚本就不行了, 是这个意识吗?  发表于 2012-8-25 11:06
我试了下其他的素材,也可以的啊,但就我那个工程的不行  发表于 2012-8-25 10:57
恭喜你,说对了,这种问题经常会还出现啥窗口或合成系统、怪物图签的脚本上出现。  发表于 2012-8-25 02:37
那我明天再仔细看看脚本,反正应该跟数据库里的数据有关系。反正谢谢了  发表于 2012-8-24 00:43
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
60
在线时间
20 小时
注册时间
2012-8-24
帖子
7
7
发表于 2012-8-24 17:54:22 | 只看该作者
什么意思是啊?

评分

参与人数 1星屑 -20 收起 理由
hcm -20 完全不知道说的和问题有什么关系.

查看全部评分

回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
76 小时
注册时间
2012-7-4
帖子
120
8
发表于 2012-8-25 11:08:10 | 只看该作者
黄威华 发表于 2012-8-23 21:52
我觉得是那个脚步里面的问题
别人编写的时候,只是把默认的那些素材编了进去,
所以你自己的素材就不行

那就有可能是你有其他的什么脚步有冲突 了
大概是这样把!


‘‘──黄威华于2012-8-25 11:08补充以下内容:

那就有可能是你有其他的什么脚步有冲突 了
大概是这样把!
’’

点评

那就不知道了,  发表于 2012-8-25 15:39
没有,我重新创了个工程,加的脚本一个个添了测试,都没问题  发表于 2012-8-25 12:24
回复

使用道具 举报

Lv3.寻梦者

双子人

梦石
0
星屑
3165
在线时间
3616 小时
注册时间
2009-4-4
帖子
4154

开拓者

9
发表于 2012-8-25 12:06:10 | 只看该作者
  1. #================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  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. CHARA_INFO[1] = "怪物介绍1"
  23. CHARA_INFO[2] = "怪物介绍2"
  24. CHARA_INFO[3] = "生活在潮湿的沼泽地区的变异生物,性情凶暴,经常会袭击各种路过的生物"
  25. #没有信息测试,4号怪物
  26. #=============
  27. #雷达图相关处理部分
  28. #=============
  29. class Bitmap
  30. def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
  31. distance = (start_x - end_x).abs + (start_y - end_y).abs
  32. if end_color == start_color
  33. for i in 1..distance
  34. x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  35. y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  36. if width == 1
  37. self.set_pixel(x, y, start_color)
  38. else
  39. self.fill_rect(x, y, width, width, start_color)
  40. end
  41. end
  42. else
  43. for i in 1..distance
  44. x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  45. y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  46. r = start_color.red * (distance-i)/distance + end_color.red * i/distance
  47. g = start_color.green * (distance-i)/distance + end_color.green * i/distance
  48. b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance
  49. a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
  50. if width == 1
  51. self.set_pixel(x, y, Color.new(r, g, b, a))
  52. else
  53. self.fill_rect(x, y, width, width, Color.new(r, g, b, a))
  54. end
  55. end
  56. end
  57. end
  58. end
  59. #=============
  60. # Graphic_Def_Elem
  61. #=============
  62. class Window_Base
  63. FONT_SIZE = 18
  64. WORD_ELEMENT_GUARD = "属性有效度"
  65. NUMBER_OF_ELEMENTS = 8
  66. ELEMENT_ORDER = [1,3,8,5,2,4,7,6]
  67. GRAPH_SCALINE_COLOR = Color.new(255, 255, 255, 128)
  68. GRAPH_SCALINE_COLOR_SHADOW = Color.new( 0, 0, 0, 192)
  69. GRAPH_LINE_COLOR = Color.new(255, 255, 64, 255)
  70. GRAPH_LINE_COLOR_MINUS = Color.new( 64, 255, 255, 255)
  71. GRAPH_LINE_COLOR_PLUS = Color.new(255, 64, 64, 255)
  72. end

  73. #——————————————————————————————————————
  74. module Enemy_Book_Config
  75. DROP_ITEM_NEED_ANALYZE = true #显示物品
  76. EVA_NAME = "回避修正"              #回避修正的名称(因为数据库中没有定义)
  77. SHOW_COMPLETE_TYPE = 3         #图鉴完成率表示方法
  78. end
  79. class Data_MonsterBook
  80. #--------------------------------------------------------------------------
  81. # ● 图鉴用ID設定
  82. #--------------------------------------------------------------------------
  83. def enemy_book_id_set
  84.    data = [0]
  85.    data[1] = 2
  86.    data[2] = 1
  87.    data[3] = 15
  88.    data[4] = 25
  89.    data[5] = 18
  90.    data[6] = 30
  91.    return data
  92. end
  93. end
  94. class Game_Temp
  95. attr_accessor :enemy_book_data
  96. alias temp_enemy_book_data_initialize initialize
  97. def initialize
  98.    temp_enemy_book_data_initialize
  99.    @enemy_book_data = Data_MonsterBook.new
  100. end
  101. end

  102. class Game_Party
  103. #==============================================
  104. #--------------------------------------------------------------------------
  105.   # ● 公開インスタンス変数
  106.   #--------------------------------------------------------------------------
  107.   attr_reader   :actors                   # アクター
  108.   attr_reader   :gold                     # ゴールド
  109.   attr_reader   :steps                    # 歩数
  110.   attr_accessor :mission                  # 任务★★★★★★★★★★★★★
  111.   attr_accessor   :pr                  # 当前章节数★★★★★★★★★★★★★
  112.   attr_reader   :prname
  113.   #--------------------------------------------------------------------------
  114.   # ● オブジェクト初期化
  115.   #--------------------------------------------------------------------------
  116.   def initialize
  117.     # アクターの配列を作成
  118.     @actors = []
  119.     # ゴールドと歩数を初期化
  120.     @gold = 0
  121.     @steps = 0
  122.     # アイテム、武器、防具の所持数ハッシュを作成
  123.     @items = {}
  124.     @weapons = {}
  125.     @armors = {}
  126.   end
  127. #==============================================
  128. attr_accessor :enemy_info               # 出会った敵情報(図鑑用)

  129. #--------------------------------------------------------------------------
  130. # ● オブジェクト初期化
  131. #--------------------------------------------------------------------------
  132. alias book_info_initialize initialize
  133. def initialize
  134.    book_info_initialize
  135.    @enemy_info = {}
  136. end

  137. #--------------------------------------------------------------------------
  138. # ● エネミー情報の追加(図鑑用)
  139. #     type : 通常遭遇かアナライズか 0:通常 1:アナライズ -1:情報削除
  140. #     0:無遭遇 1:遭遇済 2:アナライズ済
  141. #--------------------------------------------------------------------------
  142. def add_enemy_info(enemy_id, type = 0)
  143.    case type
  144.    when 0
  145.      if @enemy_info[enemy_id] == 2
  146.        return false
  147.      end
  148.      @enemy_info[enemy_id] = 1
  149.    when 1
  150.      @enemy_info[enemy_id] = 2
  151.    when -1
  152.      @enemy_info[enemy_id] = 0
  153.    end
  154. end
  155. #--------------------------------------------------------------------------
  156. # ● 魔物図鑑の最大登録数を取得
  157. #--------------------------------------------------------------------------
  158. def enemy_book_max
  159.    return $game_temp.enemy_book_data.id_data.size - 1
  160. end
  161. #--------------------------------------------------------------------------
  162. # ● 魔物図鑑の現在登録数を取得
  163. #--------------------------------------------------------------------------
  164. def enemy_book_now
  165.    now_enemy_info = @enemy_info.keys
  166.    # 登録無視の属性IDを取得
  167.    no_add = $game_temp.enemy_book_data.no_add_element
  168.    new_enemy_info = []
  169.    for i in now_enemy_info
  170.      enemy = $data_enemies
  171.      next if enemy.name == ""
  172.      if enemy.element_ranks[no_add] == 1
  173.        next
  174.      end
  175.      new_enemy_info.push(enemy.id)
  176.    end
  177.    return new_enemy_info.size
  178. end
  179. #--------------------------------------------------------------------------
  180. # ● 魔物図鑑の完成率を取得
  181. #--------------------------------------------------------------------------
  182. def enemy_book_complete_percentage
  183.    e_max = enemy_book_max.to_f
  184.    e_now = enemy_book_now.to_f
  185.    comp = e_now / e_max * 100
  186.    return comp.truncate
  187. end
  188. end

  189. class Interpreter
  190. def enemy_book_max
  191.    return $game_party.enemy_book_max
  192. end
  193. def enemy_book_now
  194.    return $game_party.enemy_book_now
  195. end
  196. def enemy_book_comp
  197.    return $game_party.enemy_book_complete_percentage
  198. end
  199. end

  200. class Scene_Battle
  201. alias add_enemy_info_start_phase5 start_phase5
  202. def start_phase5
  203.    for enemy in $game_troop.enemies
  204.      # エネミーが隠れ状態でない場合
  205.      unless enemy.hidden
  206.        # 敵遭遇情報追加
  207.        $game_party.add_enemy_info(enemy.id, 0)
  208.      end
  209.    end
  210.    add_enemy_info_start_phase5
  211. end
  212. end

  213. class Window_Base < Window
  214. #--------------------------------------------------------------------------
  215. # ● エネミーの戦闘後獲得アイテムの描画
  216. #--------------------------------------------------------------------------
  217. def draw_enemy_drop_item(enemy, x, y)
  218.    self.contents.font.color = normal_color
  219.    treasures = []
  220.    if enemy.item_id > 0
  221.      treasures.push($data_items[enemy.item_id])
  222.    end
  223.    if enemy.weapon_id > 0
  224.      treasures.push($data_weapons[enemy.weapon_id])
  225.    end
  226.    if enemy.armor_id > 0
  227.      treasures.push($data_armors[enemy.armor_id])
  228.    end
  229.    # 現状ではとりあえず1つのみ描画
  230.    if treasures.size > 0
  231.      item = treasures[0]
  232.      bitmap = RPG::Cache.icon(item.icon_name)
  233.      opacity = 255
  234.      self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  235.      name = treasures[0].name
  236.    else
  237.      self.contents.font.color = disabled_color
  238.      name = "无"
  239.    end
  240.    self.contents.draw_text(x+28, y, 212, 32, name)
  241. end
  242. #--------------------------------------------------------------------------
  243. # ● エネミーの図鑑IDの描画
  244. #--------------------------------------------------------------------------
  245. def draw_enemy_book_id(enemy, x, y)
  246.    self.contents.font.color = normal_color
  247.    id = $game_temp.enemy_book_data.id_data.index(enemy.id)
  248.    self.contents.draw_text(x, y, 32, 32, id.to_s)
  249. end
  250. #--------------------------------------------------------------------------
  251. # ● 敌人简介描绘
  252. #--------------------------------------------------------------------------
  253. def draw_enemy_other(enemy, x, y)
  254.    if CHARA_INFO[enemy.id]==nil
  255.     CHARA_INFO[enemy.id] = "没有相关资料"
  256.   end
  257.    self.contents.font.size=16
  258.    x+=self.contents.text_size("").width
  259.    info = CHARA_INFO[enemy.id]
  260.    s=info.scan(/./)
  261.     #一行显示21个字
  262.     for i in s
  263.       sss = self.contents.text_size(i)
  264.       
  265.       if  i==" "
  266.         y+=16
  267.         x=0
  268.       elsif (x+sss.width)>(width - 32-260)
  269.         y+=16
  270.         x=0
  271.         self.contents.draw_text(x, y, sss.width, sss.height, i)
  272.         x+=sss.width
  273.       else
  274.       self.contents.draw_text(x, y, sss.width, sss.height, i)
  275.       x+=sss.width
  276.       end
  277.     end
  278.   end
  279.    #--------------------------------------------------------------------------
  280. # ● 敌人特技描绘
  281. #--------------------------------------------------------------------------
  282. def draw_enemy_action(enemy, x, y)
  283.    self.contents.font.size=16
  284.    yy=y
  285.    self.contents.font.color = system_color
  286.    self.contents.draw_text(x, yy, 80, 18,"行动列表")
  287.    self.contents.font.color = normal_color
  288.    for action in enemy.actions
  289.      yy+=18
  290.      if action.kind==0
  291.        case action.basic
  292.         when 0
  293.           ac="普通攻击"
  294.         when 1
  295.           ac="防御"
  296.         when 2
  297.           ac="逃跑"
  298.         when 3
  299.           ac="无"
  300.         end
  301.      self.contents.draw_text(x, yy, 160, 18, ac )
  302.      end
  303.      if action.kind==1
  304.      self.contents.draw_text(x, yy, 160, 18, $data_skills[action.skill_id].name )
  305.      end
  306.    end
  307. end
  308. #雷达图描绘
  309.   #===================================================================
  310.   def draw_actor_element_radar_graph(actor, x, y)
  311.     radius = 56
  312. cx = x + radius + FONT_SIZE + 48
  313. cy = y + radius + FONT_SIZE + 32
  314. self.contents.font.color = system_color
  315. self.contents.draw_text(x, y, 104, 32, WORD_ELEMENT_GUARD)
  316. for loop_i in 0..NUMBER_OF_ELEMENTS
  317. if loop_i == 0

  318. else
  319. @pre_x = @now_x
  320. @pre_y = @now_y
  321. @pre_ex = @now_ex
  322. @pre_ey = @now_ey
  323. @color1 = @color2
  324. end
  325. if loop_i == NUMBER_OF_ELEMENTS
  326. eo = ELEMENT_ORDER[0]
  327. else
  328. eo = ELEMENT_ORDER[loop_i]
  329. end
  330. er = actor.element_rate(eo)
  331. estr = $data_system.elements[eo]
  332. @color2 = er < 0 ? GRAPH_LINE_COLOR_MINUS : er > 100 ? GRAPH_LINE_COLOR_PLUS : GRAPH_LINE_COLOR
  333. if er <0
  334.   then xsh=true
  335. else xsh=false
  336. end
  337. er = er.abs
  338. th = Math::PI * (0.5 - 2.0 * loop_i / NUMBER_OF_ELEMENTS)
  339. @now_x = cx + (radius * Math.cos(th)).floor
  340. @now_y = cy - (radius * Math.sin(th)).floor
  341. @now_wx = cx + ((radius+FONT_SIZE*2/2) * Math.cos(th)).floor - FONT_SIZE
  342. @now_wy = cy - ((radius+FONT_SIZE*1/2) * Math.sin(th)).floor - FONT_SIZE/2
  343. @now_vx = cx + ((radius+FONT_SIZE*6/2) * Math.cos(th)).floor - FONT_SIZE
  344. @now_vy = cy - ((radius+FONT_SIZE*3/2) * Math.sin(th)).floor - FONT_SIZE/2
  345. @now_ex = cx + (er*radius/100 * Math.cos(th)).floor
  346. @now_ey = cy - (er*radius/100 * Math.sin(th)).floor
  347. if loop_i == 0
  348. @pre_x = @now_x
  349. @pre_y = @now_y
  350. @pre_ex = @now_ex
  351. @pre_ey = @now_ey
  352. @color1 = @color2
  353. else

  354. end
  355. next if loop_i == 0
  356. self.contents.draw_line(cx+1,cy+1, @now_x+1,@now_y+1, GRAPH_SCALINE_COLOR_SHADOW)
  357. self.contents.draw_line(@pre_x+1,@pre_y+1, @now_x+1,@now_y+1, GRAPH_SCALINE_COLOR_SHADOW)
  358. self.contents.draw_line(cx,cy, @now_x,@now_y, GRAPH_SCALINE_COLOR)
  359. self.contents.draw_line(@pre_x,@pre_y, @now_x,@now_y, GRAPH_SCALINE_COLOR)
  360. self.contents.draw_line(@pre_ex,@pre_ey, @now_ex,@now_ey, @color1, 2, @color2)
  361. self.contents.font.size = FONT_SIZE
  362. if xsh == true
  363.   then self.contents.font.color = Color.new(100,255,128,128)
  364.   sdd="-"
  365. else self.contents.font.color = system_color
  366.   sdd=""
  367. end
  368. self.contents.draw_text(@now_wx,@now_wy, FONT_SIZE*2, FONT_SIZE, estr, 1)
  369. self.contents.font.color = Color.new(255,255,255,128)
  370. self.contents.draw_text(@now_vx,@now_vy, FONT_SIZE*2, FONT_SIZE, sdd+er.to_s + "%", 2)
  371. end
  372. end
  373. #_----------------------------------------------
  374. def draw_race(enemy,x,y)
  375.       text="无"
  376.       text2="无"
  377.       for i in 1..8
  378.         if enemy.element_rate(i) == 200
  379.         text = $data_system.elements
  380.         end
  381.         if enemy.element_rate(i) == 150
  382.         text2 =$data_system.elements
  383.         end
  384.       end
  385.       self.contents.font.color = system_color
  386.       self.contents.draw_text(x, y, 80, 32,"主要种族")
  387.       self.contents.font.color = normal_color
  388.       self.contents.draw_text(x+80, y, 76, 32,text,2)
  389.       self.contents.font.color = system_color
  390.       self.contents.draw_text(x+160, y, 80, 32,"次要种族")
  391.       self.contents.font.color = normal_color
  392.       self.contents.draw_text(x+80+160, y, 76, 32,text2,2)
  393. end
  394.   
  395. #--------------------------------------------------------------------------
  396. # ● エネミーの名前の描画
  397. #     enemy : エネミー
  398. #     x     : 描画先 X 座標
  399. #     y     : 描画先 Y 座標
  400. #--------------------------------------------------------------------------
  401. def draw_enemy_name(enemy, x, y)
  402.    self.contents.font.color = normal_color
  403.    self.contents.draw_text(x, y, 152, 32, enemy.name)
  404. end
  405. #--------------------------------------------------------------------------
  406. # ● エネミーグラフィックの描画(アナライズ)
  407. #     enemy : エネミー
  408. #     x     : 描画先 X 座標
  409. #     y     : 描画先 Y 座標
  410. #--------------------------------------------------------------------------
  411. def draw_enemy_graphic(enemy, x, y, opacity = 255)

  412. end
  413. #--------------------------------------------------------------------------
  414. # ● エネミーの獲得EXPの描画
  415. #     enemy : エネミー
  416. #     x     : 描画先 X 座標
  417. #     y     : 描画先 Y 座標
  418. #--------------------------------------------------------------------------
  419. def draw_enemy_exp(enemy, x, y)
  420.    self.contents.font.color = system_color
  421.    self.contents.draw_text(x, y, 120, 32, "EXP")
  422.    self.contents.font.color = normal_color
  423.    self.contents.draw_text(x + 120, y, 36, 32, enemy.exp.to_s, 2)
  424. end
  425. #--------------------------------------------------------------------------
  426. # ● エネミーの獲得GOLDの描画
  427. #     enemy : エネミー
  428. #     x     : 描画先 X 座標
  429. #     y     : 描画先 Y 座標
  430. #--------------------------------------------------------------------------
  431. def draw_enemy_gold(enemy, x, y)
  432.    self.contents.font.color = system_color
  433.    self.contents.draw_text(x, y, 120, 32, "掉落金钱")
  434.    self.contents.font.color = normal_color
  435.    self.contents.draw_text(x + 120, y, 36, 32, enemy.gold.to_s, 2)
  436. end
  437. end

  438. class Game_Enemy_Book #< Game_Enemy
  439. #--------------------------------------------------------------------------
  440. # ● オブジェクト初期化
  441. #--------------------------------------------------------------------------
  442. def initialize(enemy_id)
  443.    super(2, 1)#ダミー
  444.    @enemy_id = enemy_id
  445.    enemy = $data_enemies[@enemy_id]
  446.    @battler_name = enemy.battler_name
  447.    @battler_hue = enemy.battler_hue
  448.    @hp = enemy.maxhp
  449.    @sp = enemy.maxsp
  450. end
  451. end

  452. class Data_MonsterBook
  453. attr_reader :id_data
  454. #--------------------------------------------------------------------------
  455. # ● オブジェクト初期化
  456. #--------------------------------------------------------------------------
  457. def initialize
  458.    @id_data = enemy_book_id_set
  459. end
  460. #--------------------------------------------------------------------------
  461. # ● 図鑑用登録無視属性取得
  462. #--------------------------------------------------------------------------
  463. def no_add_element
  464.    no_add = 0
  465.    # 登録無視の属性IDを取得
  466.    for i in 1...$data_system.elements.size
  467.      if $data_system.elements =~ /不加入图鉴/
  468.        no_add = i
  469.        break
  470.      end
  471.    end
  472.    return no_add
  473. end
  474. #--------------------------------------------------------------------------
  475. # ● 図鑑用敵ID設定
  476. #--------------------------------------------------------------------------
  477. def enemy_book_id_set
  478.    data = [0]
  479.    no_add = no_add_element
  480.    # 登録無視の属性IDを取得
  481.    for i in 1...$data_enemies.size
  482.      enemy = $data_enemies
  483.      next if enemy.name == ""
  484.      if enemy.element_ranks[no_add] == 1
  485.        next
  486.      end
  487.      data.push(enemy.id)
  488.    end
  489.    return data
  490. end
  491. end


  492. class Window_MonsterBook < Window_Selectable
  493. attr_reader   :data
  494. #--------------------------------------------------------------------------
  495. # ● オブジェクト初期化
  496. #--------------------------------------------------------------------------
  497. def initialize(index=0)
  498.    super(0, 64, 640, 416)
  499.    @column_max = 2
  500.    @book_data = $game_temp.enemy_book_data
  501.    @data = @book_data.id_data.dup
  502.    @data.shift
  503.    #@data.sort!
  504.    @item_max = @data.size
  505.    self.index = 0
  506.    refresh if @item_max > 0
  507. end
  508. #--------------------------------------------------------------------------
  509. # ● 遭遇データを取得
  510. #--------------------------------------------------------------------------
  511. def data_set
  512.    data = $game_party.enemy_info.keys
  513.    data.sort!
  514.    newdata = []
  515.    for i in data
  516.      next if $game_party.enemy_info == 0
  517.      # 図鑑登録無視を考慮
  518.      if book_id(i) != nil
  519.        newdata.push(i)
  520.      end
  521.    end
  522.    return newdata
  523. end
  524. #--------------------------------------------------------------------------
  525. # ● 表示許可取得
  526. #--------------------------------------------------------------------------
  527. def show?(id)
  528.    if $game_party.enemy_info[id] == 0 or $game_party.enemy_info[id] == nil
  529.      return false
  530.    else
  531.      return true
  532.    end
  533. end
  534. #--------------------------------------------------------------------------
  535. # ● 図鑑用ID取得
  536. #--------------------------------------------------------------------------
  537. def book_id(id)
  538.    return @book_data.index(id)
  539. end
  540. #--------------------------------------------------------------------------
  541. # ● エネミー取得
  542. #--------------------------------------------------------------------------
  543. def item
  544.    return @data[self.index]
  545. end
  546. #--------------------------------------------------------------------------
  547. # ● リフレッシュ
  548. #--------------------------------------------------------------------------
  549. def refresh
  550.    if self.contents != nil
  551.      self.contents.dispose
  552.      self.contents = nil
  553.    end
  554.    self.contents = Bitmap.new(width - 32, row_max * 32)
  555.    #項目数が 0 でなければビットマップを作成し、全項目を描画
  556.    if @item_max > 0
  557.      for i in 0...@item_max
  558.       draw_item(i)
  559.      end
  560.    end
  561. end
  562. #--------------------------------------------------------------------------
  563. # ● 項目の描画
  564. #     index : 項目番号
  565. #--------------------------------------------------------------------------
  566. def draw_item(index)
  567.    enemy = $data_enemies[@data[index]]
  568.    return if enemy == nil
  569.    x = 4 + index % 2 * (288 + 32)
  570.    y = index / 2 * 32
  571.    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  572.    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  573.    self.contents.font.color = normal_color
  574.    draw_enemy_book_id(enemy, x, y)
  575.    if show?(enemy.id)
  576.      self.contents.draw_text(x + 28+16, y, 212, 32, enemy.name, 0)
  577.    else
  578.      self.contents.draw_text(x + 28+16, y, 212, 32, "-----", 0)
  579.      return
  580.    end
  581.    if analyze?(@data[index])
  582.      self.contents.font.color = text_color(3)
  583.      self.contents.draw_text(x + 256, y, 24, 32, "済", 2)
  584.    end
  585. end
  586. #--------------------------------------------------------------------------
  587. # ● アナライズ済かどうか
  588. #--------------------------------------------------------------------------
  589. def analyze?(enemy_id)
  590.    if $game_party.enemy_info[enemy_id] == 2
  591.      return true
  592.    else
  593.      return false
  594.    end
  595. end
  596. end


  597. class Window_MonsterBook_Info < Window_Base
  598. include Enemy_Book_Config
  599. #--------------------------------------------------------------------------
  600. # ● オブジェクト初期化
  601. #--------------------------------------------------------------------------
  602. def initialize
  603.    super(0, 0+64, 640, 480-64)
  604.    self.back_opacity=255
  605.    self.contents = Bitmap.new(width - 32, height - 32)
  606.    
  607. end
  608. #--------------------------------------------------------------------------
  609. # ● リフレッシュ
  610. #--------------------------------------------------------------------------
  611. def refresh(enemy_id)
  612.    self.contents.clear
  613.    self.contents.font.size = 22
  614.    enemy = Game_Enemy_Book.new(enemy_id)
  615.    @gra = Sprite_Enemy_Graphic.new(nil,enemy)
  616.    @gra.z = 120      #怪物图片
  617.    draw_enemy_book_id(enemy, 4, 0)    #各种详细信息
  618.    draw_enemy_name(enemy, 48, 0)
  619.    draw_actor_hp(enemy, 288, 0)
  620.    draw_actor_sp(enemy, 288+160, 0)
  621.    self.contents.font.size=18
  622.    draw_actor_parameter(enemy, 288    ,  25, 0)
  623.    self.contents.font.color = system_color
  624.    self.contents.draw_text(288+160, 25, 120, 32, EVA_NAME)
  625.    self.contents.font.color = normal_color
  626.    self.contents.draw_text(288+160 + 120, 25, 36, 32, enemy.eva.to_s, 2)
  627.    draw_actor_parameter(enemy, 288    ,  50, 3)
  628.    draw_actor_parameter(enemy, 288+160,  50, 4)
  629.    draw_actor_parameter(enemy, 288    ,  75, 5)
  630.    draw_actor_parameter(enemy, 288+160,  75, 6)
  631.    draw_actor_parameter(enemy, 288    , 100, 1)
  632.    draw_actor_parameter(enemy, 288+160, 100, 2)
  633.    draw_enemy_exp(enemy, 288, 125)
  634.    draw_enemy_gold(enemy, 288+160, 125)
  635.    draw_race(enemy, 288, 150)
  636.    #--------------------------------------------------------------------
  637.    draw_enemy_other(enemy, 0, 280)  #简介文字
  638.    draw_enemy_action(enemy,200, 30)  #显示敌人行动
  639.    draw_actor_element_radar_graph(enemy, 360, 180)#雷达图
  640.    #--------------------------------------------------------------------
  641.    if DROP_ITEM_NEED_ANALYZE==true  #掉落物品
  642.      self.contents.font.color = system_color
  643.         self.contents.font.size=16
  644.      self.contents.draw_text(0, 235, 96, 32, "掉落物品")
  645.      draw_enemy_drop_item(enemy, 128, 235)
  646.      self.contents.font.color = normal_color
  647.         self.contents.font.size=18
  648.       end      
  649.     end
  650. def cl
  651.        @gra.dispose
  652. end
  653. #--------------------------------------------------------------------------
  654. # ● アナライズ済かどうか
  655. #--------------------------------------------------------------------------
  656. def analyze?(enemy_id)
  657.    if $game_party.enemy_info[enemy_id] == 2
  658.      return true
  659.    else
  660.      return false
  661.    end
  662. end
  663. end


  664. class Scene_MonsterBook
  665. include Enemy_Book_Config
  666. #--------------------------------------------------------------------------
  667. # ● メイン処理
  668. #--------------------------------------------------------------------------
  669. def main
  670.    $game_temp.enemy_book_data = Data_MonsterBook.new
  671.    # ウィンドウを作成
  672.    @title_window = Window_Base.new(0, 0, 640, 64)
  673.    @title_window.contents = Bitmap.new(640 - 32, 64 - 32)
  674.    @title_window.contents.draw_text(4, 0, 320, 32, "魔物图鉴", 0)
  675.    if SHOW_COMPLETE_TYPE != 0
  676.      case SHOW_COMPLETE_TYPE
  677.      when 1
  678.        e_now = $game_party.enemy_book_now
  679.        e_max = $game_party.enemy_book_max
  680.        text = e_now.to_s + "/" + e_max.to_s
  681.      when 2
  682.        comp = $game_party.enemy_book_complete_percentage
  683.        text = comp.to_s + "%"
  684.      when 3
  685.        e_now = $game_party.enemy_book_now
  686.        e_max = $game_party.enemy_book_max
  687.        comp = $game_party.enemy_book_complete_percentage
  688.        text = e_now.to_s + "/" + e_max.to_s + " " + comp.to_s + "%"
  689.      end
  690.      if text != nil
  691.        @title_window.contents.draw_text(320, 0, 288, 32,  text, 2)
  692.      end
  693.    end
  694.    @main_window = Window_MonsterBook.new
  695.    @main_window.active = true
  696.    # インフォウィンドウを作成 (不可視・非アクティブに設定)
  697.    @info_window = Window_MonsterBook_Info.new
  698.    @info_window.z = 110
  699.    @info_window.visible = false
  700.    @info_window.active = false
  701.    @visible_index = 0
  702.    # トランジション実行
  703.    Graphics.transition
  704.    # メインループ
  705.    loop do
  706.      # ゲーム画面を更新
  707.      Graphics.update
  708.      # 入力情報を更新
  709.      Input.update
  710.      # フレーム更新
  711.      update
  712.      # 画面が切り替わったらループを中断
  713.      if $scene != self
  714.        break
  715.      end
  716.    end
  717.    # トランジション準備
  718.    Graphics.freeze
  719.    # ウィンドウを解放
  720.    @main_window.dispose
  721.    @info_window.dispose
  722.    @title_window.dispose
  723. end
  724. #--------------------------------------------------------------------------
  725. # ● フレーム更新
  726. #--------------------------------------------------------------------------
  727. def update
  728.    # ウィンドウを更新
  729.    @main_window.update
  730.    @info_window.update
  731. #   gra.update
  732.    if @info_window.active
  733.      update_info
  734.      return
  735.    end
  736.    # メインウィンドウがアクティブの場合: update_target を呼ぶ
  737.    if @main_window.active
  738.      update_main
  739.      return
  740.    end
  741. end
  742. #--------------------------------------------------------------------------
  743. # ● フレーム更新 (メインウィンドウがアクティブの場合)
  744. #--------------------------------------------------------------------------
  745. def update_main
  746.    # B ボタンが押された場合
  747.    if Input.trigger?(Input::B)
  748.      # キャンセル SE を演奏
  749.      $game_system.se_play($data_system.cancel_se)
  750.      $scene = Scene_Menu.new(7)
  751.      return
  752.    end
  753.    # C ボタンが押された場合
  754.    if Input.trigger?(Input::C)
  755.      if @main_window.item == nil or @main_window.show?(@main_window.item) == false
  756.        # ブザー SE を演奏
  757.        $game_system.se_play($data_system.buzzer_se)
  758.        return
  759.      end
  760.      # 決定 SE を演奏
  761.      $game_system.se_play($data_system.decision_se)
  762.      @main_window.active = false
  763.      @info_window.active = true
  764.      @info_window.visible = true
  765.      @visible_index = @main_window.index
  766.      @info_window.refresh(@main_window.item)
  767.      return
  768.    end
  769. end
  770. #--------------------------------------------------------------------------
  771. # ● フレーム更新 (インフォウィンドウがアクティブの場合)
  772. #--------------------------------------------------------------------------
  773. def update_info
  774.    # B ボタンが押された場合
  775.    if Input.trigger?(Input::B)
  776.      # キャンセル SE を演奏
  777.      $game_system.se_play($data_system.cancel_se)
  778.      @main_window.active = true
  779.      @info_window.active = false
  780.      @info_window.visible = false
  781.      @info_window.cl
  782.      return
  783.    end
  784.    # C ボタンが押された場合
  785.    if Input.trigger?(Input::C)
  786.      # 決定 SE を演奏
  787.      #$game_system.se_play($data_system.decision_se)
  788.      return
  789.    end
  790.    if Input.trigger?(Input::L)
  791.      # 決定 SE を演奏
  792.      $game_system.se_play($data_system.decision_se)
  793.      loop_end = false
  794.      while loop_end == false
  795.        if @visible_index != 0
  796.          @visible_index -= 1
  797.        else
  798.          @visible_index = @main_window.data.size - 1
  799.        end
  800.        loop_end = true if @main_window.show?(@main_window.data[@visible_index])
  801.      end
  802.      id = @main_window.data[@visible_index]
  803.      @info_window.refresh(id)
  804.      return
  805.    end
  806.    if Input.trigger?(Input::R)
  807.      # 決定 SE を演奏
  808.      $game_system.se_play($data_system.decision_se)
  809.      loop_end = false
  810.      while loop_end == false
  811.        if @visible_index != @main_window.data.size - 1
  812.          @visible_index += 1
  813.        else
  814.          @visible_index = 0
  815.        end
  816.        loop_end = true if @main_window.show?(@main_window.data[@visible_index])
  817.      end
  818.      id = @main_window.data[@visible_index]
  819.      @info_window.refresh(id)
  820.      return
  821.    end
  822. end
  823. end
  824. #==================================================================
  825. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  826. #==================================================================
  827. class Sprite_Enemy_Graphic< Sprite
  828.   attr_accessor :enemy
  829.   #--------------------------------------------------------------------------
  830.   # ● オブジェクト初期化
  831.   #--------------------------------------------------------------------------
  832.   def initialize(viewport,enemy)
  833.     super(viewport)
  834.     if @enemy != enemy
  835.       self.bitmap = RPG::Cache.battler(enemy.battler_name, enemy.battler_hue)
  836.       cw = self.bitmap.width
  837.       ch = self.bitmap.height
  838.     if cw>ch
  839.      self.zoom_x=200.0/cw
  840.      self.zoom_y=200.0/cw
  841.    else
  842.      self.zoom_x=200.0/ch
  843.      self.zoom_y=200.0/ch     
  844.    end
  845.      self.x=10
  846.      self.y=110
  847.       @enemy=enemy
  848.     end
  849.   end
  850.   #--------------------------------------------------------------------------
  851.   # ● 解放
  852.   #--------------------------------------------------------------------------
  853.   def dispose
  854.     if self.bitmap != nil
  855.       self.bitmap.dispose
  856.     end
  857.     super
  858.   end
  859.   #--------------------------------------------------------------------------
  860.   # ● フレーム更新
  861.   #--------------------------------------------------------------------------
  862.   def refresh(enemy)
  863.   end
  864. end
复制代码
我屏蔽掉了两处地方,试试看。
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
112
在线时间
117 小时
注册时间
2012-7-23
帖子
41
10
 楼主| 发表于 2012-8-25 12:33:49 | 只看该作者
hys111111 发表于 2012-8-25 12:06
我屏蔽掉了两处地方,试试看。

这回直接不能运行了,直接跳出这个来了:如图
这又是神马情况?
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-6 12:48

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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