• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TFS 1.X+ Massive raid problem tfs 1.2

Thorn

Spriting since 2013
Joined
Sep 24, 2012
Messages
2,203
Solutions
1
Reaction score
921
Location
Chile
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??

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>
 
Lua:
area = {from = {x = 3018, y = 514, z = 7}, to = {x = 3097, y = 505, z = 7}},
^^
Ouch, thanks but didnt work

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>
 
got it, thats because first "y" value is higher than second value and lua math random takes lower number, higher number as args
just invert those "y" values
Lua:
Position(math.random(cfg.area.from.x, cfg.area.to.x), math.random(cfg.area.to.y, cfg.area.from.y), cfg.area.from.z)
 
got it, thats because first "y" value is higher than second value and lua math random takes lower number, higher number as args
just invert those "y" values
Lua:
Position(math.random(cfg.area.from.x, cfg.area.to.x), math.random(cfg.area.to.y, cfg.area.from.y), cfg.area.from.z)
Hello mate sorry the late response, something is wrong with the positions, the position i entered is correct but isnt working properly. If i use your line, there's no error but it doesnt summon monsters in the specific area, if i use original line, there are monsters but i get the error
 
Last edited:
Back
Top