kts.Suicide

Name

kts.Suicide – kill the current actor

Synopsis

kts.Suicide()

Description

Calling kts.Suicide() will instantly kill the current actor (as given by cxt.actor) and remove them from the map. A corpse will be left behind at their location.

The HOOK_KNIGHT_DAMAGE hook is also run at the same time.

Return Value

None.

Notes

kts.Suicide is usually used as the action function of a Control.

Bugs

kts.Suicide works regardless of whether the current actor is a knight, or some other type of creature. However, HOOK_KNIGHT_DAMAGE is called regardless of what type of creature the actor is. This could be considered a bug because, as the name suggests, HOOK_KNIGHT_DAMAGE is only meant to be called when knights are damaged, not other creature types.

In practice, however, kts.Suicide is only ever used with knights, and so the above bug does not cause any issues.

Examples

The standard "Suicide" control is implemented using this function: see controls.lua.

See Also

The cxt table