View Full Version : X-log if X amount of Z creature on screen
playmate
07-13-2016, 02:54 PM
So... let's say I want to instantly close the client if there are more than 6 rats on the screen... any other creature is okay in any number.
Anyone got the idea to write such a script? Would be greatly appreciated!
Tirell
07-13-2016, 05:53 PM
local maxmonsters = 6
local monsters =
{
["rat"] = true,
["orshaball"] = false,
["omrafir"] = false,
}
local function countMonsters()
local count = 0
for n, c in Creature.iMonsters() do
if monsters[n:lower()] then
count = count + 1
end
end
return count
end
Module("Exit", function(Exit)
if (countMonsters() > maxmonsters) then
wait(20, 50)
os.exit()
end
Exit:Delay(500)
end)
playmate
07-14-2016, 08:33 AM
local maxmonsters = 6
local monsters =
{
["rat"] = true,
["orshaball"] = false,
["omrafir"] = false,
}
local function countMonsters()
local count = 0
for n, c in Creature.iMonsters() do
if monsters[n:lower()] then
count = count + 1
end
end
return count
end
Module("Exit", function(Exit)
if (countMonsters() > maxmonsters) then
wait(20, 50)
os.exit()
end
Exit:Delay(500)
end)
Thanks :)
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.