RevScripts Random

alcapone

Member
Joined
Jan 13, 2021
Messages
44
Reaction score
5
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,407
Solutions
360
Reaction score
3,514
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