Lua GetItemCount

From ArcEmu-Wiki
Jump to: navigation, search

Contents

GetItemCount()

Description

Returns the number of items in a player's inventory to the NPC script. You can also use HasItem() if you are just looking for one non-stackable item. HasItem is a bool (if) command, must be used with an "if" statement. Examples and description here:

Usage

GetItemCount(ItemID)

Example

Used with HasItem:

function NPC_Count(Unit, Event)
  if player:HasItem(ItemID) then
     player:GetItemCount(ItemID)
end
end

Or, used without HasItem:

function NPC_Count(Unit, Event)
  if (player:GetItemCount(ItemID)) == 5 then
    Unit:SendChatMessage(14, 0, "Example")
end
end
Personal tools