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

RevScripts Make it use one time each 60min, but for EACH Player not ALL.

Scrollia

Banned User
Joined
Apr 26, 2021
Messages
100
Reaction score
15
Lua:
local config = {
    actionId = 800,
    delay = 60 * 10, -- 1 hour
    delayPersistent = false,
    bosses = {
        { name = "Grim Reaper", pos = Position(1138, 1101, 4) }
    }
}

local movIn = MoveEvent()

function movIn.onStepIn(creature, item, position, fromPosition)
    local player = creature:getPlayer()
    if not player then
        return true
    end
    local playerId = player:getId()
    local ground = Tile(position):getGround()
    if ground then
        local now = os.time()
        local delay = config.delayPersistent and ground:getCustomAttribute("delay") or config.time
        if not delay or delay <= now then
            position:sendMagicEffect(CONST_ME_MAGIC_BLUE)
            for _, info in pairs(config.bosses) do
                Game.createMonster(info.name, info.pos)
            end
            if not config.delayPersistent then
                config.time = now + config.delay
            else
                ground:setCustomAttribute("delay", now + config.delay)
            end
        else
            position:sendMagicEffect(CONST_ME_POFF)
            player:sendTextMessage(MESSAGE_STATUS_DEFAULT, string.format("You must wait %d seconds to summon the bosses again.", delay - now))
        end
    end
    return true
end

movIn:aid(config.actionId)
movIn:register()


Hi, theres boss, where u can spanw it by each 60min, but everyone has 'block' time, i want to make it for each player each own 60min block.
 
Solution
try this
Lua:
local config = {
    actionId = 800,
    delay = 60 * 10, -- 1 hour
    delayPersistent = false,
    bosses = {
        { name = "Grim Reaper", pos = Position(1138, 1101, 4) }
    },
    storageId = 58312
}
local movIn = MoveEvent()
function movIn.onStepIn(creature, item, position, fromPosition)
    if not creature:isPlayer() then
        return true
    end
    local tile = Tile(position)
    if not tile or not tile:getGround() then
        return true
    end
    local ground   = tile:getGround()
    local player   = creature:getPlayer()
    local playerId = player:getId()
    local storage  = player:getStorageValue(config.storageId)
    if storage > os.time() then
        position:sendMagicEffect(CONST_ME_POFF)...
try this
Lua:
local config = {
    actionId = 800,
    delay = 60 * 10, -- 1 hour
    delayPersistent = false,
    bosses = {
        { name = "Grim Reaper", pos = Position(1138, 1101, 4) }
    },
    storageId = 58312
}
local movIn = MoveEvent()
function movIn.onStepIn(creature, item, position, fromPosition)
    if not creature:isPlayer() then
        return true
    end
    local tile = Tile(position)
    if not tile or not tile:getGround() then
        return true
    end
    local ground   = tile:getGround()
    local player   = creature:getPlayer()
    local playerId = player:getId()
    local storage  = player:getStorageValue(config.storageId)
    if storage > os.time() then
        position:sendMagicEffect(CONST_ME_POFF)
        player:sendTextMessage(MESSAGE_STATUS_DEFAULT, string.format("You must wait %d seconds to summon the bosses again.", storage - os.time()))
        return true
    end
    position:sendMagicEffect(CONST_ME_MAGIC_BLUE)
    for _, info in pairs(config.bosses) do
        Game.createMonster(info.name, info.pos)
    end
    player:setStorageValue(config.storageId, os.time() + config.delay)
    return true
end
movIn:aid(config.actionId)
movIn:register()
 
Solution
try this
Lua:
local config = {
    actionId = 800,
    delay = 60 * 10, -- 1 hour
    delayPersistent = false,
    bosses = {
        { name = "Grim Reaper", pos = Position(1138, 1101, 4) }
    },
    storageId = 58312
}
local movIn = MoveEvent()
function movIn.onStepIn(creature, item, position, fromPosition)
    if not creature:isPlayer() then
        return true
    end
    local tile = Tile(position)
    if not tile or not tile:getGround() then
        return true
    end
    local ground   = tile:getGround()
    local player   = creature:getPlayer()
    local playerId = player:getId()
    local storage  = player:getStorageValue(config.storageId)
    if storage > os.time() then
        position:sendMagicEffect(CONST_ME_POFF)
        player:sendTextMessage(MESSAGE_STATUS_DEFAULT, string.format("You must wait %d seconds to summon the bosses again.", storage - os.time()))
        return true
    end
    position:sendMagicEffect(CONST_ME_MAGIC_BLUE)
    for _, info in pairs(config.bosses) do
        Game.createMonster(info.name, info.pos)
    end
    player:setStorageValue(config.storageId, os.time() + config.delay)
    return true
end
movIn:aid(config.actionId)
movIn:register()
Works greate, thanks!
 
Back
Top