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

Solved [TFS 1.0] Raids.lua

Sentinel3

New Member
Joined
Oct 16, 2014
Messages
180
Reaction score
0
Hi everyone,

I got an error when server tried to start raid.

Using: Lastest version of TFS (1.0)

Maybe I miss some function in /data/global.lua?

The error I got in console's server:
HTML:
Lua Script Error: [GlobalEvent Interface]
data/globalevents/scripts/spawn/raid.lua:onThink
data/globalevents/scripts/spawn/raid.lua:28: attempt to call global 'executeRaid' (a nil value)
stack traceback:
        [C]: in function 'executeRaid'
        data/globalevents/scripts/spawn/raid.lua:28: in function <data/globalevents/scripts/spawn/raid.lua:26>
[Error - GlobalEvents::think] Failed to execute event: raid

/data/globalevents/scripts/spawn/raid.lua
HTML:
local storage = 1344
local raids = {
        "Morgaroth",
        "Ghazbaran",
        "Undead Jester",
        "goblin",
        "Dryads",
        "Halloweenhare",
        "Hornedfox",
        "Necropharus",
        "Wolfsraid",
        "UndeadArmy",
        "UndeadDarashia",
        "The Old Widow",
        "Scarabs",
        "Rats",
        "Quara",
        "Pirates",
        "Orshabaal",
        "OrcsThais",
        "Ferumbras",
        "Elfs",
        "Demodras",
        "Barbarian"
}
function onThink(interval, lastExecution, thinkInterval)
        if getGlobalStorageValue(storage) == -1 or getGlobalStorageValue(storage) < os.time() then
                executeRaid(raids[math.random(1, #raids)])
                setGlobalStorageValue(storage, os.time() + 9 * 60 * 60)
        end
        return true
end
 
I would done something like this:
Code:
local storage = 1344
local raids = {
        'Morgaroth',
        'Ghazbaran',
        'Undead Jester',
        'goblin',
        'Dryads',
        'Halloweenhare',
        'Hornedfox',
        'Necropharus',
        'Wolfsraid',
        'UndeadArmy',
        'UndeadDarashia',
        'The Old Widow',
        'Scarabs',
        'Rats',
        'Quara',
        'Pirates',
        'Orshabaal',
        'OrcsThais',
        'Ferumbras',
        'Elfs',
        'Demodras',
        'Barbarian'
}

function onThink(interval, lastExecution, thinkInterval)
    if Game.getStorageValue(storage) > os.time() then
        return true
    end

        Game.startRaid(raids[math.random(#raids)])
        Game.setStorageValue(storage, os.time() + 9 * 60 * 60)
        return true
end
 
I would done something like this:
Code:
local storage = 1344
local raids = {
        'Morgaroth',
        'Ghazbaran',
        'Undead Jester',
        'goblin',
        'Dryads',
        'Halloweenhare',
        'Hornedfox',
        'Necropharus',
        'Wolfsraid',
        'UndeadArmy',
        'UndeadDarashia',
        'The Old Widow',
        'Scarabs',
        'Rats',
        'Quara',
        'Pirates',
        'Orshabaal',
        'OrcsThais',
        'Ferumbras',
        'Elfs',
        'Demodras',
        'Barbarian'
}

function onThink(interval, lastExecution, thinkInterval)
    if Game.getStorageValue(storage) > os.time() then
        return true
    end

        Game.startRaid(raids[math.random(#raids)])
        Game.setStorageValue(storage, os.time() + 9 * 60 * 60)
        return true
end

Got this error with your remake script:
HTML:
Lua Script Error: [GlobalEvent Interface]
data/globalevents/scripts/spawn/raid.lua:onThink
data/globalevents/scripts/spawn/raid.lua:27: attempt to compare number with nil
stack traceback:
        [C]: in function '__lt'
        data/globalevents/scripts/spawn/raid.lua:27: in function <data/globalevents/scripts/spawn/raid.lua:26>
[Error - GlobalEvents::think] Failed to execute event: raid
 
Code:
local storage = 1344
local raids = {
        'Morgaroth',
        'Ghazbaran',
        'Undead Jester',
        'goblin',
        'Dryads',
        'Halloweenhare',
        'Hornedfox',
        'Necropharus',
        'Wolfsraid',
        'UndeadArmy',
        'UndeadDarashia',
        'The Old Widow',
        'Scarabs',
        'Rats',
        'Quara',
        'Pirates',
        'Orshabaal',
        'OrcsThais',
        'Ferumbras',
        'Elfs',
        'Demodras',
        'Barbarian'
}

function onThink(interval, lastExecution, thinkInterval)
    local globalStor = Game.getStorageValue(storage)
    if globalStor and globalStor > os.time() then
        return true
    end

    Game.startRaid(raids[math.random(#raids)])
    Game.setStorageValue(storage, os.time() + 9 * 60 * 60)
    return true
end
 
Back
Top