kts.SetStuffRespawning

Name

kts.SetStuffRespawning – set automatic item respawning

Synopsis

result = kts.SetStuffRespawning(items, respawn_delay)

Description

This configures "stuff respawning" for the next Knights game.

The first parameter should be a list of ItemTypes.

The second parameter is a respawn delay in milliseconds.

Every time an item of one of the listed types is removed from the dungeon (e.g. a potion being drunk, or a scroll being read), a timer equal to the respawn delay, divided by the number of players in the game, is started. When the timer expires, the item is respawned at a random location.

The reason for dividing by the number of players is that this ensures faster respawning when there are many knights, and therefore (presumably) potions and scrolls are being consumed more quickly.

Return Value

No value is returned.

Errors

Errors can be raised if the input list is not a list of ItemTypes, or the respawn delay is not an integer.

Examples

The following is a simplified version of the Lua code that runs when "Stuff Respawning: Medium" is selected in a standard Knights game:

respawn_items_list = {i_potion, i_scroll}
kts.SetStuffRespawning(respawn_items_list, 480 * 1000)

In a two player game, this means that every potion and scroll will respawn (at a new, random location) exactly 4 minutes (240 seconds) after it had been consumed.

See Also

kts.ItemType

kts.SetLockpickSpawn