kts.GiveItem

Name

kts.GiveItem – give one or more backpack items to a knight

Synopsis

kts.GiveItem(knight, itemtype)

kts.GiveItem(knight, itemtype, number)

Description

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.

Return Value

No value is returned.

Errors

Errors may result if the input parameters are invalid.

Examples

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.

See Also

kts.ItemType