• Sign up for TFS Icon Competition! The prize includes Otland Premium time and a medal, as well as obviously taking part in TFS history.
  • 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 Random

alcapone

New Member
Joined
Jan 13, 2021
Messages
39
Reaction score
3
Lua:
local config = {
    teleportId = 1387,
    days = {
        ["Saturday"] = {Position(33649, 31261, 11), Position(33647, 31254, 11)}, -- tanjis
        ["Friday"] = {Position(33558, 31282, 11), Position(33545, 31263, 11)}, -- jaul
        ["Sunday"] = {Position(33438, 31248, 11), Position(33419, 31255, 11)}, -- obujos
    }
}

local gray = GlobalEvent("gray island bosses")
function gray.onStartup()
    local day = config.days[os.date("%A")]
    if day then
        local item = Game.createItem(config.teleportId, 1, day[1])
        if item then
            item:setActionId(96355)
        end   
        
        
        if not item:isTeleport() then
            item:remove()
            return false
        end
        item:setDestination(day[2])
    end
    return true
end

gray:register()




I would like to change to not if, but on specific days, but at random
 
Solution
If I understood correctly..
Lua:
local config = {
    teleportId = 1387,
    bosses = {
        {Position(33649, 31261, 11), Position(33647, 31254, 11)}, -- tanjis
        {Position(33558, 31282, 11), Position(33545, 31263, 11)}, -- jaul
        {Position(33438, 31248, 11), Position(33419, 31255, 11)}, -- obujos
    }
}

local gray = GlobalEvent("gray island bosses")
function gray.onStartup()
    local randomBoss = config.bosses[math.random(#config.bosses)]
    local teleportal = Game.createItem(config.teleportId, 1, randomBoss[1])
    teleportal:setActionId(96355)
    teleportal:setDestination(randomBoss[2])
    return true
end

gray:register()

Xikini

I whore myself out for likes
Support Team
Joined
Nov 17, 2010
Messages
5,243
Solutions
333
Reaction score
3,358
If I understood correctly..
Lua:
local config = {
    teleportId = 1387,
    bosses = {
        {Position(33649, 31261, 11), Position(33647, 31254, 11)}, -- tanjis
        {Position(33558, 31282, 11), Position(33545, 31263, 11)}, -- jaul
        {Position(33438, 31248, 11), Position(33419, 31255, 11)}, -- obujos
    }
}

local gray = GlobalEvent("gray island bosses")
function gray.onStartup()
    local randomBoss = config.bosses[math.random(#config.bosses)]
    local teleportal = Game.createItem(config.teleportId, 1, randomBoss[1])
    teleportal:setActionId(96355)
    teleportal:setDestination(randomBoss[2])
    return true
end

gray:register()
 
Solution
Top