Thorn
Spriting since 2013
Hello guys, i have a script that summons a massive raid, the problem is that is not summoning the monsters and shows and error, the weird thing is that i have an exact copy for another raid, just changhing monsters, amount of monsters and positions and it works perfectly, idk why this one doesnt work
could anyone help me plz??
and the error is:
could anyone help me plz??
Lua:
local cfg = {
monsters = {'Ogre Brute','Ogre Savage','Ogre Shaman','Clomp','Vexclaw'},
area = {from = Position(3018, 514, 7), to = Position(3097, 505, 7)},
monsterCount = {min = 400, max = 500},
}
function onTime(interval)
broadcastMessage("Los ogros vienen a Pofulthorn a despellejar a quien se les cruze en el camino! Aprovecha de sacar items unicos de loot.", MESSAGE_STATUS_WARNING)
local spawned, iteration, mCount = 0, 0, math.random(cfg.monsterCount.min, cfg.monsterCount.max)
local maxIteration = mCount * 100
while spawned < mCount do
local spawnPosition = Position(math.random(cfg.area.from.x, cfg.area.to.x), math.random(cfg.area.from.y, cfg.area.to.y), cfg.area.from.z)
local tile = Tile(spawnPosition)
if tile and not tile:getHouse() and not tile:hasFlag(TILESTATE_PROTECTIONZONE) and not tile:hasFlag(TILESTATE_BLOCKSOLID) then
local monster = Game.createMonster(cfg.monsters[math.random(#cfg.monsters)], spawnPosition, true, true)
if monster then
spawned = spawned + 1
end
end
iteration = iteration + 1
if iteration >= maxIteration then -- detect and terminate infinite loop
break
end
end
return true
end
and the error is:
Code:
Lua Script Error: [GlobalEvent Interface]
data/globalevents/scripts/raids/ogres.lua:onTime
data/globalevents/scripts/raids/ogres.lua:12: bad argument #2 to 'random' (interval is empty)
stack traceback:
[C]: in ?
[C]: in function 'random'
data/globalevents/scripts/raids/ogres.lua:12: in function <data/globalevents/scripts/raids/ogres.lua:7>