GetItemPossessor(object)
Get the creature or object who possesses a specified item.
object GetItemPossessor( object oItem );
Parameters
oItem
Target item.
Description
Returns the object which has oItem in its inventory.
Returns OBJECT_INVALID if item was not found in any creature's inventory.
Remarks
Things are a bit complicated if you have multiple copies of an item, all with the same tag. If you want to get the nearest creature which possesses the item, you can't just use GetNearestObjectByTag() to identify the item, because this function does not work on objects in a creature's inventory.
You have to use GetObjectByTag(), using the "nNth" argument to cycle through all copies in the game. Then use GetItemPossessor() to determine the owner of each item, and GetDistanceToObject() to determine which creature is nearest.
Version
1.28
See Also
categories: | Get Data from Creature Functions | Inventory Functions |
author: Jason Harris, editor: Charles Feduke
Send comments on this topic.