Results 1 to 5 of 5

Thread: GetDroppedItemList() owner return nil?

  1. #1
    Basic Member
    Join Date
    May 2014
    Posts
    270

    GetDroppedItemList() owner return nil?

    I tried to print the item owner of the dropped item, but it's always return nil even though one of the bot own the item
    Code:
    local listDrppedItem = GetDroppedItemList()
    
    	for _,item in pairs(listDrppedItem)
    	do
    		local Own = item.owner;
    		print(Own..item.item:GetName())
    		local item_name = item.item:GetName();
    		if IsPreciousItem(item_name) then
    			return BOT_MODE_DESIRE_HIGH;
    		elseif item.owner ~= npcBot then
    			return ( 0.0 );
    		end
    	end
    And here is the result
    Code:
    25742(5120.204419):  nilitem_blade_of_alacrity
    25741(5120.138600):  nilitem_blade_of_alacrity
    Did I do something wrong?

  2. #2
    Valve Developer
    Join Date
    Sep 2011
    Posts
    1,704
    Seems to work okay for me in a simple test. Is the unit that dropped the item visible?

  3. #3
    Basic Member
    Join Date
    May 2014
    Posts
    270
    Quote Originally Posted by ChrisC View Post
    Seems to work okay for me in a simple test. Is the unit that dropped the item visible?
    Owh... I see, so the owner have to be near the dropped item to make the item.owner doesn't return nil value?

  4. #4
    Valve Developer
    Join Date
    Sep 2011
    Posts
    1,704
    Right, enemy heroes need to be visible to access their handles.

    I can add a player entry to the table that lets you figure out whose item it is, even if that hero isn't visible.

  5. #5
    Basic Member
    Join Date
    May 2014
    Posts
    270
    Quote Originally Posted by ChrisC View Post
    Right, enemy heroes need to be visible to access their handles.

    I can add a player entry to the table that lets you figure out whose item it is, even if that hero isn't visible.
    OK, Thank you ChrisC

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •