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

Disable raids TFS 1.3

Sasyia

Member
Joined
Mar 9, 2020
Messages
42
Solutions
3
Reaction score
20
Hello, I'm wanna trigger raids by using lua script instead of automatic XML one, but dunno how to disable it.
Already tried:
XML:
<raid name="Yeti" file="Carlin/yeti.xml" interval2="1" margin="1" enabled="no" />
or
<raid name="Yeti" file="Carlin/yeti.xml" interval2="1" margin="1" enabled="0" />

But it's getting executed anyway.
 
Solution
Would be great to see one.
LUA:
function onTime(interval)
    if Game.getStorageValue(1234) > os.time() then
        return true
    end
   
    -- Message broadcast
    addEvent(Game.broadcastMessage, 1000, "Rats are attacking near Trekolt Temple!", MESSAGE_STATUS_WARNING)
    addEvent(Game.broadcastMessage, 25000, "Rats attack continues!", MESSAGE_STATUS_WARNING)

    -- Area spawns - you can use a center and radius style or using fromPos/toPos style
    local centerPos, radius = Position(94, 126, 7), 5
    for _ = 1, 3 do
        local x = math.random(centerPos.x - radius, centerPos.x + radius)
        local y = math.random(centerPos.y - radius, centerPos.y + radius)
        addEvent(Game.createMonster, 2000, "Rat", Position(x...
is possible to disable some raids? I dont think so, but as my homie ranigod told me, why not use globalevents instead of some shitty xml files to declare this monsters and execute it as you want.
 
Thanks for both answers!
@FenX I can't execute Yeti eventin my lua script if entire line will be deleted :p
@StreamSide Ye I wan't to execute it using globalevents, but still need to register them in raids.xml
XML:
    <globalevent name="SpawnRaid" interval="5000" script="spawn/raids.lua"/>
 
Last edited:
Thanks for both answers!
@FenX I can't execute Yeti eventin my lua script if entire line will be deleted :p
@StreamSide Ye I wan't to execute it using globalevents, but still raids.xml file is executing
XML:
    <globalevent name="SpawnRaid" interval="5000" script="spawn/raids.lua"/>
use the globalevent as raid, I can show you an example.
 
Would be great to see one.
LUA:
function onTime(interval)
    if Game.getStorageValue(1234) > os.time() then
        return true
    end
   
    -- Message broadcast
    addEvent(Game.broadcastMessage, 1000, "Rats are attacking near Trekolt Temple!", MESSAGE_STATUS_WARNING)
    addEvent(Game.broadcastMessage, 25000, "Rats attack continues!", MESSAGE_STATUS_WARNING)

    -- Area spawns - you can use a center and radius style or using fromPos/toPos style
    local centerPos, radius = Position(94, 126, 7), 5
    for _ = 1, 3 do
        local x = math.random(centerPos.x - radius, centerPos.x + radius)
        local y = math.random(centerPos.y - radius, centerPos.y + radius)
        addEvent(Game.createMonster, 2000, "Rat", Position(x, y, 7))
    end

    -- You can generate a random amount of creatures
    local amount = math.random(4, 10)
    for _ = 1, amount do
        local x, y = math.random(89, 99), math.random(122, 130)
        addEvent(Game.createMonster, 30000, "Rat", Position(x, y, 7))
    end

    -- Single spawns
    addEvent(Game.createMonster, 15000, "Cave Rat", Position(93, 123, 7))
    addEvent(Game.createMonster, 30000, "Cave Rat", Position(98, 125, 7))
    addEvent(Game.createMonster, 30000, "Cave Rat", Position(94, 128, 7))

    Game.setStorageValue(1234, os.time() + 1 * 60 * 60 * 24) -- once executed set 1 day cooldown

    return true
end

XML:
    <!--
    <globalevent name="Test Raid" interval="1800" script="testraid.lua" />
    executed once every 30 minutes (30 * 60 = 1800 seconds)
    -->

see more here Move raid system to globalevents by ranisalt · Pull Request #1813 · otland/forgottenserver (https://github.com/otland/forgottenserver/pull/1813)
 
Solution
Back
Top