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

need help with summon boss lever

Joined
Mar 7, 2017
Messages
46
Solutions
1
Reaction score
6
ok i have one script, The function is that when you click it, it creates a monster, it works very well but I want to put it in every 1 hour, is it possible? this is the script


Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local fromPos = {x = toPosition.x - 10, y = toPosition.y - 10, z = toPosition.z}
local toPos = {x = toPosition.x + 10, y = toPosition.y + 10, z = toPosition.z}
    local amount = 0
    for x = fromPos.x, toPos.x do
        for y = fromPos.y, toPos.y do
            for z = fromPos.z, toPos.z do
                local monster = getTopCreature({x=x,y=y,z=z}).uid
                if(isCreature(monster) == TRUE) then
                    if getCreatureName(monster) == "Melting Frozen Horror" then
                        amount = amount+1
                    end
                end
            end
        end
    end
    if amount >= 1 then
        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
        doPlayerSendCancel(cid, "You need to kill Melting Frozen Horror first before you can summen one again.")
        return true
    else
        doSummonCreature("Melting Frozen Horror", {x = toPosition.x - 1, y = toPosition.y + 1, z = toPosition.z})
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have summened Melting Frozen Horror.")
        doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
    end
        return true
end
 
Solution
my bad, you need to add "," on the end of storage line, also some parenthesis were missing
Lua:
local config = {
storage = 40000, --global storage index
interval = 60 -- delay in minutes to summon
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
local fromPos = {x = toPosition.x - 10, y = toPosition.y - 10, z = toPosition.z}
local toPos = {x = toPosition.x + 10, y = toPosition.y + 10, z = toPosition.z}
local int = (((getStorage(config.storage))-os.time())/60)
    local amount = 0
    for x = fromPos.x, toPos.x do
        for y = fromPos.y, toPos.y do
            for z = fromPos.z, toPos.z do
                local monster = getTopCreature({x=x,y=y,z=z}).uid
                if(isCreature(monster) == TRUE) then...
try this
Lua:
local config = {
storage = 40000 --global storage index
interval = 60 -- delay in minutes to summon
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
local fromPos = {x = toPosition.x - 10, y = toPosition.y - 10, z = toPosition.z}
local toPos = {x = toPosition.x + 10, y = toPosition.y + 10, z = toPosition.z}
local int = (getStorage(config.storage))-os.time())/60)
    local amount = 0
    for x = fromPos.x, toPos.x do
        for y = fromPos.y, toPos.y do
            for z = fromPos.z, toPos.z do
                local monster = getTopCreature({x=x,y=y,z=z}).uid
                if(isCreature(monster) == TRUE) then
                    if getCreatureName(monster) == "Melting Frozen Horror" then
                        amount = amount+1
                    end
                end
            end
        end
    end
    if amount >= 1 then
        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
        doPlayerSendCancel(cid, "You need to kill Melting Frozen Horror first before you can summen one again.")
    else
        if os.time() > getStorage(config.storage) then
            doSummonCreature("Melting Frozen Horror", {x = toPosition.x - 1, y = toPosition.y + 1, z = toPosition.z})
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have summened Melting Frozen Horror.")
            doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
            doSetStorage(config.storage, os.time()+60*interval)
        else
            doPlayerSendTextMessage(cid, 21, "You must wait "..string.format("%.2f", int).." minutes to summon again.")
        end
    end
    return true
end
maybe you could use getSpectators to search on arena for the boss instead of multiple for
 
try this
Lua:
local config = {
storage = 40000 --global storage index
interval = 60 -- delay in minutes to summon
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
local fromPos = {x = toPosition.x - 10, y = toPosition.y - 10, z = toPosition.z}
local toPos = {x = toPosition.x + 10, y = toPosition.y + 10, z = toPosition.z}
local int = (getStorage(config.storage))-os.time())/60)
    local amount = 0
    for x = fromPos.x, toPos.x do
        for y = fromPos.y, toPos.y do
            for z = fromPos.z, toPos.z do
                local monster = getTopCreature({x=x,y=y,z=z}).uid
                if(isCreature(monster) == TRUE) then
                    if getCreatureName(monster) == "Melting Frozen Horror" then
                        amount = amount+1
                    end
                end
            end
        end
    end
    if amount >= 1 then
        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
        doPlayerSendCancel(cid, "You need to kill Melting Frozen Horror first before you can summen one again.")
    else
        if os.time() > getStorage(config.storage) then
            doSummonCreature("Melting Frozen Horror", {x = toPosition.x - 1, y = toPosition.y + 1, z = toPosition.z})
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have summened Melting Frozen Horror.")
            doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
            doSetStorage(config.storage, os.time()+60*interval)
        else
            doPlayerSendTextMessage(cid, 21, "You must wait "..string.format("%.2f", int).." minutes to summon again.")
        end
    end
    return true
end
maybe you could use getSpectators to search on arena for the boss instead of multiple for


no work, have this probles in console

dsds.png
 
no work, have this probles in console

View attachment 40906
Lua:
local config = {
storage = 40000, --global storage index
interval = 60, -- delay in minutes to summon
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
local fromPos = {x = toPosition.x - 10, y = toPosition.y - 10, z = toPosition.z}
local toPos = {x = toPosition.x + 10, y = toPosition.y + 10, z = toPosition.z}
local int = (getStorage(config.storage))-os.time())/60)
    local amount = 0
    for x = fromPos.x, toPos.x do
        for y = fromPos.y, toPos.y do
            for z = fromPos.z, toPos.z do
                local monster = getTopCreature({x=x,y=y,z=z}).uid
                if(isCreature(monster) == TRUE) then
                    if getCreatureName(monster) == "Melting Frozen Horror" then
                        amount = amount+1
                    end
                end
            end
        end
    end
    if amount >= 1 then
        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
        doPlayerSendCancel(cid, "You need to kill Melting Frozen Horror first before you can summen one again.")
    else
        if os.time() > getStorage(config.storage) then
            doSummonCreature("Melting Frozen Horror", {x = toPosition.x - 1, y = toPosition.y + 1, z = toPosition.z})
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have summened Melting Frozen Horror.")
            doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
            doSetStorage(config.storage, os.time()+60*interval)
        else
            doPlayerSendTextMessage(cid, 21, "You must wait "..string.format("%.2f", int).." minutes to summon again.")
        end
    end
    return true
end
Try now, the config table was lefting the , in variables.
 
my bad, you need to add "," on the end of storage line, also some parenthesis were missing
Lua:
local config = {
storage = 40000, --global storage index
interval = 60 -- delay in minutes to summon
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
local fromPos = {x = toPosition.x - 10, y = toPosition.y - 10, z = toPosition.z}
local toPos = {x = toPosition.x + 10, y = toPosition.y + 10, z = toPosition.z}
local int = (((getStorage(config.storage))-os.time())/60)
    local amount = 0
    for x = fromPos.x, toPos.x do
        for y = fromPos.y, toPos.y do
            for z = fromPos.z, toPos.z do
                local monster = getTopCreature({x=x,y=y,z=z}).uid
                if(isCreature(monster) == TRUE) then
                    if getCreatureName(monster) == "Melting Frozen Horror" then
                        amount = amount+1
                    end
                end
            end
        end
    end
    if amount >= 1 then
        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
        doPlayerSendCancel(cid, "You need to kill Melting Frozen Horror first before you can summen one again.")
    else
        if os.time() > getStorage(config.storage) then
            doSummonCreature("Melting Frozen Horror", {x = toPosition.x - 1, y = toPosition.y + 1, z = toPosition.z})
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have summened Melting Frozen Horror.")
            doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
            doSetStorage(config.storage, os.time()+60*interval)
        else
            doPlayerSendTextMessage(cid, 21, "You must wait "..string.format("%.2f", int).." minutes to summon again.")
        end
    end
    return true
end
 
Solution
Hello, I am using The Forgotten Server, version 0.3.7_SVN (Crying Damson) (10.10)

Everything is the script works well!
But is there any way to make the script so only 1 can be summoned at a time, because as of right now if the monster moves from his position, more can be summoned.

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local fromPos = {x = 1182, y = 1124, z = 8}
local toPos = {x = 1182, y = 1124, z = 8}
    local amount = 0
    for x = fromPos.x, toPos.x do
        for y = fromPos.y, toPos.y do
            for z = fromPos.z, toPos.z do
                local monster = getTopCreature({x=x,y=y,z=z}).uid
                if(isCreature(monster) == TRUE) then
                    if getCreatureName(monster) == "demon lord" then
                        amount = amount+1
                    end
                end
            end
        end
    end
    if amount >= 1 then
        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
        doPlayerSendTextMessage(cid, 4, "You need to kill the demon lord first before you can summon one again.")
    else
            doSummonCreature("demon lord", {x = 1182, y = 1124, z = 8})
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have summened the demon lord.")
            doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
            doRemoveItem(item.uid, 1)
            return TRUE
            end
            end
 
Last edited:
Back
Top