kts.SetPoisonTrapOld

Name

kts.SetPoisonTrapOld – set a poison trap in front of the current actor

Synopsis

kts.SetPoisonTrapOld()

result = kts.Can_SetPoisonTrapOld()

Description

If the current actor (cxt.actor) is approaching a door or chest tile, then calling kts.SetPoisonTrapOld() will add a poison needle trap to that tile. When the door or chest is opened, the trap will trigger, poisoning the creature that opened it.

Also, when kts.SetPoisonTrapOld() 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 type 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_SetPoisonTrapOld() returns true if setting a poison trap is possible for the current actor at this time, or false otherwise.

Return Value

kts.SetPoisonTrapOld returns nothing, and kts.Can_SetPoisonTrapOld returns a boolean as described above.

Notes

kts.SetPoisonTrapOld and kts.Can_SetPoisonTrapOld 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.SetPoisonTrap.

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 poison trap item in the standard Knights data files can be found in items.lua.

See Also

The cxt table

kts.SetPoisonTrap

kts.SetBladeTrap

kts.SetBladeTrapOld