| 
 
| 赞 | 0 |  
| VIP | 0 |  
| 好人卡 | 1 |  
| 积分 | 4 |  
| 经验 | 868 |  
| 最后登录 | 2014-6-14 |  
| 在线时间 | 628 小时 |  
 Lv2.观梦者 
	梦石0 星屑448 在线时间628 小时注册时间2011-9-27帖子3996 | 
| 本帖最后由 亿万星辰 于 2012-1-7 09:41 编辑 
 复制代码class Game_Party
  def item_can_use?(item_id)
    # 物品个数为 0 的情况
    if item_number(item_id) == 0
      # 不能使用
      return false
    end
    # 获取可以使用的时候
    occasion = $data_items[item_id].occasion
    # 战斗的情况
    if $game_temp.in_battle
      # 可以使用时为 0 (平时) 或者是 1 (战斗时) 可以使用
      return (occasion == 0 or occasion == 1)
    end
    # 可以使用时为 0 (平时) 或者是 2 (菜单时) 可以使用
    return (occasion == 0 or occasion == 2)
  end
end
$特定物品 = {1 => 1,15 => 2}  #箭头前为物品id 箭头后为特定角色id 英文半角逗号分隔
class Game_Party
  alias icu item_can_use?
  def item_can_use?(item_id,actor_id = 1000)
    occasion = $data_items[item_id].occasion
    if actor_id != 1000
      if $game_temp.in_battle && $特定物品.keys.include?(item_id)
        if actor_id == $特定物品[item_id] && item_number(item_id) != 0 && (occasion == 0 or occasion == 1)
          return  true
        else
          return false
        end
      end
    end
    icu(item_id)
  end
end
class Window_Item
  alias xtdf_initialize initialize
  def initialize(actor_id = 1000)
    @actor_id = actor_id
    xtdf_initialize
  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,@actor_id)
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    x = 4 + index % 2 * (288 + 32)
    y = index / 2 * 32
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    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(0, 0, 24, 24), opacity)
    self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
    self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
    self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  end
end
Game_Battle 3的这句话@item_window = Window_Item.new
 改为
 @item_window = Window_Item.new(@active_battler.id)
答案来源地址,18楼,逸豫大大~
 http://rpg.blue/forum.php?mod=vi ... E5%93%81&page=2
 | 
 |