kts.SetBladeTrapOld

Name

kts.SetBladeTrapOld – set a blade trap in front of the current actor

Synopsis

kts.SetBladeTrapOld(bolt_item_type)

result = kts.Can_SetBladeTrapOld(bolt_item_type)

Description

If the current actor (cxt.actor) is approaching a door or chest tile, then calling kts.SetBladeTrapOld(bolt_item_type) will add a spring blade trap to that tile. When the door or chest is opened, the trap will trigger, firing a missile of the type bolt_item_type from the door or chest itself, in the direction towards where the actor is currently standing (i.e. in the opposite direction to the actor's current facing direction). Note that the bolt_item_type ItemType is used only for its missile properties (damage, speed etc.); this item itself will not appear in the dungeon.

In addition, when kts.SetBladeTrapOld() is called, if the actor is a knight carrying at least one of the item type given by cxt.item_type, then one of that item will be removed from the knight's inventory. This item will be put back into the dungeon if the trap is later successfully disarmed without triggering it.

kts.Can_SetBladeTrapOld(bolt_item_type) returns true if setting a blade trap is possible for the current actor at this time, or false otherwise.

Return Value

kts.SetBladeTrapOld returns nothing, and kts.Can_SetBladeTrapOld returns a boolean as described above.

Notes

kts.SetBladeTrapOld and kts.Can_SetBladeTrapOld are usually used as the action and possible functions (respectively) of a Control.

For a version that does not rely on values in the cxt table, see kts.SetBladeTrap.

Door/chest tiles can only contain one trap at a time. If a trap already exists when this function is called, then the existing trap will be triggered, and then the new trap will replace it.

Examples

The definition of the blade trap item in the standard Knights data files can be found in items.lua.

See Also

The cxt table

kts.SetBladeTrap

kts.SetPoisonTrap

kts.SetPoisonTrapOld