Meu deus, que script gigante e mal otimizado. Tem umas variáveis que eu não descobri de onde surgiram. Também você usou um while quando podia usar um for.
local raids = {
{name = "Monstros de fogo", monsters = {"Demon", "Dragon Lord", "Fire Devil"}, boss = "Orshabaal", fromPos = {x=150, y=37, z=7}, toPos = {x=157, y=42, z=7}, dates = {"Thursday-15:00", "Saturday-22:12"}, maxMonsters = 15, timeBoss = 60},
{name = "Dragons", monsters = {"Dragon", "Dragon Lord", "Dragon Hatchling"}, boss = "Demodras", fromPos = {x=1, y=1, z=1}, toPos = {x=1, y=1, z=1}, dates = {"Monday-12:01", "Sunday-20:10"}, maxMonsters = 20, timeBoss = 120},
}
-- http://stackoverflow.com/questions/18093728/is-there-any-performance-value-in-creating-local-copies-of-lua-functions
local r = math.random
function doCreateMonsterIfWalkable(monster, pos)
(getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 or getTopCreature(pos).uid > 0 or isCreature(getTopCreature(pos).uid) or getTileInfo(pos).protection or hasProperty(getThingFromPos(pos).uid, 3) or hasProperty(getThingFromPos(pos).uid, 7)) and doCreateMonster(raid.monsters[monster], pos)
end
function onThink(interval, lastExecution, thinkInterval)
for _, raid in pairs(raids) do
if table.find(raid.dates, os.date("%A-%H:%M")) then
local spawn_time = 60000, spawn_boss = raid.maxMonsters + (raid.timeBoss << 1)) * 500
addEvent(doBroadcastMessage, 60000, "A invasao de " .. raid.name .. " teve inicio!")
addEvent(doBroadcastMessage, spawn_boss, "O boss " .. raid.boss .. " chegou na invasao!")
for i = 1, raid.maxMonsters do
addEvent(doCreateMonsterIfWalkable(raid.monsters[r(1, #raid.monsters)], {x = r(raid.fromPos.x, raid.toPos.x), y = r(raid.fromPos.y, raid.toPos.y), z = r(raid.fromPos.z, raid.toPos.z)}), spawn_time)
spawn_time = spawn_time + 500
end
addEvent(doCreateMonsterIfWalkable(raid.boss, {x = r(raid.fromPos.x, raid.toPos.x), y = r(raid.fromPos.y, raid.toPos.y), z = r(raid.fromPos.z, raid.toPos.z)}, spawn_boss)
end
end
return true
endMudei umas coisas de cabeça, se não der me avisa.