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

TFS 1.2 Change Map items by date

legadoss

New Member
Joined
Jun 1, 2014
Messages
142
Reaction score
4
Hello, i working on some Project.

I need a globalevent with date like:
2018.08.12 snow_map
2019.0.0 summer

autumn, summer, spring, winter

And i love if there will be table like

Summer: [2160 = newiditem], [2161 = newiditem]

All in map items 2160 and 2161 will be replaced with newitemid.

Thanks!
 
it would be 100x easier to just use RME instead of trying to even remotely do this with a script
if there was a script for this it would freeze your server for a while, probably longer than it would take to close server and swap map + restart it
to give you an example, this is a 2000x2000 square (only 1 floor) to transform 1 id of grass to a focus cape
running this to transform every 4526 id on the floor to 8871 took 723 milliseconds (0.72 seconds)
Lua:
local start = os.mtime()
local position = Position(0, 0, 7)
for x = 0, 2000 do
    position.x = x
    for y = 0, 2000 do
        position.y = y
        local tile = Tile(position)
        if tile then
            local ground = tile:getGround()
            if ground and ground:getId() == 4526 then
                ground:transform(8871)
            end
        end
    end
end
print("Operation complete in ".. os.mtime() - start .." milliseconds")

for a 5000x5000 map running the code on every single floor (0-15)
Lua:
local start = os.mtime()
local position = Position(0, 0, 0)
for x = 0, 5000 do
    position.x = x
    for y = 0, 5000 do
        position.y = y
        for z = 0, 15 do
            position.z = z
            local tile = Tile(position)
            if tile then
                local ground = tile:getGround()
                if ground and ground:getId() == 4526 then
                    ground:transform(8871)
                end
            end
        end
    end
end
print("Operation complete in ".. os.mtime() - start .." milliseconds")
completed in 58459 milliseconds (58.4 seconds)
note that this is only for 1 id and most of the iterations aren't transforming a grass ground
about 1~ second of actually changing and 57 seconds iterating through other tiles that don't have a grass tile to transform

TL;DR: use RME and use CTRL+Shift+F to replace items and swap the maps out instead of trying to use a script for this
 
Back
Top