kts.GetItemInHand – get the current item carried by a creature (if any)
result = kts.GetItemInHand(creature)
This returns the ItemType corresponding to the item held by the given creature, or nil
if the creature is not holding an item (e.g. a vampire bat).
If the input is nil
then nil
is returned.
An ItemType userdata object, or nil
, is returned.
If the input is neither nil
nor a valid Creature then an error is raised.
One example of using this function can be found in the Lua code for the "destroy book with wand" quest that ships with the game. When the special pentagram is hit, the code uses kts.GetItemInHand
to figure out whether the knight is carrying the wand or not. See quest_funcs.lua.