kts.GiveItem – give one or more backpack items to a knight
kts.GiveItem(knight, itemtype)
kts.GiveItem(knight, itemtype, number)
The first parameter (knight
) must be a Creature representing a knight, and the second parameter (itemtype
) must be an ItemType representing a "backpack" item (e.g. daggers or gems). The third parameter (number
) is optional; if present it must be a non-negative integer, but if absent it defaults to 1.
The effect of the function is that number
copies of the given itemtype
are added to the knight's backpack.
No value is returned.
Errors may result if the input parameters are invalid.
This function is used in the Knights Tutorial to create a custom "stuff bag" item. When the bag is picked up, kts.GiveItem
is called three times to give various items to the knight. See tutorial/init.lua.