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

Characters Save:

Derlexy

Intermediate OT User
Joined
Jun 29, 2011
Messages
219
Reaction score
101
Hey guys, i've one problem:
When i logout and login again with any character, the server doesn't save the equips, position and that things...
Someone can help me?
 
Check your character in the database. it should have a field called Save. If it's set to 1, it's a different problem. If it's set to 0, your AAC is likely to blame.
 
Check your character in the database. it should have a field called Save. If it's set to 1, it's a different problem. If it's set to 0, your AAC is likely to blame.
I've checked it... The field "save" are seted to '1' for all the characters!
So... i think isn't it....
 
Last edited:
check config.lua for a line related to character saving.
worldType = "pvp"
hotkeyAimbotEnabled = "yes"
protectionLevel = 1
killsToRedSkull = 3
killsToBlackSkull = 6
pzLocked = 60000
removeAmmoWhenUsingDistanceWeapon = "yes"
removeChargesFromRunes = "yes"
timeToDecreaseFrags = 24 * 60 * 60 * 1000
whiteSkullTime = 15 * 60 * 1000
stairJumpExhaustion = 2000
experienceByKillingPlayers = "no"
expFromPlayersLevelRange = 75
noDamageToSameLookfeet = "no"

ip = "192.168.0.14"
bindOnlyGlobalAddress = "no"
loginProtocolPort = 7171
gameProtocolPort = 7172
statusProtocolPort = 7171
maxPlayers = 0
motd = "Welcome to The Forgotten Server!"
onePlayerOnlinePerAccount = "yes"
allowClones = "no"
serverName = "Forgotten"
statusTimeout = 5000
replaceKickOnLogin = "yes"
maxPacketsPerSecond = 25

deathLosePercent = -1

housePriceEachSQM = 1000
houseRentPeriod = "never"

timeBetweenActions = 200
timeBetweenExActions = 1000

mapName = "forgotten"
mapAuthor = "Komic"

marketOfferDuration = 30 * 24 * 60 * 60
premiumToCreateMarketOffer = "yes"
checkExpiredMarketOffersEachMinutes = 60
maxMarketOffersAtATimePerPlayer = 100

mysqlHost = "localhost"
mysqlUser = "root"
mysqlPass = "7698740"
mysqlDatabase = "otserver"
mysqlPort = 3306
mysqlSock = ""
passwordType = "sha1"

allowChangeOutfit = "yes"
freePremium = "no"
kickIdlePlayerAfterMinutes = 15
maxMessageBuffer = 4
emoteSpells = "no"

rateExp = 5
rateSkill = 3
rateLoot = 2
rateMagic = 3
rateSpawn = 1

deSpawnRange = 2
deSpawnRadius = 50

staminaSystem = "yes"

warnUnsafeScripts = "no"
convertUnsafeScripts = "no"

defaultPriority = "high"
startupDatabaseOptimization = "no"

ownerName = ""
ownerEmail = ""
url = "http://otland.net/"
location = "Sweden"

enableLiveCasting = "yes"
liveCastPort = 7173
Don't have this line...
 
sounds like an issue in the source possibly. did you get your distro from the official github or did you get a custom distro from a forum?

As a workaround, you could make a logout creaturescript and call player:save() upon logout but it should be handled by the source.

something like this:
Code:
function onLogout(player)
player:save()
return true
end
If that doesn't work, there's definitely something wrong with the source and you should compile or download a new exe.
 
sounds like an issue in the source possibly. did you get your distro from the official github or did you get a custom distro from a forum?

As a workaround, you could make a logout creaturescript and call player:save() upon logout but it should be handled by the source.

something like this:
Code:
function onLogout(player)
player:save()
return true
end
If that doesn't work, there's definitely something wrong with the source and you should compile or download a new exe.
How exactly can i do it?
I've tried but i think something is wrong the way i've done it...
follow an ss:

Sem%20tiacutetulo_zpsukdqg7ti.png
 
hm. sounds like your onLogout is actually pulling cid. where did you download your distro? gonna need to figure out what version it is
 
I would have to recommend either downloading a new exe or compiling one. https://github.com/otland/forgottenserver

otherwise, perhaps try seeking assistance from the person who released it. The saving of characters occurs in player.cpp in onRemoveCreature, which calls to save the player using the save function in iologindata.cpp

I don't think it's anything in the datapack that's causing the issue.
 
I would have to recommend either downloading a new exe or compiling one. https://github.com/otland/forgottenserver

otherwise, perhaps try seeking assistance from the person who released it. The saving of characters occurs in player.cpp in onRemoveCreature, which calls to save the player using the save function in iologindata.cpp

I don't think it's anything in the datapack that's causing the issue.
Okey, i will download a new one, if it dont works i come back here...

@RazorBlade
In my player.cpp, the function is like that:

I'm nearby sure that by default TFS only saves characters at server save. You can add a script to save everything every 10 minutes, or to save the character at logoff/death.
 
I'm nearby sure that by default TFS only saves characters at server save. You can add a script to save everything every 10 minutes, or to save the character at logoff/death.
Okey, i will download a new one, if it dont works i come back here...

@RazorBlade
In my player.cpp, the function is like that:
Code:
void Player::onRemoveCreature(Creature* creature, bool isLogout)
{
Creature::onRemoveCreature(creature, isLogout);
if (creature == this) {
if (isLogout) {
loginPosition = getPosition();
}
lastLogout = time(nullptr);
if (eventWalk != 0) {
setFollowCreature(nullptr);
}
if (tradePartner) {
g_game.internalCloseTrade(this);
}
closeShopWindow();
clearPartyInvitations();
if (party) {
party->leaveParty(this);
}
g_chat->removeUserFromAllChannels(*this);
std::cout << getName() << " has logged out." << std::endl;
if (guild) {
guild->removeMember(this);
}
IOLoginData::updateOnlineStatus(guid, false);
bool saved = false;
for (uint32_t tries = 0; tries < 3; ++tries) {
if (IOLoginData::savePlayer(this)) {
saved = true;
break;
}
}
if (!saved) {
std::cout << "Error while saving player: " << getName() << std::endl;
}
}
}
https://github.com/otland/forgottenserver/blob/master/src/player.cpp
 
If i make this changes, ill need to recompile the server?

Well, i'm now compiling a new Server, following this tutorial:
https://otland.net/threads/compilin...-32-bits-pics-and-lots-of-explanation.204532/

But i've got some doubts... Where can i find an DataBase for the server? With all the tables and stuffs? How can i know the Server version?

Sorry by this noob questions, but i'm so far to be good with this things =P
 
Last edited:
Code:
void Player::onRemoveCreature(Creature* creature, bool isLogout)
{
    Creature::onRemoveCreature(creature, isLogout);

    if (creature == this) {
        if (isLogout) {
            loginPosition = getPosition();
        }

        lastLogout = time(nullptr);

        if (eventWalk != 0) {
            setFollowCreature(nullptr);
        }

        if (tradePartner) {
            g_game.internalCloseTrade(this);
        }

        closeShopWindow();

        clearPartyInvitations();

        if (party) {
            party->leaveParty(this);
        }

        g_chat->removeUserFromAllChannels(*this);

        std::cout << getName() << " has logged out." << std::endl;

        if (guild) {
            guild->removeMember(this);
        }

        IOLoginData::updateOnlineStatus(guid, false);

        bool saved = false;
        for (uint32_t tries = 0; tries < 3; ++tries) {
            if (IOLoginData::savePlayer(this)) {
                saved = true;
                break;
            }
        }

        if (!saved) {
            std::cout << "Error while saving player: " << getName() << std::endl;
        }
    }
}
https://github.com/otland/forgottenserver/blob/master/src/player.cpp

I tought he was talking about actually saving the character, but it's just about storing it for the next logging. Right?
 
What's the difference?
At TFS, by default, if I create a new character, go grab some exp, items and log out and in back I will continue from where I stoped, but if the server crashes nothing will be saved. It's like it store the progress in the memory while it's up, but need a proper save, like a daily server save to really save it.

edit

Just tested it, it actually don't happen as I described. What I think is weird, since players can easily abuse it if they discover a crash bug. Player X pass his valuable item for Player Y, Player Y relog to save his character, they crash the server, both Player X and Y have a copy of the item after it.
 
Back
Top