• 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!

Lua Script summon

Azerty

Active Member
Joined
Apr 15, 2022
Messages
321
Solutions
4
Reaction score
34
I'm trying to make this script work, I need it to only summon the amount defined in maxMonster, but it summons the monsters infinitely, could anyone help me? And I also need you to summon 2 different monsters, you can use Demon as an example

Lua:
local function getRandomPosition(minPosition, maxPosition)
    local randomX = math.random(minPosition.x, maxPosition.x)
    local randomY = math.random(minPosition.y, maxPosition.y)
    local randomZ = math.random(minPosition.z, maxPosition.z)
    return Position(randomX, randomY, randomZ)
end

local function summon()
    local boss = false
    local bossId
    local count = 0
    local positionCenter = Position(33710, 31634, 14)
    local spectators = Game.getSpectators(positionCenter, false, false, 10, 10, 10, 10)
    local maxMonster = 3

    for _, creature in pairs(spectators) do
        if creature:isMonster() then
            if creature:getName():lower() == "goshnar's megalomania" then
                boss = true
                bossId = creature:getId()
            elseif creature:getName():lower() == "Greater Splinter of Madness" then
                count = count + 1
            end
        end
    end

    if boss and count < maxMonster then
        local minPosition = Position(33703, 31628, 14)
        local maxPosition = Position(33717, 31640, 14)
        local randomPosition = getRandomPosition(minPosition, maxPosition)
        Game.createMonster("Greater Splinter of Madness", randomPosition):registerEvent("fieryHearts")
    end

    if boss and count < maxMonster then 
        local randomDelay = math.random(40, 60) * 1000
        addEvent(summon, randomDelay)
    end
end
 
Back
Top