Thorn
Spriting since 2013
Hello guys, im frustrated with a script i have, wich is a globalevent for massive raids, the thing about this, is that sometimes it summons all the amount of monsters i input, but sometimes it summons very few monsters, for instance i have a spider raid, and it should summon 2000 monsters in a full city, however now it just summoned no more than a hundred...when this happens, to run this again, i change the hour (works on exact hours every day) and do a reload and after that it summons the amount it should, this is the script, i really hope some of you have a clue of why this happens D:
i would appreaciate the help
i would appreaciate the help
Lua:
local cfg = {
monsters = {'Tarantula', 'Spider','Poison Spider','Giant Spider','Crystal Spider','The Old Widowevent','Hide'},
centerPos = Position(690, 1228, 7)
}
function onTime(interval)
broadcastMessage("Los horribles aracnidos atacan Azurthis!!!Derrota a las old widow para sacar tokens!", MESSAGE_STATUS_WARNING)
local pos = cfg.centerPos
local monsterCount = math.random(2000) -- How many monsters will spawn?
local spawned = 0
for i = 1, monsterCount do
local randX, randY = math.random(-120, 120), math.random(-50, 50)
local spawnPosition = Position(pos.x + randX, pos.y + randY, pos.z)
local tile = Tile(spawnPosition)
if tile and (not tile:getHouse()) and (not (tile:getCreatureCount() > 0)) and (not tile:hasFlag(TILESTATE_PROTECTIONZONE)) then
Game.createMonster(cfg.monsters[math.random(#cfg.monsters)], spawnPosition, true)
spawned = spawned + 1
end
end
return true
end
Code:
<globalevent name="arachnids" time="17:30:00" script="raids/arachnids.lua"/>