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

Lua Script inundate soulwar

Azerty

Active Member
Joined
Apr 15, 2022
Messages
307
Solutions
4
Reaction score
31
I'm trying to create soulwar's inundate script, does anyone know how to remove the inundate map? The lever is for reference only.

Lua:
local positions = {
    Position(33862, 30999, 8)
}

function onThink(interval, lastExecution)
    local item
    for i = 1, #positions do
        item = Tile(positions[i]):getThing(1)
        if item and isInArray({1945, 1946}, item.itemid) then
            item:transform(item.itemid == 1945 and 1946 or 1945)
            if item.itemid == 1946 then
                Game.loadMap('data/world/inundate/inundate.otbm')
            end
        end
    end

    return true
end
 
To remove the inundate map, you can use the Game.unloadMap() function. Here's the updated script with the modification:

local positions = {
Position(33862, 30999, 8)
}

function onThink(interval, lastExecution)
local item
for i = 1, #positions do
item = Tile(positions):getThing(1)
if item and isInArray({1945, 1946}, item.itemid) then
item:transform(item.itemid == 1945 and 1946 or 1945)
if item.itemid == 1946 then
Game.loadMap('data/world/inundate/inundate.otbm')
else
Game.unloadMap('data/world/inundate/inundate.otbm')
end
end
end

return true
end


This code will unload the inundate map if the lever is pulled back to its original position.

—not tested—
 
To remove the inundate map, you can use the Game.unloadMap() function. Here's the updated script with the modification:



This code will unload the inundate map if the lever is pulled back to its original position.

—not tested—
Lua Script Error: [GlobalEvent Interface]
data/globalevents/scripts/inundate.lua:eek:nThink
data/globalevents/scripts/inundate.lua:8: attempt to index a nil value
stack traceback:
[C]: in function '__index'
data/globalevents/scripts/inundate.lua:8: in function <data/globalevents/scripts/inundate.lua:5>
[Error - GlobalEvents::think] Failed to execute event: inundate
 
Back
Top