kts.TeleportRandom

Name

kts.TeleportRandom – teleport the actor to a random other knight's room

Synopsis

kts.TeleportRandom()

Description

If the actor (cxt.actor) is a knight, then a random other knight will be selected, and the actor will be teleported to a random square within that other knight's current room.

If no other knights exist in the dungeon (e.g. in a single player game), the current actor will be teleported to a random dungeon square instead.

Return Value

None.

Errors

No errors should be raised by this function (unless the cxt table is somehow invalid, perhaps).

It is possible that the randomly chosen other knight is in a room that is "full", so no valid teleport destination exists. In this case, no error is raised, but the teleport fails and nothing happens.

Notes

No sound effects or visual effects are performed by this function – if those are required, they must be done separately.

Examples

Scrolls use this function (as one of their possible effects); try searching for my_teleport in the standard Knights Lua files to see how this works.

See Also

The Context table

kts.Attractor