查看: 92|回复: 0

[转载发布] 物品信息详细显示

[复制链接]
  • TA的每日心情
    开心
    4 天前
  • 签到天数: 37 天

    连续签到: 3 天

    [LV.5]常住居民I

    2028

    主题

    32

    回帖

    7260

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    0
    卡币
    5184
    OK点
    16
    积分
    7260
    发表于 同元一千年八月三日(秋) | 显示全部楼层 |阅读模式
    不知道以前有没有人发过类似的脚本,在论坛这么久,我只看见有VX的类似脚本,没有XP的。
    如果有的话,那就只能说:如有雷同,实属巧合!

    之前发的脚本,由于其他帮助信息窗口被和谐,现已修改。


      ***2.19修改:修改在战斗场景和商店用原版显示窗口,其他时候用以下详细显示窗口。*******
        ***加入个使用对象窗口滑动过渡效果(纯属试验)***


    先给介绍:

      1.   (缺点)该物品信息显示脚本,由于没有不会自动换行,物品设置里所写的备注太多的话,
          显示的字会变小。(话说已经是信息详细显示,完全可以不用写备注,适合懒人)

      2.  物品设置里面未设置的内容,不会显示。

      3.  物品信息显示框会随显示内容的多少改变大小。







       4. 如果显示内容太多,将会显示不完全。



    信息完全显示:




    脚本
    1. #==============================================================================#【物品信息详细显示】#------------------------------------------------------------------------------# ☆  by 芯☆淡茹水#==============================================================================#◆ 使用方法:#             复制该脚本,插入到 Main 前。#==============================================================================class Window_Item < Window_Selectable  #-------------------------------------------------------------------------  def initialize    super(0, 0, 640, 480)    @column_max = 2    refresh    self.index = 0    if $game_temp.in_battle      self.y = 64      self.height = 256      self.back_opacity = 160    end  end  #-------------------------------------------------------------------------  def update_help    if $game_temp.in_battle      @help_window.set_text(self.item == nil ? "" : self.item.description)    else      @help_window.set_xdrs_text(self.item == nil ? "" : self.item.description,@data[index])    end  endend#==============================================================================class Window_ItemHelp < Window_Base  #--------------------------------------------------------------------------  def initialize    super(320, 4, 316, 480)    self.contents = Bitmap.new(width - 32, height - 32)    self.back_opacity = 200    self.z = 999  end  #--------------------------------------------------------------------------  def set_xdrs_text(text, item)    self.contents.clear    x = 4    y = 32    if item != nil      self.contents.font.color = text_color(6)      self.contents.draw_text(4, 0, 212, 32, item.name, 0)    else      self.visible = false    end    self.contents.font.color = normal_color    case item    # 道具    when RPG::Item      ay = y      self.contents.draw_text(x, y , self.width - 32, 32, text)      if item.scope > 0        ay += 38        txt = "效果范围:"         case item.scope        when 1          txt_n = "敌单体"        when 2          txt_n = "敌全体"        when 3          txt_n = "己方单体"        when 4          txt_n = "己方全体"        when 5          txt_n = "己方单体(HP 0)"        when 6          txt_n = "己方全体(HP 0)"        when 7          txt_n = "使用者"        end        self.contents.font.color = system_color        self.contents.draw_text(x, ay, 160, 32, txt,0)        self.contents.font.color = normal_color        self.contents.draw_text(x + 126, ay, 160, 32, txt_n,0)      else        ay += 4      end      if item.recover_hp != 0        ay += 40        txt = $data_system.words.hp        txt += "回复量:"         txt_n = item.recover_hp.to_s         if item.recover_hp > 0          color = text_color(3)        else          color = text_color(2)        end        self.contents.font.color = system_color        self.contents.draw_text(x, ay, 262, 32, txt,0)        self.contents.font.color = color        self.contents.draw_text(x + 186, ay, 160, 32, txt_n,0)      else        ay += 8      end      if item.recover_hp_rate != 0        ay += 32        txt = $data_system.words.hp        txt += "回复率:"         txt_n = item.recover_hp_rate.to_s + "%"        if item.recover_hp_rate > 0          color = text_color(3)        else          color = text_color(2)        end        self.contents.font.color = system_color        self.contents.draw_text(x, ay, 262, 32, txt,0)        self.contents.font.color = color        self.contents.draw_text(x + 186, ay, 160, 32, txt_n,0)      end      if item.recover_sp != 0        ay += 32        txt = $data_system.words.sp        txt += "回复量:"         txt_n = item.recover_sp.to_s        if item.recover_sp > 0          color = text_color(3)        else          color = text_color(2)        end        self.contents.font.color = system_color        self.contents.draw_text(x, ay, 262, 32, txt,0)        self.contents.font.color = color        self.contents.draw_text(x + 186, ay, 160, 32, txt_n,0)      end      if item.recover_sp_rate != 0        ay += 32        txt = $data_system.words.sp        txt += "回复率: "        txt_n = item.recover_sp_rate.to_s + "%"        if item.recover_sp_rate > 0          color = text_color(3)        else          color = text_color(2)        end        self.contents.font.color = system_color        self.contents.draw_text(x, ay, 262, 32, txt,0)        self.contents.font.color = color        self.contents.draw_text(x + 186, ay, 160, 32, txt_n,0)      end      if item.parameter_points  > 0        ay += 40        case item.parameter_type        when 1          txt = "最大 " + $data_system.words.hp        when 2          txt = "最大 " + $data_system.words.sp        when 3          txt = $data_system.words.str        when 4          txt = $data_system.words.dex        when 5          txt = $data_system.words.agi        when 6          txt = $data_system.words.int        end        txt_n = "+ " + item.parameter_points.to_s        self.contents.font.color = system_color        self.contents.draw_text(x, ay, 262, 32, txt,0)        self.contents.font.color = text_color(3)        self.contents.draw_text(x + 116, ay, 160, 32, txt_n,0)      else        ay += 8      end      if item.pdef_f > 0        ay += 32        txt = "对该物品的" + $data_system.words.pdef + ":"        txt_n = item.pdef_f.to_s +  "%"        self.contents.font.color = system_color        self.contents.draw_text(x, ay, 262, 32, txt,0)        self.contents.font.color = normal_color        self.contents.draw_text(x + 236, ay, 262, 32, txt_n,0)      end      if item.mdef_f > 0        ay += 32        txt = "对该物品的" +  $data_system.words.mdef + ":"        txt_n = item.mdef_f.to_s +  "%"        self.contents.font.color = system_color        self.contents.draw_text(x, ay, 262, 32, txt,0)        self.contents.font.color = normal_color        self.contents.draw_text(x + 236, ay, 262, 32, txt_n,0)      end      for i in item.plus_state_set        if i > 0          ay += 32          self.contents.font.color = system_color          self.contents.draw_text(x , ay, 124, 32, "附加状态:",0)          txt = $data_states[i].name          self.contents.font.color = text_color(2)          self.contents.draw_text(x + 126, ay, 182, 32, txt,0)        end      end      for i in item.minus_state_set         if i > 0          ay += 32          self.contents.font.color = system_color          self.contents.draw_text(x , ay, 124, 32, "解除状态:",0)          txt = $data_states[i].name          self.contents.font.color = text_color(3)          self.contents.draw_text(x + 126, ay, 182, 32, txt,0)        end      end      self.height = ay + 64    # 武器    when RPG::Weapon      by = y      self.contents.draw_text(x, by , self.width - 32, 32, text)      if item.atk > 0        by += 38        txt = $data_system.words.atk + ":"        self.contents.font.color = system_color        self.contents.draw_text(x, by, 182, 32, txt,0)        self.contents.font.color = text_color(3)        self.contents.draw_text(x + 126, by, 124, 32, item.atk.to_s,0)      else        by += 4      end      if item.pdef > 0        by += 32        txt = item.pdef.to_s         self.contents.font.color = system_color        self.contents.draw_text(x, by, 182, 32, $data_system.words.pdef + ":",0)        self.contents.font.color = text_color(3)        self.contents.draw_text(x + 126, by, 124, 32, txt,0)      end      if item.mdef > 0        by += 32        txt = item.mdef.to_s         self.contents.font.color = system_color        self.contents.draw_text(x, by, 182, 32, $data_system.words.mdef + ":",0)        self.contents.font.color = text_color(3)        self.contents.draw_text(x + 126, by, 124, 32, txt,0)      end      if item.str_plus != 0        by += 40        if item.str_plus > 0          color = color = text_color(3)          txt = "+" + item.str_plus.to_s        else          color = color = text_color(2)          txt = item.str_plus.to_s        end        self.contents.font.color = system_color        self.contents.draw_text(x, by, 182, 32, $data_system.words.str,0)        self.contents.font.color = color        self.contents.draw_text(x + 126, by, 124, 32, txt,0)      else        by += 8      end      if item.dex_plus != 0        by += 32        if item.dex_plus > 0          color = text_color(3)          txt = "+" + item.dex_plus.to_s        else          color = color = text_color(2)          txt = item.dex_plus.to_s        end        self.contents.font.color = system_color        self.contents.draw_text(x, by, 182, 32, $data_system.words.dex,0)        self.contents.font.color = color        self.contents.draw_text(x + 126, by, 124, 32, txt,0)      end      if item.agi_plus != 0        by += 32        if item.agi_plus > 0          color = color = text_color(3)          txt = "+" + item.agi_plus.to_s        else          color = color = text_color(2)          txt = item.agi_plus.to_s        end        self.contents.font.color = system_color        self.contents.draw_text(x, by, 182, 32, $data_system.words.agi,0)        self.contents.font.color = color        self.contents.draw_text(x + 126, by, 124, 32, txt,0)      end      if item.int_plus != 0        by += 32        if item.int_plus > 0          color = color = text_color(3)          txt = "+" + item.int_plus.to_s        else          color = color = text_color(2)          txt = item.int_plus.to_s        end        self.contents.font.color = system_color        self.contents.draw_text(x, by, 182, 32, $data_system.words.int,0)        self.contents.font.color = color        self.contents.draw_text(x + 126, by, 124, 32, txt,0)      end      for i in item.element_set         if i > 0          by += 32          txt = "附加属性:"          name = $data_system.elements[i]          self.contents.font.color = system_color          self.contents.draw_text(x, by, 182, 32, txt,0)          self.contents.font.color = text_color(3)          self.contents.draw_text(x + 126, by, 124, 32, name,0)        end      end      for i in item.plus_state_set        if i > 0          by += 32          txt = $data_states[i].name          self.contents.font.color = system_color          self.contents.draw_text(x , by, 124, 32, "附加状态:",0)          self.contents.font.color = text_color(2)          self.contents.draw_text(x + 126, by, 182, 32, txt,0)        end      end      for i in item.minus_state_set        if i > 0          by += 32          txt = $data_states[i].name          self.contents.font.color = system_color          self.contents.draw_text(x , by, 124, 32, "解除状态:",0)          self.contents.font.color = text_color(3)          self.contents.draw_text(x + 126, by, 182, 32, txt,0)        end      end      self.height = by + 64    # 防具    when RPG::Armor      cy = y      case item.kind      when 0        name = $data_system.words.armor1      when 1        name = $data_system.words.armor2      when 2        name = $data_system.words.armor3      when 3        name = $data_system.words.armor4      end      txt = "(" + name + ")"      self.contents.font.color = system_color      self.contents.draw_text(x + 162, y - 34, 196, 32, txt,0)      if item.auto_state_id > 0        cy += 36        name = $data_states[item.auto_state_id].name        txt = "【" + name + "】"        self.contents.font.color = text_color(3)        self.contents.draw_text(x - 4, y, 286, 32, txt,0)      end      self.contents.font.color = normal_color      self.contents.draw_text(x, cy , self.width - 32, 32, text)      if item.pdef > 0        cy += 40        txt = item.pdef.to_s        self.contents.font.color = system_color        self.contents.draw_text(x, cy, 182, 32, $data_system.words.pdef + ":",0)        self.contents.font.color = text_color(3)        self.contents.draw_text(x + 126, cy, 124, 32, txt,0)      else        cy += 8      end      if item.mdef > 0        cy += 32        txt = item.mdef.to_s        self.contents.font.color = system_color        self.contents.draw_text(x, cy, 182, 32, $data_system.words.mdef + ":",0)        self.contents.font.color = text_color(3)        self.contents.draw_text(x + 126, cy, 124, 32, txt,0)      end       if item.str_plus != 0        cy += 40        if item.str_plus > 0          color = color = text_color(3)          txt = "+" + item.str_plus.to_s        else          color = color = text_color(2)          txt = item.str_plus.to_s        end        self.contents.font.color = system_color        self.contents.draw_text(x, cy, 182, 32, $data_system.words.str,0)        self.contents.font.color = color        self.contents.draw_text(x + 126, cy, 124, 32, txt,0)      else        cy += 8      end      if item.dex_plus != 0        cy += 32        if item.dex_plus > 0          color = text_color(3)          txt = "+" + item.dex_plus.to_s        else          color = color = text_color(2)          txt = item.dex_plus.to_s        end        self.contents.font.color = system_color        self.contents.draw_text(x, cy, 182, 32, $data_system.words.dex,0)        self.contents.font.color = color        self.contents.draw_text(x + 126, cy, 124, 32, txt,0)      end      if item.agi_plus != 0        cy += 32        if item.agi_plus > 0          color = text_color(3)          txt = "+" + item.agi_plus.to_s        else          color = color = text_color(2)          txt = item.agi_plus.to_s        end        self.contents.font.color = system_color        self.contents.draw_text(x, cy, 182, 32, $data_system.words.agi,0)        self.contents.font.color = color        self.contents.draw_text(x + 126, cy, 124, 32, txt,0)      end      if item.int_plus != 0        cy += 32        if item.int_plus > 0          color = color = text_color(3)          txt = "+" + item.int_plus.to_s        else          color = color = text_color(2)          txt = item.int_plus.to_s        end        self.contents.font.color = system_color        self.contents.draw_text(x, cy, 182, 32, $data_system.words.int,0)        self.contents.font.color = color        self.contents.draw_text(x + 126, cy, 124, 32, txt,0)      end      for i in item.guard_element_set         if i > 0          cy += 32          txt = "属性防御:"          name = $data_system.elements[i]          self.contents.font.color = system_color          self.contents.draw_text(x, cy, 182, 32, txt,0)          self.contents.font.color = text_color(3)          self.contents.draw_text(x + 126, cy, 124, 32, name,0)        end      end      for i in item.guard_state_set        if i > 0          cy += 32          txt = "状态防御:"          name = $data_states[i].name          self.contents.font.color = system_color          self.contents.draw_text(x, cy, 182, 32, txt,0)          self.contents.font.color = text_color(3)          self.contents.draw_text(x + 126, cy, 124, 32, name,0)        end      end      self.height = cy + 64    end    if height > 472      self.height = 472    end  endend#==============================================================================#===============================================================================class Scene_Item  #-------------------------------------------------------------------------  def main    @help_window = Window_ItemHelp.new    @item_window = Window_Item.new    @item_window.help_window = @help_window    @target_window = Window_Target.new    @target_window.visible = false    @target_window.active = false    Graphics.transition    loop do      Graphics.update      Input.update      update      if $scene != self        break      end    end    Graphics.freeze    @help_window.dispose    @item_window.dispose    @target_window.dispose  end  def update_item    @help_window.x = (@item_window.index + 1 ) % 2  * 316 + 4    if Input.trigger?(Input::B)      $game_system.se_play($data_system.cancel_se)      $scene = Scene_Menu.new(0)      return    end    if Input.trigger?(Input::C)      @item = @item_window.item      unless @item.is_a?(RPG::Item)        $game_system.se_play($data_system.buzzer_se)        return      end      unless $game_party.item_can_use?(@item.id)        $game_system.se_play($data_system.buzzer_se)        return      end      $game_system.se_play($data_system.decision_se)      if @item.scope >= 3        if @help_window.x == 320          @help_window.x += 50          for i in 0...2            Graphics.update          end          @help_window.x += 50          for i in 0...2            Graphics.update          end          @help_window.x += 50          for i in 0...2            Graphics.update          end          @help_window.x += 50          for i in 0...2            Graphics.update          end          @help_window.x += 50          for i in 0...2            Graphics.update          end          @help_window.x += 50          for i in 0...2            Graphics.update          end          @help_window.x += 50          @target_window.x = 620          @target_window.visible = true          for i in 0...2            Graphics.update          end          @target_window.x -= 60          for i in 0...2            Graphics.update          end          @target_window.x -= 60          for i in 0...2            Graphics.update          end          @target_window.x -= 60          for i in 0...2            Graphics.update          end          @target_window.x -= 60          for i in 0...2            Graphics.update          end          @target_window.x -= 60        else          @help_window.x -= 50          for i in 0...2            Graphics.update          end          @help_window.x -= 50          for i in 0...2            Graphics.update          end          @help_window.x -= 50          for i in 0...2            Graphics.update          end          @help_window.x -= 50          for i in 0...2            Graphics.update          end          @help_window.x -= 50          for i in 0...2            Graphics.update          end          @help_window.x -= 50          for i in 0...2            Graphics.update          end          @help_window.x -= 50          @target_window.x = -330          @target_window.visible = true          for i in 0...2            Graphics.update          end          @target_window.x += 70          for i in 0...2            Graphics.update          end          @target_window.x += 70          for i in 0...2            Graphics.update          end          @target_window.x += 70          for i in 0...2            Graphics.update          end          @target_window.x += 60          for i in 0...2            Graphics.update          end          @target_window.x += 60        end        @item_window.active = false        @target_window.x = (@item_window.index + 1) % 2 * 304        @target_window.active = true        if @item.scope == 4 || @item.scope == 6          @target_window.index = -1        else          @target_window.index = 0        end      else        if @item.common_event_id > 0          $game_temp.common_event_id = @item.common_event_id          $game_system.se_play(@item.menu_se)          if @item.consumable            $game_party.lose_item(@item.id, 1)            @item_window.draw_item(@item_window.index)          end          $scene = Scene_Map.new          return        end      end      return    end  end  #----------------------------------------------------------------------------  def update_target    if Input.trigger?(Input::B)      $game_system.se_play($data_system.cancel_se)      unless $game_party.item_can_use?(@item.id)        @item_window.refresh      end      if @target_window.x > 260          @target_window.x += 50          for i in 0...2            Graphics.update          end          @target_window.x += 50          for i in 0...2            Graphics.update          end          @target_window.x += 50          for i in 0...2            Graphics.update          end          @target_window.x += 50          for i in 0...2            Graphics.update          end          @target_window.x += 50          for i in 0...2            Graphics.update          end          @target_window.x += 50          for i in 0...2            Graphics.update          end          @target_window.x += 50          @help_window.x = 620          for i in 0...2            Graphics.update          end          @help_window.x -= 60          for i in 0...2            Graphics.update          end          @help_window.x -= 60          for i in 0...2            Graphics.update          end          @help_window.x -= 60          for i in 0...2            Graphics.update          end          @help_window.x -= 60          for i in 0...2            Graphics.update          end          @help_window.x -= 60        else          @target_window.x -= 50          for i in 0...2            Graphics.update          end          @target_window.x -= 50          for i in 0...2            Graphics.update          end          @target_window.x -= 50          for i in 0...2            Graphics.update          end          @target_window.x -= 50          for i in 0...2            Graphics.update          end          @target_window.x -= 50          for i in 0...2            Graphics.update          end          @target_window.x -= 50          for i in 0...2            Graphics.update          end          @target_window.x -= 50          @help_window.x = -330          for i in 0...2            Graphics.update          end          @help_window.x += 70          for i in 0...2            Graphics.update          end          @help_window.x += 70          for i in 0...2            Graphics.update          end          @help_window.x += 70          for i in 0...2            Graphics.update          end          @help_window.x += 60          for i in 0...2            Graphics.update          end          @help_window.x += 60        end      @item_window.active = true      @target_window.visible = false      @target_window.active = false      return    end    if Input.trigger?(Input::C)      if $game_party.item_number(@item.id) == 0        $game_system.se_play($data_system.buzzer_se)        return      end      if @target_window.index == -1        used = false        for i in $game_party.actors          used |= i.item_effect(@item)        end      end      if @target_window.index >= 0        target = $game_party.actors[@target_window.index]        used = target.item_effect(@item)      end      if used        $game_system.se_play(@item.menu_se)        if @item.consumable          $game_party.lose_item(@item.id, 1)          @item_window.draw_item(@item_window.index)        end        @target_window.refresh        if $game_party.all_dead?          $scene = Scene_Gameover.new          return        end        if @item.common_event_id > 0          $game_temp.common_event_id = @item.common_event_id          $scene = Scene_Map.new          return        end      end      unless used        $game_system.se_play($data_system.buzzer_se)      end      return    end  endend#===============================================================================复制代码
    复制代码
    如果有 BUG 或更好的建议,请回复。
                本帖来自P1论坛作者芯☆淡茹水,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址:https://rpg.blue/forum.php?mod=viewthread&tid=284987  若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。

    本帖子中包含更多资源

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

    x
    天天去同能,天天有童年!
    回复 论坛版权

    使用道具 举报

    ahome_bigavatar:guest
    ahome_bigavatar:welcomelogin
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2024-5-14 03:13 , Processed in 0.049369 second(s), 44 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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