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

Project1

 找回密码
 注册会员
搜索
查看: 2037|回复: 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,使用和转载请保留此信息
#==============================================================================

点评

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

Lv1.梦旅人

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

使用道具 举报

Lv1.梦旅人

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

似乎还是不行呢。

这个是道具栏界面

这个是礼品盒

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

点评

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

使用道具 举报

Lv1.梦旅人

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

点评

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

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-10 04:49

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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