kts.AddMissile

Name

kts.AddMissile – add a missile (dagger, crossbow bolt, etc.) to the dungeon

Synopsis

kts.AddMissile(pos, dir, item_type, drop_after)

Description

Adds a missile to the dungeon at position pos travelling in direction dir. The missile will keep going until it hits something or reaches its maximum range.

The parameters of the missile (speed, range, damage, etc.) are determined by the given item_type.

When the missile hits its target (or runs out of range), if drop_after is true, an item of type item_type will be placed into the dungeon (if there is room for it) at the final square. If drop_after is false, the missile will simply vanish with no item being left behind.

Return Value

No value is returned.

Errors

Invalid inputs may raise an error.

If it is impossible to place a missile at position pos (e.g. because it is inside a wall), then no error is generated; the function just does nothing.

Notes

As usual, the dungeon position (pos argument) is represented by a Lua table containing two fields, x and y, for the dungeon x and y coordinates.

The cxt.originator value (i.e. the originator field from the cxt table) will be used to determine which player originally fired the missile (if any). This is used for attributing deaths and kills.

See Also

cxt

kts.ItemType