• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Modifying player_storage

mobalized

New Member
Joined
Jan 29, 2017
Messages
6
Reaction score
0
Ultimately I am trying to make it so that some quests are already completed in ORTS in order to give new players access to some areas that they otherwise would not have the ability to use. In order to test adding the quest completion to players I have gone in through phpmyadmin and then edited the player_storage table to have a key (12540) which is for the Captain Haba Sea Serpent area, with a value of 6 which indicates completion. By doing so it does not gain access to the area. However, if I manually go there on a character and go through the quest process and I refresh the phpmyadmin player_storage page after each step I see the row for that player and key 12540 update from 1->2->3->4->5->6. So is there a separate location that this is also stored that I have missed?
 
Solution
Storages are cached into the servers memory and are only saved when the player logout or on server save. That's how almost everything works in TFS, so you can't expect to edit the database if the player is online and that this will update the cached information in the server.

It would be better if you gave those storages the first time they login there:
forgottenserver/login.lua at master · otland/forgottenserver · GitHub

Or if you wanna give the storages for people that already logged in you use another storage to help you do that inside login.lua:
LUA:
if player:getStorage(12345) <= 0 then
    player:setStorageValue(12345, 1)
    -- Add the storages you want here.
end
Storages are cached into the servers memory and are only saved when the player logout or on server save. That's how almost everything works in TFS, so you can't expect to edit the database if the player is online and that this will update the cached information in the server.

It would be better if you gave those storages the first time they login there:
forgottenserver/login.lua at master · otland/forgottenserver · GitHub

Or if you wanna give the storages for people that already logged in you use another storage to help you do that inside login.lua:
LUA:
if player:getStorage(12345) <= 0 then
    player:setStorageValue(12345, 1)
    -- Add the storages you want here.
end
 
Solution
Storages are cached into the servers memory and are only saved when the player logout or on server save. That's how almost everything works in TFS, so you can't expect to edit the database if the player is online and that this will update the cached information in the server.

It would be better if you gave those storages the first time they login there:
forgottenserver/login.lua at master · otland/forgottenserver · GitHub

Or if you wanna give the storages for people that already logged in you use another storage to help you do that inside login.lua:
LUA:
if player:getStorage(12345) <= 0 then
    player:setStorageValue(12345, 1)
    -- Add the storages you want here.
end
The login.lua is what I will be doing in the end but right now I'm just testing to make sure it gives the access to each quest area that I want. In regards to the way the server caches data I do realize that. I did however edit the storage when the character was online I believe. However I performed a server save, logged out, logged back in, and bounced the server and although it always showed the correct entry in the storage it never worked in game. I will double check whether I did it with the character offline or not but it didn't appear to work as I had tried.

And that was the problem. By having the character online when making the change it didn't matter whether it logged out and back in.
 
Last edited by a moderator:
Back
Top