查看: 2000|回复: 2

[已经解决] 关于怪物图鉴和战斗结束动态增加EXP条的问题

[复制链接]
梦石
0
星屑
75
在线时间
129 小时
注册时间
2007-8-29
回帖
25
发表于 2014-5-5 21:21:52 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 旋涡 于 2014-5-6 12:09 编辑

使用了战斗结束动态增加EXP条的脚本后,战斗结束后 怪物图鉴里不会出现新的怪物,求大神指教
[pre lang="ruby" line="1"]#==============================================================================
#  战斗结束动态增加EXP条 v0.1    作者:灯笼菜刀王

#==============================================================================

class Window_BattleResult < Window_Base

  #--------------------------------------------------------------------------

  # ● 初始化对像

  #     exp       : EXP

  #     gold      : 金钱

  #     treasures : 宝物

  #--------------------------------------------------------------------------

  def initialize(exp, gold, treasures)

    @exp = exp

    @gold = gold

    @treasures = treasures

    @expup = []

    @expnow = []

    for i in 0...$game_party.actors.size

     actor = $game_party.actors

     now = actor.now_exp

     max = actor.next_exp

     now = now > max ? max : now

     @expnow = max != 0 ? 98 * now / max.to_f : 0

      now2 = actor.now_exp - @exp

      now2 = now2 > max ? max : now2

     @expup = max != 0 ? 98 * now2 / max.to_f : 0

    end

    super(140, 0, 400, 8 * 32 + 64)

    self.contents = Bitmap.new(width - 32, height - 32)

    self.y = 160 - height / 2

    self.back_opacity = 160

    self.visible = false

    refresh

  end

  #--------------------------------------------------------------------------

  # ● 刷新

  #--------------------------------------------------------------------------

  def refresh

    self.contents.clear

    x = 6

    self.contents.font.color = normal_color

    cx = contents.text_size(@exp.to_s).width

    self.contents.draw_text(x, 0, cx, 32, @exp.to_s)

    x += cx + 4

    self.contents.font.color = system_color

    cx = contents.text_size("EXP").width

    self.contents.draw_text(x, 0, 64, 32, "EXP")

    x += cx + 16

    self.contents.font.color = normal_color

    cx = contents.text_size(@gold.to_s).width

    self.contents.draw_text(x, 0, cx, 32, @gold.to_s)

    x += cx + 4

    self.contents.font.color = system_color

    self.contents.draw_text(x, 0, 128, 32, $data_system.words.gold)

    cx = contents.text_size($data_system.words.gold).width

    self.contents.draw_text(208,0,128,32,"战利品")

    for i in 0...$game_party.actors.size

      actor = $game_party.actors

      draw_actor_graphic(actor, 20, i*60+92)

      draw_actor_name(actor, 34, i*60+42)
      self.contents.fill_rect(26, i*60+76, 100, 8,Color.new(192,192,192,255))

      self.contents.fill_rect(28, i*60+78, 96, 4, Color.new(128,128,128,128))

      now = actor.now_exp - @exp

      max = actor.next_exp

      now = now > max ? max : now

      a = max != 0 ? 78 * now / max.to_f : 0

      self.contents.fill_rect(27, i*60+77, @expup, 6, Color.new(150, 255, 150, 255))

    end

    y = 32

    for item in @treasures

      draw_item_name(item, 180, y)

      y += 32

    end

  end

def update

   for i in 0...$game_party.actors.size

     if @expup < @expnow

       @expup += 1

     end

   end

   refresh

end

end

class Game_Actor < Game_Battler

  def now_exp

   return @exp - @exp_list[@level]

  end

  def next_exp

   return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0

  end

end

class Scene_Battle

  def update

    # 执行战斗事件中的情况下

    if $game_system.battle_interpreter.running?

      # 刷新解释器

      $game_system.battle_interpreter.update

      # 强制行动的战斗者不存在的情况下

      if $game_temp.forcing_battler == nil

        # 执行战斗事件结束的情况下

        unless $game_system.battle_interpreter.running?

          # 继续战斗的情况下、再执行战斗事件的设置

          unless judge

            setup_battle_event

          end

        end

        # 如果不是结束战斗回合的情况下

        if @phase != 5

          # 刷新状态窗口

          @status_window.refresh

        end

      end

    end

    # 系统 (计时器)、刷新画面

    $game_system.update

    $game_screen.update

    # 计时器为 0 的情况下

    if $game_system.timer_working and $game_system.timer == 0

      # 中断战斗

      $game_temp.battle_abort = true

    end

    # 刷新窗口

    @help_window.update

    @party_command_window.update

    @actor_command_window.update

    @status_window.update

    @message_window.update

    #####菜刀王到此一游################

    if @result_window != nil

      @result_window.update

    end

    ###################################

    # 刷新活动块

    @spriteset.update

    # 处理过渡中的情况下

    if $game_temp.transition_processing

      # 清除处理过渡中标志

      $game_temp.transition_processing = false

      # 执行过渡

      if $game_temp.transition_name == ""

        Graphics.transition(20)

      else

        Graphics.transition(40, "Graphics/Transitions/" +

          $game_temp.transition_name)

      end

    end

    # 显示信息窗口中的情况下

    if $game_temp.message_window_showing

      return

    end

    # 显示效果中的情况下

    if @spriteset.effect?

      return

    end

    # 游戏结束的情况下

    if $game_temp.gameover

      # 切换到游戏结束画面

      $scene = Scene_Gameover.new

      return

    end

    # 返回标题画面的情况下

    if $game_temp.to_title

      # 切换到标题画面

      $scene = Scene_Title.new

      return

    end

    # 中断战斗的情况下

    if $game_temp.battle_abort

      # 还原为战斗前的 BGM

      $game_system.bgm_play($game_temp.map_bgm)

      # 战斗结束

      battle_end(1)

      return

    end

    # 等待中的情况下

    if @wait_count > 0

      # 减少等待计数

      @wait_count -= 1

      return

    end

    # 强制行动的角色存在、

    # 并且战斗事件正在执行的情况下

    if $game_temp.forcing_battler == nil and

       $game_system.battle_interpreter.running?

      return

    end

    # 回合分支

    case @phase

    when 1  # 自由战斗回合

      update_phase1

    when 2  # 同伴命令回合

      update_phase2

    when 3  # 角色命令回合

      update_phase3

    when 4  # 主回合

      update_phase4

    when 5  # 战斗结束回合

      update_phase5

    end

  end

  def start_phase5

    # 转移到回合 5

    @phase = 5

    # 演奏战斗结束 ME

    $game_system.me_play($game_system.battle_end_me)

    # 还原为战斗开始前的 BGM

    $game_system.bgm_play($game_temp.map_bgm)

    # 初始化 EXP、金钱、宝物

    exp = 0

    gold = 0

    treasures = []

    # 循环

    for enemy in $game_troop.enemies

      # 敌人不是隐藏状态的情况下

      unless enemy.hidden

        # 获得 EXP、增加金钱

        exp += enemy.exp

        gold += enemy.gold

        # 出现宝物判定

        if rand(100) < enemy.treasure_prob

          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

        end

      end

    end

    # 限制宝物数为 6 个

    treasures = treasures[0..5]

    # 获得 EXP

    for i in 0...$game_party.actors.size

      actor = $game_party.actors

      if actor.cant_get_exp? == false

        last_level = actor.level

        actor.exp += exp

        if actor.level > last_level

          @status_window.level_up(i)

        end

      end

    end

    # 获得金钱

    $game_party.gain_gold(gold)

    # 获得宝物

    for item in treasures

      case item

      when RPG::Item

        $game_party.gain_item(item.id, 1)

      when RPG::Weapon

        $game_party.gain_weapon(item.id, 1)

      when RPG::Armor

        $game_party.gain_armor(item.id, 1)

      end

    end

    # 生成战斗结果窗口

    @result_window = Window_BattleResult.new(exp, gold, treasures)

    ######菜刀王到此一游###############

    @result_window.visible = true

    ###################################

    # 设置等待计数

    @phase5_wait_count = 100

  end

end[/pre]


[pre lang="ruby" line="1"]#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================  
#——————————————————————————————————————
#魔物图鉴
#
#战斗终了时自动添加敌人进入图鉴(class Scene_Battle start_phase5 追加。)
#
#Window_MonsterBook_Info 的 DROP_ITEM_NEED_ANALYZE 为 true  
#则会显示敌人携带的物品,通常为false
#图鉴完成度的表示功能追加
#SHOW_COMPLETE_TYPE 的数值可以设定
#当为1,显示现有个数/总数,当为2,显示完成百分比,当为3,全显示。
#使用方法:$scene = Scene_MonsterBook.new
#特殊敌人ID指定:对于不想加入怪物图鉴的,首先设置一种属性名为“不加入图鉴”
#然后让这个敌人对此属性为A即可。
#——————————————————————————————————————
module Enemy_Book_Config
  DROP_ITEM_NEED_ANALYZE = false #显示物品
  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_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 = "No Item"
    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
  #--------------------------------------------------------------------------
  # ● エネミーの名前の描画
  #     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)
    bitmap = RPG::Cache.battler(enemy.battler_name, enemy.battler_hue)
    cw = bitmap.width
    ch = bitmap.height
    src_rect = Rect.new(0, 0, cw, ch)
    x = x + (cw / 2 - x) if cw / 2 > x
    self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect, opacity)
  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, $data_system.words.gold)
    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

#==============================================================================
# ■ Window_Enemylocal 显示敌人分类的窗口
#==============================================================================
class Window_Enemylocal < Window_Selectable
  attr_accessor :commands
  #--------------------------------------------------------------------------
  # ● 初始化,生成commands窗口
  #--------------------------------------------------------------------------
  def initialize
    super(0, 64, 160, 416)
         self.opacity = 255

   # self.z=999###标记
    @commands = []
    #————————生成commands窗口
    for i in 1...$data_enemies.size
      if $game_party.enemy_info != 0 and $game_party.enemy_info != nil  
        push = true
        for com in @commands
          if com == $data_enemies.local
            push = false
          end
        end
        if push == true
          @commands.push($data_enemies.local)
        end
      end
    end
   
    if @commands == []
      @commands.push("未知区域")
    end      
    @item_max = @commands.size
    self.contents = Bitmap.new(width - 32, @item_max * 32)
    refresh
    self.index = 0
  end
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    for i in 0...@item_max
      draw_item(i, normal_color)
    end
  end
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def draw_item(index, color)
    self.contents.font.color = color
    y = index * 32
    self.contents.draw_text(4, y, 128, 32, @commands[index])
  end
  #--------------------------------------------------------------------------
  # 只描绘原文字
  #--------------------------------------------------------------------------
  #def update_help
   # @help_window.set_text(@commands[self.index])
  #end
end



class Window_MonsterBook < Window_Selectable
  attr_reader   :data
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize(index=0)
    super(160, 64, 480, 416)
    @column_max = 1
    @book_data = $game_temp.enemy_book_data
    @data = @book_data.id_data.dup
    @data.shift  
    @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 @data1[self.index].id
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
   if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data1 = []
  end
  
  ###########3
  def set_item(command)
    refresh
    #enemy = $data_enemies[@data[index]]
    #return if enemy == nil
    for i in 1...$data_enemies.size
      if  $data_enemies.local == command
        enemy = $data_enemies
        @data1.push( $data_enemies)
      end
    end
   
     @item_max = @data1.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 0, row_max * 32)
      self.contents.clear
      for i in 0...$data_enemies.size
        draw_item(i)
      end
    end
  end
  #############
  #--------------------------------------------------------------------------
  # ● 項目の描画
  #     index : 項目番号
  #--------------------------------------------------------------------------
  def draw_item(index)
    enemy = $data_enemies[@data1[index].id]
    return if enemy == nil
    x = 4 + index % 1 * (200 + 32)
    y = index / 1 * 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.contents = Bitmap.new(width - 32, height - 32)
    self.z = 999
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh(enemy_id)
    self.contents.clear
    self.contents.font.size = 22
    enemy = Game_Enemy_Book.new(enemy_id)
    draw_enemy_graphic(enemy, 96, 240+48+64, 200)
    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)
    draw_actor_parameter(enemy, 288    ,  32, 0)
    self.contents.font.color = system_color
    self.contents.draw_text(288+160, 32, 120, 32, EVA_NAME)
    self.contents.font.color = normal_color
    self.contents.draw_text(288+160 + 120, 32, 36, 32, enemy.eva.to_s, 2)
    draw_actor_parameter(enemy, 288    ,  64, 3)
    draw_actor_parameter(enemy, 288+160,  64, 4)
    draw_actor_parameter(enemy, 288    ,  96, 5)
    draw_actor_parameter(enemy, 288+160,  96, 6)
    draw_actor_parameter(enemy, 288    , 128, 1)
    draw_actor_parameter(enemy, 288+160, 128, 2)
    draw_enemy_exp(enemy, 288, 160)
    draw_enemy_gold(enemy, 288+160, 160)
    if analyze?(enemy.id) or !DROP_ITEM_NEED_ANALYZE
      self.contents.draw_text(288, 192, 96, 32, "Drop Item")
      draw_enemy_drop_item(enemy, 288+96+4, 192)
      self.contents.font.color = normal_color
      #draw_element_guard(enemy, 320-32, 160-16+96)
    end
  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
    @itemcommand_window = Window_Enemylocal.new
    @command_index = @itemcommand_window.index
    @main_window = Window_MonsterBook.new
    @itemcommand_window.active = true
    @main_window.active = false
    # インフォウィンドウを作成 (不可視?非アクティブに設定)
    @info_window = Window_MonsterBook_Info.new
    @info_window.z = 110
    @info_window.visible = false
    @info_window.active = false
    @visible_index = 0
    @main_window.set_item(@itemcommand_window.commands[@command_index])
    # トランジション実行
    Graphics.transition
    # メインループ
    loop do
      # ゲーム画面を更新
      Graphics.update
      # 入力情報を更新
      Input.update
      # フレーム更新
      update
      # 画面が切り替わったらループを中断
      if $scene != self
        break
      end
    end
    # トランジション準備
    Graphics.freeze
    # ウィンドウを解放
    @itemcommand_window.dispose
    @main_window.dispose
    @info_window.dispose
    @title_window.dispose
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  def update
    # ウィンドウを更新
    @itemcommand_window.update
    @main_window.update
    @info_window.update
    if @command_index != @itemcommand_window.index
      @command_index = @itemcommand_window.index
      @main_window.set_item(@itemcommand_window.commands[@command_index])
    end
    if @itemcommand_window.active
      update_itemcommand
      return
    end
   # if @main_window.active
    #  update_main
     # return
    #end
    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)
      @main_window.active = false
      @itemcommand_window.active = true
      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_itemcommand
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      #$game_temp.in_item = false#initem
      $scene = Scene_Map.new
      return
    end
    if Input.trigger?(Input::C)
      #$game_temp.in_item = true#initem
      #if @itemlist_window.item_number == 0
       # $game_system.se_play($data_system.buzzer_se)
        #return
      #end
      $game_system.se_play($data_system.decision_se)
      @itemcommand_window.active = false
      @main_window.active = true
      @main_window.index = 0
      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
      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,使用和转载请保留此信息
#==============================================================================[/pre]  
梦石
0
星屑
50
在线时间
439 小时
注册时间
2013-3-2
回帖
657
发表于 2014-5-6 12:26:34 | 显示全部楼层
本帖最后由 guoyq1988 于 2014-5-6 12:28 编辑

在怪物图鉴脚本什么加上这个脚本
另外,楼主自己改了标签,你惨 了
  1. #==============================================================================
  2. # ■ RPG追加定义,使用@符号分类
  3. #==============================================================================
  4. module RPG
  5.   class Enemy
  6.     def name
  7.       name = @name.split(/@/)[0]
  8.       return name != nil ? name : ''
  9.     end
  10.     def local
  11.       local = @name.split(/@/)[1]
  12.       return local != nil ? local : "未知"
  13.     end
  14.   end
  15.   
  16. end
  17. #==============================================================================
  18. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  19. #==============================================================================
复制代码

曾经的美好已不在   吾只能独自回忆
【RMXP共享】50个脚本整合的系统
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部