kts.LimitMonster – set a maximum allowed number for a particular monster type
kts.LimitMonster(monster_type, limit)
Sets the maximum number of monsters of a given type that can exist in the dungeon at any one time. The first argument should be a MonsterType and the second argument should be the limit value (an integer).
Note that if monsters are placed "manually" using kts.AddMonster then it is possible to exceed the maximum; that function ignores any monster limits that are in place. However, the "automatic" monster generation (via kts.AddMonsterGenerator or kts.SetZombieActivity) will respect the limits, and will not generate further monsters if the monster limit has already been reached.
This function can only be called during game setup – it is not possible to change the monster limits mid-game.
No value is returned.
An error results if the input parameters are not valid.
If the limit value is set to a negative number, then that is the same as not setting a limit at all.
This function is used in the standard Knights Lua files to limit the number of vampire bats, based on the "Number of Bats" menu setting. See dungeon_setup.lua and menus.lua.