• 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.4.2] MAP CLEAN

OTcreator

Active Member
Joined
Feb 14, 2022
Messages
439
Solutions
1
Reaction score
48
Hello!
Is it possible to create a script and add as in older TFS to make, for example, clean happen at 12:00?
In TFS 1.4 I do not see a script responsible for cleaning the map in globalevents...
 
Solution
Do you have Server Save script on interval?
in globalevents/scripts add a serverave.lua
Lua:
local shutdownAtServerSave = false  -- leave true if you want to shut down the server
local cleanMapAtServerSave = false   -- leave true if you want to clear the map

local function serverSave()
    if shutdownAtServerSave then
        Game.setGameState(GAME_STATE_SHUTDOWN)
    else
        Game.setGameState(GAME_STATE_NORMAL)
    end

    if cleanMapAtServerSave then
        cleanMap()
    end

    saveServer()
end

local function secondServerSaveWarning()
    Game.broadcastMessage('Server is saving game in one minute. Please go to a safe place.', MESSAGE_STATUS_WARNING)
    addEvent(serverSave, 60000)
end

local function...
This link that I tested is functional and perfect. I'm also using TFS 1.4.2.

Do you have Server Save script on interval?
 
Do you have Server Save script on interval?
in globalevents/scripts add a serverave.lua
Lua:
local shutdownAtServerSave = false  -- leave true if you want to shut down the server
local cleanMapAtServerSave = false   -- leave true if you want to clear the map

local function serverSave()
    if shutdownAtServerSave then
        Game.setGameState(GAME_STATE_SHUTDOWN)
    else
        Game.setGameState(GAME_STATE_NORMAL)
    end

    if cleanMapAtServerSave then
        cleanMap()
    end

    saveServer()
end

local function secondServerSaveWarning()
    Game.broadcastMessage('Server is saving game in one minute. Please go to a safe place.', MESSAGE_STATUS_WARNING)
    addEvent(serverSave, 60000)
end

local function firstServerSaveWarning()
    Game.broadcastMessage('Server is saving game in 3 minutes. Please go to a safe place.', MESSAGE_STATUS_WARNING)
    addEvent(secondServerSaveWarning, 120000)
end

function onTime(interval)
    Game.broadcastMessage('Server is saving game in 5 minutes. Please go to a safe place.', MESSAGE_STATUS_WARNING)
    Game.setGameState(GAME_STATE_STARTUP)
    addEvent(firstServerSaveWarning, 120000)
    return not shutdownAtServerSave
end
in globalevents.xml
XML:
<globalevent name="ServerSave" interval="1800000" script="serversave.lua" />
f you activate the option to turn off the server, instead of interval="1800000" put time="04:55:00"
 
Solution
in globalevents/scripts add a serverave.lua
Lua:
local shutdownAtServerSave = false  -- leave true if you want to shut down the server
local cleanMapAtServerSave = false   -- leave true if you want to clear the map

local function serverSave()
    if shutdownAtServerSave then
        Game.setGameState(GAME_STATE_SHUTDOWN)
    else
        Game.setGameState(GAME_STATE_NORMAL)
    end

    if cleanMapAtServerSave then
        cleanMap()
    end

    saveServer()
end

local function secondServerSaveWarning()
    Game.broadcastMessage('Server is saving game in one minute. Please go to a safe place.', MESSAGE_STATUS_WARNING)
    addEvent(serverSave, 60000)
end

local function firstServerSaveWarning()
    Game.broadcastMessage('Server is saving game in 3 minutes. Please go to a safe place.', MESSAGE_STATUS_WARNING)
    addEvent(secondServerSaveWarning, 120000)
end

function onTime(interval)
    Game.broadcastMessage('Server is saving game in 5 minutes. Please go to a safe place.', MESSAGE_STATUS_WARNING)
    Game.setGameState(GAME_STATE_STARTUP)
    addEvent(firstServerSaveWarning, 120000)
    return not shutdownAtServerSave
end
in globalevents.xml
XML:
<globalevent name="ServerSave" interval="1800000" script="serversave.lua" />
f you activate the option to turn off the server, instead of interval="1800000" put time="04:55:00"
im using this script and it works very well, i did have to change the function "function onTime(interval)" from "onTime" to "onThink" to make it work, but i have a question, it doesnt clean the items in protected zones is there a way to make it be able to also clean protected zones from "trash" items in for an example depot/tempel?

(using tfs 1.4.2 10.98)
 
im using this script and it works very well, i did have to change the function "function onTime(interval)" from "onTime" to "onThink" to make it work, but i have a question, it doesnt clean the items in protected zones is there a way to make it be able to also clean protected zones from "trash" items in for an example depot/tempel?

You must enable it in config.lua

cleanProtectionZones = false
change to true
 
im using this script and it works very well, i did have to change the function "function onTime(interval)" from "onTime" to "onThink" to make it work, but i have a question, it doesnt clean the items in protected zones is there a way to make it be able to also clean protected zones from "trash" items in for an example depot/tempel?
Config.lua
cleanProtectionZones = true
 
im using this script and it works very well, i did have to change the function "function onTime(interval)" from "onTime" to "onThink" to make it work, but i have a question, it doesnt clean the items in protected zones is there a way to make it be able to also clean protected zones from "trash" items in for an example depot/tempel?

(using tfs 1.4.2 10.98)
Its so items on top of deposit dont get deleted
 
Its so items on top of deposit dont get deleted
Yep!


ill change the warnings telling people to not leave items they want on the ground etc etc should be more than enough for players to think "hmmm i should maybe pick this item up" hehe

since i dont really want the server to shutdown.
 
Yep!


ill change the warnings telling people to not leave items they want on the ground etc etc should be more than enough for players to think "hmmm i should maybe pick this item up" hehe

since i dont really want the server to shutdown.
yeah enjoy the crying that item got deleted and no way to trace it and people making gms dupe items or just loose very expensive items shit system. maybe reward people for cleaning deposit floors in some way bi binding onmoveitem to dustbin and timed so they only have to throw 1 rubbish get reward they wil put rest into bin hopoing there is more but no timed every 24-48-72 h but dont tell them that ;xd
Post automatically merged:

yeah enjoy the crying that item got deleted and no way to trace it and people making gms dupe items or just loose very expensive items shit system. maybe reward people for cleaning deposit floors in some way bi binding onmoveitem to dustbin and timed so they only have to throw 1 rubbish get reward they wil put rest into bin hopoing there is more but no timed every 24-48-72 h but dont tell them that ;xd
just look at what is most popular item on the ground floor of deposit and make it autodelete via script if it lies on ground for too long. instead.
if its fluids thjen just remove empty fluids and remove the item instead
 
yeah enjoy the crying that item got deleted and no way to trace it and people making gms dupe items or just loose very expensive items shit system. maybe reward people for cleaning deposit floors in some way bi binding onmoveitem to dustbin and timed so they only have to throw 1 rubbish get reward they wil put rest into bin hopoing there is more but no timed every 24-48-72 h but dont tell them that ;xd
Post automatically merged:


just look at what is most popular item on the ground floor of deposit and make it autodelete via script if it lies on ground for too long. instead.
if its fluids thjen just remove empty fluids and remove the item instead
i mean if that ever would happen i would simply tell them no.

i cant bend over to them just because they are crying, there is warnings they do realize that the map gets cleaned after playing for a while. if they would lose an item from the map getting cleaned, there isnt much i can or want to do about it to be fair.... i cant satisfy players for crying or atleast thats not how i would like to run my server.

its like having a big sign saying "THE ANIMAL BITES" and then still sticking ur finger in to see if it happens...
 
i mean if that ever would happen i would simply tell them no.

i cant bend over to them just because they are crying, there is warnings they do realize that the map gets cleaned after playing for a while. if they would lose an item from the map getting cleaned, there isnt much i can or want to do about it to be fair.... i cant satisfy players for crying or atleast thats not how i would like to run my server.

its like having a big sign saying "THE ANIMAL BITES" and then still sticking ur finger in to see if it happens...
If the server never restarts your last problem will be depot items anyways good luck.
 
If the server never restarts your last problem will be depot items anyways good luck.
Arent u a Lovely person to talk to. Christ The passiv agressive shit i see in this forum is crazy.

It will restart just not regularly. Im still trying to Learn and understand how a server functions who knows i might even change The server save its litteraly not a big deal especiallt with this script where i can turn it off n on =)

Thanks gl in life...
 
Arent u a Lovely person to talk to. Christ The passiv agressive shit i see in this forum is crazy.

It will restart just not regularly. Im still trying to Learn and understand how a server functions who knows i might even change The server save its litteraly not a big deal especiallt with this script where i can turn it off n on =)

Thanks gl in life...
If its passive it cant be aggressive i put Xor gate before it
 
Back
Top