kts.Throw

Name

kts.Throw – throw an item from the actor's inventory (e.g. daggers)

Synopsis

kts.Throw()

result = kts.Can_Throw()

Description

If the actor (cxt.actor) is a knight, carrying at least one item of type cxt.item_type, then calling kts.Throw() will cause the knight to throw one item of the given type (e.g. a throwing dagger).

Throwing small items like daggers is not allowed while the knight is carrying a hand-held weapon (like a hammer or crossbow), so if the knight is currently carrying any item in their hands (other than the default sword), then the knight will drop their held item (as if kts.DropHeld had been called), instead of throwing.

kts.Can_Throw() returns true if the actor is a knight carrying at least one item of type cxt.item_type, or false otherwise.

Return Value

kts.Throw() returns nothing, and kts.Can_Throw() returns a boolean as described above.

Notes

kts.Throw and kts.Can_Throw are useful as the action and possible functions of a Control, respectively. In particular, this Control would usually be attached to a "throwable" item type (such as daggers).

Examples

The main example for this function is the standard "throwing dagger" item: see items.lua.

See Also

The cxt table

kts.Control

kts.ThrowOrShoot