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

Project1

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

[已经解决] 关于复杂物品分类脚本与礼物盒脚本

[复制链接]

Lv1.梦旅人

梦石
0
星屑
90
在线时间
186 小时
注册时间
2010-6-24
帖子
111
跳转到指定楼层
1
发表于 2014-1-17 15:16:23 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
8星屑
本帖最后由 fjjghj1 于 2014-1-17 18:18 编辑

小徐 大大发布的http://rpg.blue/forum.php?mod=vi ... 6orderby%3Ddateline  礼品盒脚本 俺想和复杂物品脚本一起使用。
却发现本应该不显示在物品栏里的礼品还是会显示。。
求解决方法。。小白一只。。

下面的是复杂物品分类的脚本。。
#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================

#==============================================================================
# ■ Harts_Window_ItemTitle
#==============================================================================

class Harts_Window_ItemTitle < Window_Base
  def initialize
    super(0, 0, 160, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.clear
    self.contents.font.color = Color.new(79,39,0,255)
    self.contents.draw_text(4, 0, 120, 32, $data_system.words.item, 1)
  end
end

#==============================================================================
# ■ Harts_Window_ItemCommand
#==============================================================================

class Harts_Window_ItemCommand < Window_Selectable
  attr_accessor :commands
  #--------------------------------------------------------------------------
  # ● 初始化,生成commands窗口
  #--------------------------------------------------------------------------
  def initialize
    super(0, 64, 160, 352)
    self.contents = Bitmap.new(width - 32, height - 32)
    @commands = []
    #————————生成commands窗口
    for i in 1...$data_items.size
      if $game_party.item_number(i) > 0
        push = true
        for com in @commands
          if com == $data_items.desc
            push = false
          end
        end
        if push == true
          @commands.push($data_items.desc)
        end
      end
    end
    for i in 1...$data_weapons.size
      if $game_party.weapon_number(i) > 0
        push = true
        for com in @commands
          if com == $data_weapons.desc
            push = false
          end
        end
        if push == true
          @commands.push($data_weapons.desc)
        end
      end
    end
    for i in 1...$data_armors.size
      if $game_party.armor_number(i) > 0
        push = true
        for com in @commands
          if com == $data_armors.desc
            push = false
          end
        end
        if push == true
          @commands.push($data_armors.desc)
        end
      end
    end
    if @commands == []
      @commands.push("普通物品")
    end      
    @item_max = @commands.size
    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.new(79,39,0,255)
    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
#==============================================================================
# ■ Window_Item
#==============================================================================

class Harts_Window_ItemList < Window_Selectable
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def initialize
    super(160, 0, 480, 416)
    refresh
    self.index = 0
  end
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def item
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
  end
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def set_item(command)
    refresh
    for i in 1...$data_items.size
      if $game_party.item_number(i) > 0 and $data_items.desc == command
        @data.push($data_items)
      end
    end
    for i in 1...$data_weapons.size
      if $game_party.weapon_number(i) > 0 and $data_weapons.desc == command
        @data.push($data_weapons)
      end
    end
    for i in 1...$data_armors.size
      if $game_party.armor_number(i) > 0 and $data_armors.desc == command
        @data.push($data_armors)
      end
    end
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 48)
      self.contents.clear
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def item_number
    return @item_max
  end
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    case item
    when RPG::Item
      number = $game_party.item_number(item.id)
    when RPG::Weapon
      number = $game_party.weapon_number(item.id)
    when RPG::Armor
      number = $game_party.armor_number(item.id)
    end
    if item.is_a?(RPG::Item) and
      $game_party.item_can_use?(item.id)
    self.contents.font.color = Color.new(79,39,0,255)
    else
    self.contents.font.color = Color.new(79,39,0,255)
    end
   
    x = 4
    y = index * 32
    bitmap = RPG::Cache.icon(item.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128
    self.contents.blt(x, y + 4, bitmap, Rect.new(7, 11, 32, 32), opacity)
   
    self.contents.draw_text(x + 44, y, 212, 32, item.name, 0)
    self.contents.draw_text(x + 234, y, 16, 32, ":", 1)
    self.contents.draw_text(x + 264, y, 24, 32, number.to_s, 2)
  end
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(self.item == nil ? "" : self.item.description)
  end
end

#==============================================================================
# ■ Harts_Scene_Item
#==============================================================================

class Scene_Item
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def main
    @itemtitle_window = Harts_Window_ItemTitle.new
    @itemcommand_window = Harts_Window_ItemCommand.new
    @command_index = @itemcommand_window.index
    @itemlist_window = Harts_Window_ItemList.new
    @itemlist_window.active = false
    @你2B啊 = Sprite.new
    @你2B啊.bitmap = Bitmap.new("Graphics/Pictures/绵羊")
    @你2B啊.x = 0
    @你2B啊.y =0
    @你2B啊.opacity=255
    @help_window = Window_Help.new
    @help_window.x = 0
    @help_window.y = 404
    @gold_window = Window_Gold.new
    @gold_window.x = 5
    @gold_window.y = 11/2+10
   
    @itemcommand_window.help_window = @help_window
    @itemlist_window.help_window = @help_window

    @target_window = Window_Target1.new
    @target_window.visible = false
    @target_window.active = false
    @itemlist_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
    @itemtitle_window.dispose
    @itemcommand_window.dispose
    @itemlist_window.dispose
    @help_window.dispose
    @target_window.dispose
    @gold_window.dispose
    @你2B啊.dispose
  end
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def update
    @itemtitle_window.update
    @itemcommand_window.update
    @itemlist_window.update
    @help_window.update
    @target_window.update
    if @command_index != @itemcommand_window.index
      @command_index = @itemcommand_window.index
      @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
    end
    if @itemcommand_window.active
      update_itemcommand
      return
    end
    if @itemlist_window.active
      update_itemlist
      return
    end
    if @target_window.active
      update_target
      return
    end
  end
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def update_itemcommand
    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)
      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
      @itemlist_window.active = true
      @itemlist_window.index = 0
      return
    end
  end
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def update_itemlist
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @itemcommand_window.active = true
      @itemlist_window.active = false
      @itemlist_window.index = 0
      @itemcommand_window.index = @command_index
      return
    end
    if Input.trigger?(Input::C)
      @item = @itemlist_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
        @itemlist_window.active = false
        @target_window.x = 455
        @target_window.visible = true
        @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)
              @itemlist_window.draw_item(@itemlist_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)
        @itemlist_window.refresh
      end
      @itemlist_window.active = true
      @target_window.visible = false
      @target_window.active = false
      @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
      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)
          @itemlist_window.draw_item(@itemlist_window.index)
          @itemlist_window.set_item(@itemcommand_window.commands[@command_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
  end
end

#==============================================================================
# ■ RPG追加定义,使用@符号分类
#==============================================================================
=begin

module RPG
  class Weapon
    def name
      name = @name.split(/@/)[0]
      return name != nil ? name : ''
    end
    def desc
      desc = @name.split(/@/)[1]
      return desc != nil ? desc : "普通物品"
    end
  end
  class Item
    def name
      name = @name.split(/@/)[0]
      return name != nil ? name : ''
    end
    def desc
      desc = @name.split(/@/)[1]
      return desc != nil ? desc : "普通物品"
    end
  end
  class Armor
    def name
      name = @name.split(/@/)[0]
      return name != nil ? name : ''
    end
    def desc
      desc = @name.split(/@/)[1]
      return desc != nil ? desc : "普通物品"
    end
  end
end
=end
module RPG
  class Weapon
    def description
      description = @description.split(/@/)[0]
      return description != nil ? description : ''
    end
    def desc
      desc = @description.split(/@/)[1]
      return desc != nil ? desc : "贵重品"
    end
  end
  class Item
    def description
      description = @description.split(/@/)[0]
      return description != nil ? description : ''
    end
    def desc
      desc = @description.split(/@/)[1]
      return desc != nil ? desc : "贵重品"
    end
  end
  class Armor
    def description
      description = @description.split(/@/)[0]
      return description != nil ? description : ''
    end
    def desc
      desc = @description.split(/@/)[1]
      return desc != nil ? desc : "贵重品"
    end
  end
end

#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================

最佳答案

查看完整内容

这样啊 请原谅我愚钝 OK了

点评

放在你插入的所有脚本最下面,main之前  发表于 2014-1-17 18:19

Lv1.梦旅人

薄凉看客

梦石
0
星屑
50
在线时间
1269 小时
注册时间
2010-6-20
帖子
1316
2
发表于 2014-1-17 15:16:24 | 只看该作者
这样啊 请原谅我愚钝  OK了
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================

  4. #==============================================================================
  5. # ■ Harts_Window_ItemTitle
  6. #==============================================================================

  7. class Harts_Window_ItemTitle < Window_Base
  8.   def initialize
  9.     super(0, 0, 160, 64)
  10.     self.contents = Bitmap.new(width - 32, height - 32)
  11.     self.contents.clear
  12.     self.contents.font.color = Color.new(79,39,0,255)
  13.     self.contents.draw_text(4, 0, 120, 32, $data_system.words.item, 1)
  14.   end
  15. end

  16. #==============================================================================
  17. # ■ Harts_Window_ItemCommand
  18. #==============================================================================

  19. class Harts_Window_ItemCommand < Window_Selectable
  20.   attr_accessor :commands
  21.   #--------------------------------------------------------------------------
  22.   # ● 初始化,生成commands窗口
  23.   #--------------------------------------------------------------------------
  24.   def initialize
  25.     super(0, 64, 160, 352)
  26.     self.contents = Bitmap.new(width - 32, height - 32)
  27.     @commands = []
  28.     #————————生成commands窗口
  29.     for i in 1...$data_items.size
  30.       if [*50..100].include?(i)
  31.         next
  32.       end
  33.       if $game_party.item_number(i) > 0
  34.         push = true
  35.         for com in @commands
  36.           if com == $data_items.desc
  37.             push = false
  38.           end
  39.         end
  40.         if push == true
  41.           @commands.push($data_items.desc)
  42.         end
  43.       end
  44.     end
  45.     for i in 1...$data_weapons.size
  46.       if $game_party.weapon_number(i) > 0
  47.         push = true
  48.         for com in @commands
  49.           if com == $data_weapons.desc
  50.             push = false
  51.           end
  52.         end
  53.         if push == true
  54.           @commands.push($data_weapons.desc)
  55.         end
  56.       end
  57.     end
  58.     for i in 1...$data_armors.size
  59.       if $game_party.armor_number(i) > 0
  60.         push = true
  61.         for com in @commands
  62.           if com == $data_armors.desc
  63.             push = false
  64.           end
  65.         end
  66.         if push == true
  67.           @commands.push($data_armors.desc)
  68.         end
  69.       end
  70.     end
  71.     if @commands == []
  72.       @commands.push("普通物品")
  73.     end      
  74.     @item_max = @commands.size
  75.     refresh
  76.     self.index = 0
  77.   end
  78.   #--------------------------------------------------------------------------
  79.   #--------------------------------------------------------------------------
  80.   def refresh
  81.     self.contents.clear
  82.     for i in 0...@item_max
  83.       draw_item(i, normal_color)
  84.     end
  85.   end
  86.   #--------------------------------------------------------------------------
  87.   #--------------------------------------------------------------------------
  88.   def draw_item(index, color)
  89.     self.contents.font.color = Color.new(79,39,0,255)
  90.     y = index * 32
  91.     self.contents.draw_text(4, y, 128, 32, @commands[index])
  92.   end
  93.   #--------------------------------------------------------------------------
  94.   # 只描绘原文字
  95.   #--------------------------------------------------------------------------
  96.   def update_help
  97.     @help_window.set_text(@commands[self.index])
  98.   end
  99. end
  100. #==============================================================================
  101. # ■ Window_Item
  102. #==============================================================================

  103. class Harts_Window_ItemList < Window_Selectable
  104.   #--------------------------------------------------------------------------
  105.   #--------------------------------------------------------------------------
  106.   def initialize
  107.     super(160, 0, 480, 416)
  108.     refresh
  109.     self.index = 0
  110.   end
  111.   #--------------------------------------------------------------------------
  112.   #--------------------------------------------------------------------------
  113.   def item
  114.     return @data[self.index]
  115.   end
  116.   #--------------------------------------------------------------------------
  117.   #--------------------------------------------------------------------------
  118.   def refresh
  119.     if self.contents != nil
  120.       self.contents.dispose
  121.       self.contents = nil
  122.     end
  123.     @data = []
  124.   end
  125.   #--------------------------------------------------------------------------
  126.   #--------------------------------------------------------------------------
  127.   def set_item(command)
  128.     refresh
  129.     for i in 1...$data_items.size
  130.       if [*50..100].include?(i)
  131.         next
  132.       end
  133.       if $game_party.item_number(i) > 0 and $data_items.desc == command
  134.         @data.push($data_items)
  135.       end
  136.     end
  137.     for i in 1...$data_weapons.size
  138.       if $game_party.weapon_number(i) > 0 and $data_weapons.desc == command
  139.         @data.push($data_weapons)
  140.       end
  141.     end
  142.     for i in 1...$data_armors.size
  143.       if $game_party.armor_number(i) > 0 and $data_armors.desc == command
  144.         @data.push($data_armors)
  145.       end
  146.     end
  147.     @item_max = @data.size
  148.     if @item_max > 0
  149.       self.contents = Bitmap.new(width - 32, row_max * 48)
  150.       self.contents.clear
  151.       for i in 0...@item_max
  152.         draw_item(i)
  153.       end
  154.     end
  155.   end
  156.   #--------------------------------------------------------------------------
  157.   #--------------------------------------------------------------------------
  158.   def item_number
  159.     return @item_max
  160.   end
  161.   #--------------------------------------------------------------------------
  162.   #--------------------------------------------------------------------------
  163.   def draw_item(index)
  164.     item = @data[index]
  165.     case item
  166.     when RPG::Item
  167.       number = $game_party.item_number(item.id)
  168.     when RPG::Weapon
  169.       number = $game_party.weapon_number(item.id)
  170.     when RPG::Armor
  171.       number = $game_party.armor_number(item.id)
  172.     end
  173.     if item.is_a?(RPG::Item) and
  174.       $game_party.item_can_use?(item.id)
  175.     self.contents.font.color = Color.new(79,39,0,255)
  176.     else
  177.     self.contents.font.color = Color.new(79,39,0,255)
  178.     end
  179.    
  180.     x = 4
  181.     y = index * 32
  182.     bitmap = RPG::Cache.icon(item.icon_name)
  183.     opacity = self.contents.font.color == normal_color ? 255 : 128
  184.     self.contents.blt(x, y + 4, bitmap, Rect.new(7, 11, 32, 32), opacity)
  185.    
  186.     self.contents.draw_text(x + 44, y, 212, 32, item.name, 0)
  187.     self.contents.draw_text(x + 234, y, 16, 32, ":", 1)
  188.     self.contents.draw_text(x + 264, y, 24, 32, number.to_s, 2)
  189.   end
  190.   #--------------------------------------------------------------------------
  191.   #--------------------------------------------------------------------------
  192.   def update_help
  193.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  194.   end
  195. end

  196. #==============================================================================
  197. # ■ Harts_Scene_Item
  198. #==============================================================================

  199. class Scene_Item
  200.   #--------------------------------------------------------------------------
  201.   #--------------------------------------------------------------------------
  202.   def main
  203.     @itemtitle_window = Harts_Window_ItemTitle.new
  204.     @itemcommand_window = Harts_Window_ItemCommand.new
  205.     @command_index = @itemcommand_window.index
  206.     @itemlist_window = Harts_Window_ItemList.new
  207.     @itemlist_window.active = false
  208.     @你2B啊 = Sprite.new
  209.     @你2B啊.bitmap = Bitmap.new("Graphics/Pictures/绵羊")
  210.     @你2B啊.x = 0
  211.     @你2B啊.y =0
  212.     @你2B啊.opacity=255
  213.     @help_window = Window_Help.new
  214.     @help_window.x = 0
  215.     @help_window.y = 404
  216.     @gold_window = Window_Gold.new
  217.     @gold_window.x = 5
  218.     @gold_window.y = 11/2+10
  219.    
  220.     @itemcommand_window.help_window = @help_window
  221.     @itemlist_window.help_window = @help_window

  222.     @target_window = Window_Target1.new
  223.     @target_window.visible = false
  224.     @target_window.active = false
  225.     @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  226.     Graphics.transition
  227.     loop do
  228.       Graphics.update
  229.       Input.update
  230.       update
  231.       if $scene != self
  232.         break
  233.       end
  234.     end
  235.     Graphics.freeze
  236.     @itemtitle_window.dispose
  237.     @itemcommand_window.dispose
  238.     @itemlist_window.dispose
  239.     @help_window.dispose
  240.     @target_window.dispose
  241.     @gold_window.dispose
  242.     @你2B啊.dispose
  243.   end
  244.   #--------------------------------------------------------------------------
  245.   #--------------------------------------------------------------------------
  246.   def update
  247.     @itemtitle_window.update
  248.     @itemcommand_window.update
  249.     @itemlist_window.update
  250.     @help_window.update
  251.     @target_window.update
  252.     if @command_index != @itemcommand_window.index
  253.       @command_index = @itemcommand_window.index
  254.       @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  255.     end
  256.     if @itemcommand_window.active
  257.       update_itemcommand
  258.       return
  259.     end
  260.     if @itemlist_window.active
  261.       update_itemlist
  262.       return
  263.     end
  264.     if @target_window.active
  265.       update_target
  266.       return
  267.     end
  268.   end
  269.   #--------------------------------------------------------------------------
  270.   #--------------------------------------------------------------------------
  271.   def update_itemcommand
  272.     if Input.trigger?(Input::B)
  273.       $game_system.se_play($data_system.cancel_se)
  274.       $scene = Scene_Menu.new(0)
  275.       return
  276.     end
  277.     if Input.trigger?(Input::C)
  278.       if @itemlist_window.item_number == 0
  279.         $game_system.se_play($data_system.buzzer_se)
  280.         return
  281.       end
  282.       $game_system.se_play($data_system.decision_se)
  283.       @itemcommand_window.active = false
  284.       @itemlist_window.active = true
  285.       @itemlist_window.index = 0
  286.       return
  287.     end
  288.   end
  289.   #--------------------------------------------------------------------------
  290.   #--------------------------------------------------------------------------
  291.   def update_itemlist
  292.     if Input.trigger?(Input::B)
  293.       $game_system.se_play($data_system.cancel_se)
  294.       @itemcommand_window.active = true
  295.       @itemlist_window.active = false
  296.       @itemlist_window.index = 0
  297.       @itemcommand_window.index = @command_index
  298.       return
  299.     end
  300.     if Input.trigger?(Input::C)
  301.       @item = @itemlist_window.item
  302.       unless @item.is_a?(RPG::Item)
  303.         $game_system.se_play($data_system.buzzer_se)
  304.         return
  305.       end
  306.       unless $game_party.item_can_use?(@item.id)
  307.         $game_system.se_play($data_system.buzzer_se)
  308.         return
  309.       end
  310.       $game_system.se_play($data_system.decision_se)
  311.       if @item.scope >= 3
  312.         @itemlist_window.active = false
  313.         @target_window.x = 455
  314.         @target_window.visible = true
  315.         @target_window.active = true
  316.         if @item.scope == 4 || @item.scope == 6
  317.           @target_window.index = -1
  318.         else
  319.           @target_window.index = 0
  320.         end
  321.       else
  322.         if @item.common_event_id > 0
  323.           $game_temp.common_event_id = @item.common_event_id
  324.           $game_system.se_play(@item.menu_se)
  325.             if @item.consumable
  326.               $game_party.lose_item(@item.id, 1)
  327.               @itemlist_window.draw_item(@itemlist_window.index)
  328.             end
  329.           $scene = Scene_Map.new
  330.           return
  331.         end
  332.       end
  333.       return
  334.     end
  335.   end
  336.   #--------------------------------------------------------------------------
  337.   #--------------------------------------------------------------------------
  338.   def update_target
  339.     if Input.trigger?(Input::B)
  340.       $game_system.se_play($data_system.cancel_se)
  341.       unless $game_party.item_can_use?(@item.id)
  342.         @itemlist_window.refresh
  343.       end
  344.       @itemlist_window.active = true
  345.       @target_window.visible = false
  346.       @target_window.active = false
  347.       @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  348.       return
  349.     end
  350.     if Input.trigger?(Input::C)
  351.       if $game_party.item_number(@item.id) == 0
  352.         $game_system.se_play($data_system.buzzer_se)
  353.         return
  354.       end
  355.       if @target_window.index == -1
  356.         used = false
  357.         for i in $game_party.actors
  358.           used |= i.item_effect(@item)
  359.         end
  360.       end
  361.       if @target_window.index >= 0
  362.         target = $game_party.actors[@target_window.index]
  363.         used = target.item_effect(@item)
  364.       end
  365.       if used
  366.         $game_system.se_play(@item.menu_se)
  367.         if @item.consumable
  368.           $game_party.lose_item(@item.id, 1)
  369.           @itemlist_window.draw_item(@itemlist_window.index)
  370.           @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  371.         end
  372.         @target_window.refresh
  373.         if $game_party.all_dead?
  374.           $scene = Scene_Gameover.new
  375.           return
  376.         end
  377.         if @item.common_event_id > 0
  378.           $game_temp.common_event_id = @item.common_event_id
  379.           $scene = Scene_Map.new
  380.           return
  381.         end
  382.       end
  383.       unless used
  384.         $game_system.se_play($data_system.buzzer_se)
  385.       end
  386.     return
  387.     end
  388.   end
  389. end

  390. #==============================================================================
  391. # ■ RPG追加定义,使用@符号分类
  392. #==============================================================================
  393. =begin

  394. module RPG
  395.   class Weapon
  396.     def name
  397.       name = @name.split(/@/)[0]
  398.       return name != nil ? name : ''
  399.     end
  400.     def desc
  401.       desc = @name.split(/@/)[1]
  402.       return desc != nil ? desc : "普通物品"
  403.     end
  404.   end
  405.   class Item
  406.     def name
  407.       name = @name.split(/@/)[0]
  408.       return name != nil ? name : ''
  409.     end
  410.     def desc
  411.       desc = @name.split(/@/)[1]
  412.       return desc != nil ? desc : "普通物品"
  413.     end
  414.   end
  415.   class Armor
  416.     def name
  417.       name = @name.split(/@/)[0]
  418.       return name != nil ? name : ''
  419.     end
  420.     def desc
  421.       desc = @name.split(/@/)[1]
  422.       return desc != nil ? desc : "普通物品"
  423.     end
  424.   end
  425. end
  426. =end
  427. module RPG
  428.   class Weapon
  429.     def description
  430.       description = @description.split(/@/)[0]
  431.       return description != nil ? description : ''
  432.     end
  433.     def desc
  434.       desc = @description.split(/@/)[1]
  435.       return desc != nil ? desc : "贵重品"
  436.     end
  437.   end
  438.   class Item
  439.     def description
  440.       description = @description.split(/@/)[0]
  441.       return description != nil ? description : ''
  442.     end
  443.     def desc
  444.       desc = @description.split(/@/)[1]
  445.       return desc != nil ? desc : "贵重品"
  446.     end
  447.   end
  448.   class Armor
  449.     def description
  450.       description = @description.split(/@/)[0]
  451.       return description != nil ? description : ''
  452.     end
  453.     def desc
  454.       desc = @description.split(/@/)[1]
  455.       return desc != nil ? desc : "贵重品"
  456.     end
  457.   end
  458. end

  459. #==============================================================================
  460. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  461. #==============================================================================
复制代码
回复

使用道具 举报

Lv1.梦旅人

薄凉看客

梦石
0
星屑
50
在线时间
1269 小时
注册时间
2010-6-20
帖子
1316
3
发表于 2014-1-17 17:54:16 | 只看该作者
本帖最后由 恋′挂机 于 2014-1-17 18:02 编辑

他的那个脚本很没水准

使用方法 $scene = Scene_Item2.new
  1. # 默认 50 到 100 号物品是礼品

  2. #==============================================================================
  3. # ■ Window_Item
  4. #------------------------------------------------------------------------------
  5. #  物品画面、战斗画面、显示浏览物品的窗口。
  6. #==============================================================================

  7. class Window_Item2 < Window_Selectable
  8.   #--------------------------------------------------------------------------
  9.   # ● 初始化对像
  10.   #--------------------------------------------------------------------------
  11.   def initialize
  12.     super(0, 64, 640, 416)
  13.     @column_max = 2
  14.     refresh
  15.     self.index = 0
  16.   end
  17.   #--------------------------------------------------------------------------
  18.   # ● 获取物品
  19.   #--------------------------------------------------------------------------
  20.   def item
  21.     return @data[self.index]
  22.   end
  23.   #--------------------------------------------------------------------------
  24.   # ● 刷新
  25.   #--------------------------------------------------------------------------
  26.   def refresh
  27.     if self.contents != nil
  28.       self.contents.dispose
  29.       self.contents = nil
  30.     end
  31.     @data = []
  32.     # 添加物品
  33.     for i in 50..100
  34.       if $game_party.item_number(i) > 0
  35.         @data.push($data_items[i])
  36.       end
  37.     end
  38.     # 如果项目数不是 0 就生成位图、重新描绘全部项目
  39.     @item_max = @data.size
  40.     if @item_max > 0
  41.       self.contents = Bitmap.new(width - 32, row_max * 32)
  42.       for i in 0...@item_max
  43.         draw_item(i)
  44.       end
  45.     end
  46.   end
  47.   #--------------------------------------------------------------------------
  48.   # ● 描绘项目
  49.   #     index : 项目编号
  50.   #--------------------------------------------------------------------------
  51.   def draw_item(index)
  52.     item = @data[index]
  53.     number = $game_party.item_number(item.id)
  54.     if item.is_a?(RPG::Item) and
  55.        $game_party.item_can_use?(item.id)
  56.       self.contents.font.color = normal_color
  57.     else
  58.       self.contents.font.color = disabled_color
  59.     end
  60.     x = 4 + index % 2 * (288 + 32)
  61.     y = index / 2 * 32
  62.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  63.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  64.     bitmap = RPG::Cache.icon(item.icon_name)
  65.     opacity = self.contents.font.color == normal_color ? 255 : 128
  66.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  67.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  68.     self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
  69.     self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  70.   end
  71.   #--------------------------------------------------------------------------
  72.   # ● 刷新帮助文本
  73.   #--------------------------------------------------------------------------
  74.   def update_help
  75.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  76.   end
  77. end
  78. #==============================================================================
  79. # ■ Scene_Item2
  80. #------------------------------------------------------------------------------
  81. #  处理物品画面的类。
  82. #==============================================================================

  83. class Scene_Item2
  84.   #--------------------------------------------------------------------------
  85.   # ● 主处理
  86.   #--------------------------------------------------------------------------
  87.   def main
  88.     # 生成帮助窗口、物品窗口
  89.     @help_window = Window_Help.new
  90.     @item_window = Window_Item2.new
  91.     # 关联帮助窗口
  92.     @item_window.help_window = @help_window
  93.     # 生成目标窗口 (设置为不可见・不活动)
  94.     @target_window = Window_Target.new
  95.     @target_window.visible = false
  96.     @target_window.active = false
  97.     # 执行过度
  98.     Graphics.transition
  99.     # 主循环
  100.     loop do
  101.       # 刷新游戏画面
  102.       Graphics.update
  103.       # 刷新输入信息
  104.       Input.update
  105.       # 刷新画面
  106.       update
  107.       # 如果画面切换就中断循环
  108.       if $scene != self
  109.         break
  110.       end
  111.     end
  112.     # 装备过渡
  113.     Graphics.freeze
  114.     # 释放窗口
  115.     @help_window.dispose
  116.     @item_window.dispose
  117.     @target_window.dispose
  118.   end
  119.   #--------------------------------------------------------------------------
  120.   # ● 刷新画面
  121.   #--------------------------------------------------------------------------
  122.   def update
  123.     # 刷新窗口
  124.     @help_window.update
  125.     @item_window.update
  126.     @target_window.update
  127.     # 物品窗口被激活的情况下: 调用 update_item
  128.     if @item_window.active
  129.       update_item
  130.       return
  131.     end
  132.     # 目标窗口被激活的情况下: 调用 update_target
  133.     if @target_window.active
  134.       update_target
  135.       return
  136.     end
  137.   end
  138.   #--------------------------------------------------------------------------
  139.   # ● 刷新画面 (物品窗口被激活的情况下)
  140.   #--------------------------------------------------------------------------
  141.   def update_item
  142.     # 按下 B 键的情况下
  143.     if Input.trigger?(Input::B)
  144.       # 演奏取消 SE
  145.       $game_system.se_play($data_system.cancel_se)
  146.       # 切换到菜单画面
  147.       $scene = Scene_Menu.new(0)
  148.       return
  149.     end
  150.     # 按下 C 键的情况下
  151.     if Input.trigger?(Input::C)
  152.       # 获取物品窗口当前选中的物品数据
  153.       @item = @item_window.item
  154.       # 不使用物品的情况下
  155.       unless @item.is_a?(RPG::Item)
  156.         # 演奏冻结 SE
  157.         $game_system.se_play($data_system.buzzer_se)
  158.         return
  159.       end
  160.       # 不能使用的情况下
  161.       unless $game_party.item_can_use?(@item.id)
  162.         # 演奏冻结 SE
  163.         $game_system.se_play($data_system.buzzer_se)
  164.         return
  165.       end
  166.       # 演奏确定 SE
  167.       $game_system.se_play($data_system.decision_se)
  168.       # 效果范围是我方的情况下
  169.       if @item.scope >= 3
  170.         # 激活目标窗口
  171.         @item_window.active = false
  172.         @target_window.x = (@item_window.index + 1) % 2 * 304
  173.         @target_window.visible = true
  174.         @target_window.active = true
  175.         # 设置效果范围 (单体/全体) 的对应光标位置
  176.         if @item.scope == 4 || @item.scope == 6
  177.           @target_window.index = -1
  178.         else
  179.           @target_window.index = 0
  180.         end
  181.       # 效果在我方以外的情况下
  182.       else
  183.         # 公共事件 ID 有效的情况下
  184.         if @item.common_event_id > 0
  185.           # 预约调用公共事件
  186.           $game_temp.common_event_id = @item.common_event_id
  187.           # 演奏物品使用时的 SE
  188.           $game_system.se_play(@item.menu_se)
  189.           # 消耗品的情况下
  190.           if @item.consumable
  191.             # 使用的物品数减 1
  192.             $game_party.lose_item(@item.id, 1)
  193.             # 再描绘物品窗口的项目
  194.             @item_window.draw_item(@item_window.index)
  195.           end
  196.           # 切换到地图画面
  197.           $scene = Scene_Map.new
  198.           return
  199.         end
  200.       end
  201.       return
  202.     end
  203.   end
  204.   #--------------------------------------------------------------------------
  205.   # ● 刷新画面 (目标窗口被激活的情况下)
  206.   #--------------------------------------------------------------------------
  207.   def update_target
  208.     # 按下 B 键的情况下
  209.     if Input.trigger?(Input::B)
  210.       # 演奏取消 SE
  211.       $game_system.se_play($data_system.cancel_se)
  212.       # 由于物品用完而不能使用的场合
  213.       unless $game_party.item_can_use?(@item.id)
  214.         # 再次生成物品窗口的内容
  215.         @item_window.refresh
  216.       end
  217.       # 删除目标窗口
  218.       @item_window.active = true
  219.       @target_window.visible = false
  220.       @target_window.active = false
  221.       return
  222.     end
  223.     # 按下 C 键的情况下
  224.     if Input.trigger?(Input::C)
  225.       # 如果物品用完的情况下
  226.       if $game_party.item_number(@item.id) == 0
  227.         # 演奏冻结 SE
  228.         $game_system.se_play($data_system.buzzer_se)
  229.         return
  230.       end
  231.       # 目标是全体的情况下
  232.       if @target_window.index == -1
  233.         # 对同伴全体应用物品使用效果
  234.         used = false
  235.         for i in $game_party.actors
  236.           used |= i.item_effect(@item)
  237.         end
  238.       end
  239.       # 目标是单体的情况下
  240.       if @target_window.index >= 0
  241.         # 对目标角色应用物品的使用效果
  242.         target = $game_party.actors[@target_window.index]
  243.         used = target.item_effect(@item)
  244.       end
  245.       # 使用物品的情况下
  246.       if used
  247.         # 演奏物品使用时的 SE
  248.         $game_system.se_play(@item.menu_se)
  249.         # 消耗品的情况下
  250.         if @item.consumable
  251.           # 使用的物品数减 1
  252.           $game_party.lose_item(@item.id, 1)
  253.           # 再描绘物品窗口的项目
  254.           @item_window.draw_item(@item_window.index)
  255.         end
  256.         # 再生成目标窗口的内容
  257.         @target_window.refresh
  258.         # 全灭的情况下
  259.         if $game_party.all_dead?
  260.           # 切换到游戏结束画面
  261.           $scene = Scene_Gameover.new
  262.           return
  263.         end
  264.         # 公共事件 ID 有效的情况下
  265.         if @item.common_event_id > 0
  266.           # 预约调用公共事件
  267.           $game_temp.common_event_id = @item.common_event_id
  268.           # 切换到地图画面
  269.           $scene = Scene_Map.new
  270.           return
  271.         end
  272.       end
  273.       # 无法使用物品的情况下
  274.       unless used
  275.         # 演奏冻结 SE
  276.         $game_system.se_play($data_system.buzzer_se)
  277.       end
  278.       return
  279.     end
  280.   end
  281. end
复制代码
第二段
  1. #==============================================================================
  2. # ■ Window_Item
  3. #------------------------------------------------------------------------------
  4. #  物品画面、战斗画面、显示浏览物品的窗口。
  5. #==============================================================================

  6. class Window_Item < Window_Selectable
  7.   #--------------------------------------------------------------------------
  8.   # ● 刷新
  9.   #--------------------------------------------------------------------------
  10.   def refresh
  11.     if self.contents != nil
  12.       self.contents.dispose
  13.       self.contents = nil
  14.     end
  15.     @data = []
  16.     # 添加物品
  17.     for i in 1...$data_items.size
  18.       if $game_party.item_number(i) > 0
  19.         if [*50..100].include?(i)
  20.           next
  21.         end
  22.         @data.push($data_items[i])
  23.       end
  24.     end
  25.     # 在战斗中以外添加武器、防具
  26.     unless $game_temp.in_battle
  27.       for i in 1...$data_weapons.size
  28.         if $game_party.weapon_number(i) > 0
  29.           @data.push($data_weapons[i])
  30.         end
  31.       end
  32.       for i in 1...$data_armors.size
  33.         if $game_party.armor_number(i) > 0
  34.           @data.push($data_armors[i])
  35.         end
  36.       end
  37.     end
  38.     # 如果项目数不是 0 就生成位图、重新描绘全部项目
  39.     @item_max = @data.size
  40.     if @item_max > 0
  41.       self.contents = Bitmap.new(width - 32, row_max * 32)
  42.       for i in 0...@item_max
  43.         draw_item(i)
  44.       end
  45.     end
  46.   end
  47. end
复制代码
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
90
在线时间
186 小时
注册时间
2010-6-24
帖子
111
4
 楼主| 发表于 2014-1-17 18:05:24 | 只看该作者
@恋′挂机 大大,那个我是想让礼品不显示在道具栏里。
没用复杂物品分类脚本的话似乎就不会显示,但是一用就要显示了的说
小白一只,求见谅
回复

使用道具 举报

Lv1.梦旅人

薄凉看客

梦石
0
星屑
50
在线时间
1269 小时
注册时间
2010-6-20
帖子
1316
5
发表于 2014-1-17 18:08:47 | 只看该作者
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================

  4. #==============================================================================
  5. # ■ Harts_Window_ItemTitle
  6. #==============================================================================
  7. class Harts_Window_ItemTitle < Window_Base
  8.   def initialize
  9.     super(0, 0, 160, 64)
  10.     self.contents = Bitmap.new(width - 32, height - 32)
  11.     self.contents.clear
  12.     self.contents.font.color = normal_color
  13.     self.contents.draw_text(4, 0, 120, 32, $data_system.words.item, 1)
  14.   end
  15. end
  16. #==============================================================================
  17. # ■ Harts_Window_ItemCommand
  18. #==============================================================================
  19. class Harts_Window_ItemCommand < Window_Selectable
  20.   attr_accessor :commands
  21.   #--------------------------------------------------------------------------
  22.   # ● 初始化,生成commands窗口
  23.   #--------------------------------------------------------------------------
  24.   def initialize
  25.     super(0, 64, 160, 352)
  26.     @commands = []
  27.     #————————生成commands窗口
  28.     for i in 1...$data_items.size
  29.       if [*50..10].include?(i)
  30.         next
  31.       end
  32.       if $game_party.item_number(i) > 0  
  33.         push = true
  34.         for com in @commands
  35.           if com == $data_items[i].desc
  36.             push = false
  37.           end
  38.         end
  39.         if push == true
  40.           @commands.push($data_items[i].desc)
  41.         end
  42.       end
  43.     end
  44.     for i in 1...$data_weapons.size
  45.       if $game_party.weapon_number(i) > 0  
  46.         push = true
  47.         for com in @commands
  48.           if com == $data_weapons[i].desc
  49.             push = false
  50.           end
  51.         end
  52.         if push == true
  53.           @commands.push($data_weapons[i].desc)
  54.         end
  55.       end
  56.     end
  57.     for i in 1...$data_armors.size
  58.       if $game_party.armor_number(i) > 0  
  59.         push = true
  60.         for com in @commands
  61.           if com == $data_armors[i].desc
  62.             push = false
  63.           end
  64.         end
  65.         if push == true
  66.           @commands.push($data_armors[i].desc)
  67.         end
  68.       end
  69.     end
  70.     if @commands == []
  71.       @commands.push("普通物品")
  72.     end      
  73.     @item_max = @commands.size
  74.     self.contents = Bitmap.new(width - 32, @item_max * 32)
  75.     refresh
  76.     self.index = 0
  77.   end
  78.   #--------------------------------------------------------------------------
  79.   #--------------------------------------------------------------------------
  80.   def refresh
  81.     self.contents.clear
  82.     for i in 0...@item_max
  83.       draw_item(i, normal_color)
  84.     end
  85.   end
  86.   #--------------------------------------------------------------------------
  87.   #--------------------------------------------------------------------------
  88.   def draw_item(index, color)
  89.     self.contents.font.color = color
  90.     y = index * 32
  91.     self.contents.draw_text(4, y, 128, 32, @commands[index])
  92.   end
  93.   #--------------------------------------------------------------------------
  94.   # 只描绘原文字
  95.   #--------------------------------------------------------------------------
  96.   def update_help
  97.     @help_window.set_text(@commands[self.index])
  98.   end
  99. end
  100. #==============================================================================
  101. # ■ Window_Item
  102. #==============================================================================
  103. class Harts_Window_ItemList < Window_Selectable
  104.   #--------------------------------------------------------------------------
  105.   #--------------------------------------------------------------------------
  106.   def initialize
  107.     super(160, 0, 480, 416)
  108.     refresh
  109.     self.index = 0
  110.   end
  111.   #--------------------------------------------------------------------------
  112.   #--------------------------------------------------------------------------
  113.   def item
  114.     return @data[self.index]
  115.   end
  116.   #--------------------------------------------------------------------------
  117.   #--------------------------------------------------------------------------
  118.   def refresh
  119.     if self.contents != nil
  120.       self.contents.dispose
  121.       self.contents = nil
  122.     end
  123.     @data = []
  124.   end
  125.   #--------------------------------------------------------------------------
  126.   #--------------------------------------------------------------------------
  127.   def set_item(command)
  128.     refresh
  129.     for i in 1...$data_items.size
  130.       if [*50..10].include?(i)
  131.         next
  132.       end
  133.       if $game_party.item_number(i) > 0 and $data_items[i].desc == command
  134.         @data.push($data_items[i])
  135.       end
  136.     end
  137.     for i in 1...$data_weapons.size
  138.       if $game_party.weapon_number(i) > 0 and $data_weapons[i].desc == command
  139.         @data.push($data_weapons[i])
  140.       end
  141.     end
  142.     for i in 1...$data_armors.size
  143.       if $game_party.armor_number(i) > 0 and $data_armors[i].desc == command
  144.         @data.push($data_armors[i])
  145.       end
  146.     end
  147.     @item_max = @data.size
  148.     if @item_max > 0
  149.       self.contents = Bitmap.new(width - 32, row_max * 32)
  150.       self.contents.clear
  151.       for i in 0...@item_max
  152.         draw_item(i)
  153.       end
  154.     end
  155.   end
  156.   #--------------------------------------------------------------------------
  157.   #--------------------------------------------------------------------------
  158.   def item_number
  159.     return @item_max
  160.   end
  161.   #--------------------------------------------------------------------------
  162.   #--------------------------------------------------------------------------
  163.   def draw_item(index)
  164.     item = @data[index]
  165.     case item
  166.     when RPG::Item
  167.       number = $game_party.item_number(item.id)
  168.     when RPG::Weapon
  169.       number = $game_party.weapon_number(item.id)
  170.     when RPG::Armor
  171.       number = $game_party.armor_number(item.id)
  172.     end
  173.     if item.is_a?(RPG::Item) and
  174.       $game_party.item_can_use?(item.id)
  175.       self.contents.font.color = normal_color
  176.     else
  177.       self.contents.font.color = disabled_color
  178.     end
  179.     x = 4
  180.     y = index * 32
  181.     bitmap = RPG::Cache.icon(item.icon_name)
  182.     opacity = self.contents.font.color == normal_color ? 255 : 128
  183.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  184.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  185.     self.contents.draw_text(x + 400, y, 16, 32, ":", 1)
  186.     self.contents.draw_text(x + 416, y, 24, 32, number.to_s, 2)
  187.   end
  188.   #--------------------------------------------------------------------------
  189.   #--------------------------------------------------------------------------
  190.   def update_help
  191.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  192.   end
  193. end
  194. #==============================================================================
  195. # ■ Harts_Scene_Item
  196. #==============================================================================
  197. class Scene_Item
  198.   #--------------------------------------------------------------------------
  199.   #--------------------------------------------------------------------------
  200.   def main
  201.     @itemtitle_window = Harts_Window_ItemTitle.new
  202.     @itemcommand_window = Harts_Window_ItemCommand.new
  203.     @command_index = @itemcommand_window.index
  204.     @itemlist_window = Harts_Window_ItemList.new
  205.     @itemlist_window.active = false
  206.     @help_window = Window_Help.new
  207.     @help_window.x = 0
  208.     @help_window.y = 416
  209.     @itemcommand_window.help_window = @help_window
  210.     @itemlist_window.help_window = @help_window
  211.     @target_window = Window_Target.new
  212.     @target_window.visible = false
  213.     @target_window.active = false
  214.     @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  215.     Graphics.transition
  216.     loop do
  217.       Graphics.update
  218.       Input.update
  219.       update
  220.       if $scene != self
  221.         break
  222.       end
  223.     end
  224.     Graphics.freeze
  225.     @itemtitle_window.dispose
  226.     @itemcommand_window.dispose
  227.     @itemlist_window.dispose
  228.     @help_window.dispose
  229.     @target_window.dispose
  230.   end
  231.   #--------------------------------------------------------------------------
  232.   #--------------------------------------------------------------------------
  233.   def update
  234.     @itemtitle_window.update
  235.     @itemcommand_window.update
  236.     @itemlist_window.update
  237.     @help_window.update
  238.     @target_window.update
  239.     if @command_index != @itemcommand_window.index
  240.       @command_index = @itemcommand_window.index
  241.       @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  242.     end
  243.     if @itemcommand_window.active
  244.       update_itemcommand
  245.       return
  246.     end
  247.     if @itemlist_window.active
  248.       update_itemlist
  249.       return
  250.     end
  251.     if @target_window.active
  252.       update_target
  253.       return
  254.     end
  255.   end
  256.   #--------------------------------------------------------------------------
  257.   #--------------------------------------------------------------------------
  258.   def update_itemcommand
  259.     if Input.trigger?(Input::B)
  260.       $game_system.se_play($data_system.cancel_se)
  261.       $scene = Scene_Menu.new(0)
  262.       return
  263.     end
  264.     if Input.trigger?(Input::C)
  265.       if @itemlist_window.item_number == 0
  266.         $game_system.se_play($data_system.buzzer_se)
  267.         return
  268.       end
  269.       $game_system.se_play($data_system.decision_se)
  270.       @itemcommand_window.active = false
  271.       @itemlist_window.active = true
  272.       @itemlist_window.index = 0
  273.       return
  274.     end
  275.   end
  276.   #--------------------------------------------------------------------------
  277.   #--------------------------------------------------------------------------
  278.   def update_itemlist
  279.     if Input.trigger?(Input::B)
  280.       $game_system.se_play($data_system.cancel_se)
  281.       @itemcommand_window.active = true
  282.       @itemlist_window.active = false
  283.       @itemlist_window.index = 0
  284.       @itemcommand_window.index = @command_index
  285.       return
  286.     end
  287.     if Input.trigger?(Input::C)
  288.       @item = @itemlist_window.item
  289.       unless @item.is_a?(RPG::Item)
  290.         $game_system.se_play($data_system.buzzer_se)
  291.         return
  292.       end
  293.       unless $game_party.item_can_use?(@item.id)
  294.         $game_system.se_play($data_system.buzzer_se)
  295.         return
  296.       end
  297.       $game_system.se_play($data_system.decision_se)
  298.       if @item.scope >= 3
  299.         @itemlist_window.active = false
  300.         @target_window.x = 304
  301.         @target_window.visible = true
  302.         @target_window.active = true
  303.         if @item.scope == 4 || @item.scope == 6
  304.           @target_window.index = -1
  305.         else
  306.           @target_window.index = 0
  307.         end
  308.       else
  309.         if @item.common_event_id > 0
  310.           $game_temp.common_event_id = @item.common_event_id
  311.           $game_system.se_play(@item.menu_se)
  312.             if @item.consumable
  313.               $game_party.lose_item(@item.id, 1)
  314.               @itemlist_window.draw_item(@itemlist_window.index)
  315.             end
  316.           $scene = Scene_Map.new
  317.           return
  318.         end
  319.       end
  320.       return
  321.     end
  322.   end
  323.   #--------------------------------------------------------------------------
  324.   #--------------------------------------------------------------------------
  325.   def update_target
  326.     if Input.trigger?(Input::B)
  327.       $game_system.se_play($data_system.cancel_se)
  328.       unless $game_party.item_can_use?(@item.id)
  329.         @itemlist_window.refresh
  330.       end
  331.       @itemlist_window.active = true
  332.       @target_window.visible = false
  333.       @target_window.active = false
  334.       @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  335.       return
  336.     end
  337.     if Input.trigger?(Input::C)
  338.       if $game_party.item_number(@item.id) == 0
  339.         $game_system.se_play($data_system.buzzer_se)
  340.         return
  341.       end
  342.       if @target_window.index == -1
  343.         used = false
  344.         for i in $game_party.actors
  345.           used |= i.item_effect(@item)
  346.         end
  347.       end
  348.       if @target_window.index >= 0
  349.         target = $game_party.actors[@target_window.index]
  350.         used = target.item_effect(@item)
  351.       end
  352.       if used
  353.         $game_system.se_play(@item.menu_se)
  354.         if @item.consumable
  355.           $game_party.lose_item(@item.id, 1)
  356.           @itemlist_window.draw_item(@itemlist_window.index)
  357.           @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  358.         end
  359.         @target_window.refresh
  360.         if $game_party.all_dead?
  361.           $scene = Scene_Gameover.new
  362.           return
  363.         end
  364.         if @item.common_event_id > 0
  365.           $game_temp.common_event_id = @item.common_event_id
  366.           $scene = Scene_Map.new
  367.           return
  368.         end
  369.       end
  370.       unless used
  371.         $game_system.se_play($data_system.buzzer_se)
  372.       end
  373.     return
  374.     end
  375.   end
  376. end
  377. #==============================================================================
  378. # ■ RPG追加定义,使用@符号分类
  379. #==============================================================================
  380. module RPG
  381.   class Weapon
  382.     def description
  383.       description = @description.split(/@/)[0]
  384.       return description != nil ? description : ''
  385.     end
  386.     def desc
  387.       desc = @description.split(/@/)[1]
  388.       return desc != nil ? desc : "普通物品"
  389.     end
  390.   end
  391.   class Item
  392.     def description
  393.       description = @description.split(/@/)[0]
  394.       return description != nil ? description : ''
  395.     end
  396.     def desc
  397.       desc = @description.split(/@/)[1]
  398.       return desc != nil ? desc : "普通物品"
  399.     end
  400.   end
  401.   class Armor
  402.     def description
  403.       description = @description.split(/@/)[0]
  404.       return description != nil ? description : ''
  405.     end
  406.     def desc
  407.       desc = @description.split(/@/)[1]
  408.       return desc != nil ? desc : "普通物品"
  409.     end
  410.   end
  411. end
  412. #==============================================================================
  413. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  414. #==============================================================================
复制代码

点评

似乎还是会显示在物品栏里呢,大大{:4_132:}  发表于 2014-1-17 18:15
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
90
在线时间
186 小时
注册时间
2010-6-24
帖子
111
6
 楼主| 发表于 2014-1-17 18:23:06 | 只看该作者
@恋′挂机 大大实在不好意思又@您。。

似乎还是不行呢。

这个是道具栏界面

这个是礼品盒

那两个道具还是会同时出现呢。。我是想让道具只出现在礼品盒里 不出现在道具栏里。。(⊙o⊙)… 对不起 。55555555555求帮忙。阿门

点评

抱歉,我疏忽了,已修改  发表于 2014-1-17 18:25
回复

使用道具 举报

Lv1.梦旅人

薄凉看客

梦石
0
星屑
50
在线时间
1269 小时
注册时间
2010-6-20
帖子
1316
7
发表于 2014-1-17 18:24:31 | 只看该作者
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================

  4. #==============================================================================
  5. # ■ Harts_Window_ItemTitle
  6. #==============================================================================
  7. class Harts_Window_ItemTitle < Window_Base
  8.   def initialize
  9.     super(0, 0, 160, 64)
  10.     self.contents = Bitmap.new(width - 32, height - 32)
  11.     self.contents.clear
  12.     self.contents.font.color = normal_color
  13.     self.contents.draw_text(4, 0, 120, 32, $data_system.words.item, 1)
  14.   end
  15. end
  16. #==============================================================================
  17. # ■ Harts_Window_ItemCommand
  18. #==============================================================================
  19. class Harts_Window_ItemCommand < Window_Selectable
  20.   attr_accessor :commands
  21.   #--------------------------------------------------------------------------
  22.   # ● 初始化,生成commands窗口
  23.   #--------------------------------------------------------------------------
  24.   def initialize
  25.     super(0, 64, 160, 352)
  26.     @commands = []
  27.     #————————生成commands窗口
  28.     for i in 1...$data_items.size
  29.       if [*50..100].include?(i)
  30.         next
  31.       end
  32.       if $game_party.item_number(i) > 0  
  33.         push = true
  34.         for com in @commands
  35.           if com == $data_items[i].desc
  36.             push = false
  37.           end
  38.         end
  39.         if push == true
  40.           @commands.push($data_items[i].desc)
  41.         end
  42.       end
  43.     end
  44.     for i in 1...$data_weapons.size
  45.       if $game_party.weapon_number(i) > 0  
  46.         push = true
  47.         for com in @commands
  48.           if com == $data_weapons[i].desc
  49.             push = false
  50.           end
  51.         end
  52.         if push == true
  53.           @commands.push($data_weapons[i].desc)
  54.         end
  55.       end
  56.     end
  57.     for i in 1...$data_armors.size
  58.       if $game_party.armor_number(i) > 0  
  59.         push = true
  60.         for com in @commands
  61.           if com == $data_armors[i].desc
  62.             push = false
  63.           end
  64.         end
  65.         if push == true
  66.           @commands.push($data_armors[i].desc)
  67.         end
  68.       end
  69.     end
  70.     if @commands == []
  71.       @commands.push("普通物品")
  72.     end      
  73.     @item_max = @commands.size
  74.     self.contents = Bitmap.new(width - 32, @item_max * 32)
  75.     refresh
  76.     self.index = 0
  77.   end
  78.   #--------------------------------------------------------------------------
  79.   #--------------------------------------------------------------------------
  80.   def refresh
  81.     self.contents.clear
  82.     for i in 0...@item_max
  83.       draw_item(i, normal_color)
  84.     end
  85.   end
  86.   #--------------------------------------------------------------------------
  87.   #--------------------------------------------------------------------------
  88.   def draw_item(index, color)
  89.     self.contents.font.color = color
  90.     y = index * 32
  91.     self.contents.draw_text(4, y, 128, 32, @commands[index])
  92.   end
  93.   #--------------------------------------------------------------------------
  94.   # 只描绘原文字
  95.   #--------------------------------------------------------------------------
  96.   def update_help
  97.     @help_window.set_text(@commands[self.index])
  98.   end
  99. end
  100. #==============================================================================
  101. # ■ Window_Item
  102. #==============================================================================
  103. class Harts_Window_ItemList < Window_Selectable
  104.   #--------------------------------------------------------------------------
  105.   #--------------------------------------------------------------------------
  106.   def initialize
  107.     super(160, 0, 480, 416)
  108.     refresh
  109.     self.index = 0
  110.   end
  111.   #--------------------------------------------------------------------------
  112.   #--------------------------------------------------------------------------
  113.   def item
  114.     return @data[self.index]
  115.   end
  116.   #--------------------------------------------------------------------------
  117.   #--------------------------------------------------------------------------
  118.   def refresh
  119.     if self.contents != nil
  120.       self.contents.dispose
  121.       self.contents = nil
  122.     end
  123.     @data = []
  124.   end
  125.   #--------------------------------------------------------------------------
  126.   #--------------------------------------------------------------------------
  127.   def set_item(command)
  128.     refresh
  129.     for i in 1...$data_items.size
  130.       if [*50..100].include?(i)
  131.         next
  132.       end
  133.       if $game_party.item_number(i) > 0 and $data_items[i].desc == command
  134.         @data.push($data_items[i])
  135.       end
  136.     end
  137.     for i in 1...$data_weapons.size
  138.       if $game_party.weapon_number(i) > 0 and $data_weapons[i].desc == command
  139.         @data.push($data_weapons[i])
  140.       end
  141.     end
  142.     for i in 1...$data_armors.size
  143.       if $game_party.armor_number(i) > 0 and $data_armors[i].desc == command
  144.         @data.push($data_armors[i])
  145.       end
  146.     end
  147.     @item_max = @data.size
  148.     if @item_max > 0
  149.       self.contents = Bitmap.new(width - 32, row_max * 32)
  150.       self.contents.clear
  151.       for i in 0...@item_max
  152.         draw_item(i)
  153.       end
  154.     end
  155.   end
  156.   #--------------------------------------------------------------------------
  157.   #--------------------------------------------------------------------------
  158.   def item_number
  159.     return @item_max
  160.   end
  161.   #--------------------------------------------------------------------------
  162.   #--------------------------------------------------------------------------
  163.   def draw_item(index)
  164.     item = @data[index]
  165.     case item
  166.     when RPG::Item
  167.       number = $game_party.item_number(item.id)
  168.     when RPG::Weapon
  169.       number = $game_party.weapon_number(item.id)
  170.     when RPG::Armor
  171.       number = $game_party.armor_number(item.id)
  172.     end
  173.     if item.is_a?(RPG::Item) and
  174.       $game_party.item_can_use?(item.id)
  175.       self.contents.font.color = normal_color
  176.     else
  177.       self.contents.font.color = disabled_color
  178.     end
  179.     x = 4
  180.     y = index * 32
  181.     bitmap = RPG::Cache.icon(item.icon_name)
  182.     opacity = self.contents.font.color == normal_color ? 255 : 128
  183.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  184.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  185.     self.contents.draw_text(x + 400, y, 16, 32, ":", 1)
  186.     self.contents.draw_text(x + 416, y, 24, 32, number.to_s, 2)
  187.   end
  188.   #--------------------------------------------------------------------------
  189.   #--------------------------------------------------------------------------
  190.   def update_help
  191.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  192.   end
  193. end
  194. #==============================================================================
  195. # ■ Harts_Scene_Item
  196. #==============================================================================
  197. class Scene_Item
  198.   #--------------------------------------------------------------------------
  199.   #--------------------------------------------------------------------------
  200.   def main
  201.     @itemtitle_window = Harts_Window_ItemTitle.new
  202.     @itemcommand_window = Harts_Window_ItemCommand.new
  203.     @command_index = @itemcommand_window.index
  204.     @itemlist_window = Harts_Window_ItemList.new
  205.     @itemlist_window.active = false
  206.     @help_window = Window_Help.new
  207.     @help_window.x = 0
  208.     @help_window.y = 416
  209.     @itemcommand_window.help_window = @help_window
  210.     @itemlist_window.help_window = @help_window
  211.     @target_window = Window_Target.new
  212.     @target_window.visible = false
  213.     @target_window.active = false
  214.     @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  215.     Graphics.transition
  216.     loop do
  217.       Graphics.update
  218.       Input.update
  219.       update
  220.       if $scene != self
  221.         break
  222.       end
  223.     end
  224.     Graphics.freeze
  225.     @itemtitle_window.dispose
  226.     @itemcommand_window.dispose
  227.     @itemlist_window.dispose
  228.     @help_window.dispose
  229.     @target_window.dispose
  230.   end
  231.   #--------------------------------------------------------------------------
  232.   #--------------------------------------------------------------------------
  233.   def update
  234.     @itemtitle_window.update
  235.     @itemcommand_window.update
  236.     @itemlist_window.update
  237.     @help_window.update
  238.     @target_window.update
  239.     if @command_index != @itemcommand_window.index
  240.       @command_index = @itemcommand_window.index
  241.       @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  242.     end
  243.     if @itemcommand_window.active
  244.       update_itemcommand
  245.       return
  246.     end
  247.     if @itemlist_window.active
  248.       update_itemlist
  249.       return
  250.     end
  251.     if @target_window.active
  252.       update_target
  253.       return
  254.     end
  255.   end
  256.   #--------------------------------------------------------------------------
  257.   #--------------------------------------------------------------------------
  258.   def update_itemcommand
  259.     if Input.trigger?(Input::B)
  260.       $game_system.se_play($data_system.cancel_se)
  261.       $scene = Scene_Menu.new(0)
  262.       return
  263.     end
  264.     if Input.trigger?(Input::C)
  265.       if @itemlist_window.item_number == 0
  266.         $game_system.se_play($data_system.buzzer_se)
  267.         return
  268.       end
  269.       $game_system.se_play($data_system.decision_se)
  270.       @itemcommand_window.active = false
  271.       @itemlist_window.active = true
  272.       @itemlist_window.index = 0
  273.       return
  274.     end
  275.   end
  276.   #--------------------------------------------------------------------------
  277.   #--------------------------------------------------------------------------
  278.   def update_itemlist
  279.     if Input.trigger?(Input::B)
  280.       $game_system.se_play($data_system.cancel_se)
  281.       @itemcommand_window.active = true
  282.       @itemlist_window.active = false
  283.       @itemlist_window.index = 0
  284.       @itemcommand_window.index = @command_index
  285.       return
  286.     end
  287.     if Input.trigger?(Input::C)
  288.       @item = @itemlist_window.item
  289.       unless @item.is_a?(RPG::Item)
  290.         $game_system.se_play($data_system.buzzer_se)
  291.         return
  292.       end
  293.       unless $game_party.item_can_use?(@item.id)
  294.         $game_system.se_play($data_system.buzzer_se)
  295.         return
  296.       end
  297.       $game_system.se_play($data_system.decision_se)
  298.       if @item.scope >= 3
  299.         @itemlist_window.active = false
  300.         @target_window.x = 304
  301.         @target_window.visible = true
  302.         @target_window.active = true
  303.         if @item.scope == 4 || @item.scope == 6
  304.           @target_window.index = -1
  305.         else
  306.           @target_window.index = 0
  307.         end
  308.       else
  309.         if @item.common_event_id > 0
  310.           $game_temp.common_event_id = @item.common_event_id
  311.           $game_system.se_play(@item.menu_se)
  312.             if @item.consumable
  313.               $game_party.lose_item(@item.id, 1)
  314.               @itemlist_window.draw_item(@itemlist_window.index)
  315.             end
  316.           $scene = Scene_Map.new
  317.           return
  318.         end
  319.       end
  320.       return
  321.     end
  322.   end
  323.   #--------------------------------------------------------------------------
  324.   #--------------------------------------------------------------------------
  325.   def update_target
  326.     if Input.trigger?(Input::B)
  327.       $game_system.se_play($data_system.cancel_se)
  328.       unless $game_party.item_can_use?(@item.id)
  329.         @itemlist_window.refresh
  330.       end
  331.       @itemlist_window.active = true
  332.       @target_window.visible = false
  333.       @target_window.active = false
  334.       @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  335.       return
  336.     end
  337.     if Input.trigger?(Input::C)
  338.       if $game_party.item_number(@item.id) == 0
  339.         $game_system.se_play($data_system.buzzer_se)
  340.         return
  341.       end
  342.       if @target_window.index == -1
  343.         used = false
  344.         for i in $game_party.actors
  345.           used |= i.item_effect(@item)
  346.         end
  347.       end
  348.       if @target_window.index >= 0
  349.         target = $game_party.actors[@target_window.index]
  350.         used = target.item_effect(@item)
  351.       end
  352.       if used
  353.         $game_system.se_play(@item.menu_se)
  354.         if @item.consumable
  355.           $game_party.lose_item(@item.id, 1)
  356.           @itemlist_window.draw_item(@itemlist_window.index)
  357.           @itemlist_window.set_item(@itemcommand_window.commands[@command_index])
  358.         end
  359.         @target_window.refresh
  360.         if $game_party.all_dead?
  361.           $scene = Scene_Gameover.new
  362.           return
  363.         end
  364.         if @item.common_event_id > 0
  365.           $game_temp.common_event_id = @item.common_event_id
  366.           $scene = Scene_Map.new
  367.           return
  368.         end
  369.       end
  370.       unless used
  371.         $game_system.se_play($data_system.buzzer_se)
  372.       end
  373.     return
  374.     end
  375.   end
  376. end
  377. #==============================================================================
  378. # ■ RPG追加定义,使用@符号分类
  379. #==============================================================================
  380. module RPG
  381.   class Weapon
  382.     def description
  383.       description = @description.split(/@/)[0]
  384.       return description != nil ? description : ''
  385.     end
  386.     def desc
  387.       desc = @description.split(/@/)[1]
  388.       return desc != nil ? desc : "普通物品"
  389.     end
  390.   end
  391.   class Item
  392.     def description
  393.       description = @description.split(/@/)[0]
  394.       return description != nil ? description : ''
  395.     end
  396.     def desc
  397.       desc = @description.split(/@/)[1]
  398.       return desc != nil ? desc : "普通物品"
  399.     end
  400.   end
  401.   class Armor
  402.     def description
  403.       description = @description.split(/@/)[0]
  404.       return description != nil ? description : ''
  405.     end
  406.     def desc
  407.       desc = @description.split(/@/)[1]
  408.       return desc != nil ? desc : "普通物品"
  409.     end
  410.   end
  411. end
  412. #==============================================================================
  413. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  414. #==============================================================================
复制代码

点评

谢谢大大了,您太客气了跪谢。  发表于 2014-1-17 19:02
可是大大,图片和物品坐标这样的话都要重新弄呀5555555555555。。。  发表于 2014-1-17 18:50

评分

参与人数 1梦石 +1 收起 理由
myownroc + 1 认可答案

查看全部评分

回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
90
在线时间
186 小时
注册时间
2010-6-24
帖子
111
8
 楼主| 发表于 2014-1-17 18:35:05 | 只看该作者
@恋′挂机 大大啊,谢谢您啊。似乎可以了。
能麻烦您把那个复杂物品脚本 修改的东西。
弄到1楼的复杂物品脚本里去么

点评

删掉你原来的复杂物品分类脚本即可(直接替换,是已经修改好的,"我那个"其实就是你用的那个分类脚本)  发表于 2014-1-17 18:40
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-28 03:12

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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