kts.GiveItem

Name

kts.GiveItem – give one or more 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. 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 as follows:

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.

The function is also used as part of the Staff Pile tile, to give a staff when the player selects "Take Staff". See tiles.lua.

See Also

kts.DropHeld

kts.GetItemInHand

kts.ItemType