• 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 TFS 1.0 Storage questions

Karain

Jack of all trades
Joined
Jul 9, 2009
Messages
338
Solutions
3
Reaction score
147
Location
Egypt
Hello again,

I noticed that you can't put storages for NPCs or Creatures anymore in TFS 1.0

Is there any alternative to give a value to a specific NPC and have it stick around even when the server is turned off? (global storages? writing the values into new txt files maybe?)

Also my other question: is there any way to add an array into a player's storage? or does it accept numbers only?

Thanks in advance.
 
Solution
When I was coding special NPC's I used global storages.
As far as I know, storages only accept integers.

Ohh nvm:
https://github.com/otland/forgottenserver/blob/master/schema.sql

Thats frightening, appears there are no global storages on TFS 1.0. At least not stored in the db.

A workaround is to just create a character in the GM account called Storage and reference his storage and use them as global storage. :p

It appears in the code that it has globalstorage, but: https://github.com/otland/forgottenserver/blob/master/data/global.lua#L244-254
It also appears to be a local list, which I assume is being flushed on every restart.
When I was coding special NPC's I used global storages.
As far as I know, storages only accept integers.

Ohh nvm:
https://github.com/otland/forgottenserver/blob/master/schema.sql

Thats frightening, appears there are no global storages on TFS 1.0. At least not stored in the db.

A workaround is to just create a character in the GM account called Storage and reference his storage and use them as global storage. :p

It appears in the code that it has globalstorage, but: https://github.com/otland/forgottenserver/blob/master/data/global.lua#L244-254
It also appears to be a local list, which I assume is being flushed on every restart.
 
Last edited:
Solution
When I was coding special NPC's I used global storages.
As far as I know, storages only accept integers.

Ohh nvm:
https://github.com/otland/forgottenserver/blob/master/schema.sql

Thats frightening, appears there are no global storages on TFS 1.0. At least not stored in the db.

A workaround is to just create a character in the GM account called Storage and reference his storage and use them as global storage. :p

It appears in the code that it has globalstorage, but: https://github.com/otland/forgottenserver/blob/master/data/global.lua#L244-254
It also appears to be a local list, which I assume is being flushed on every restart.

Indeed, i wonder why mark would remove such a big feature from TFS =/ but your idea of a reserved character for a makeshift global storage is good, i'll use it :) thanks a lot!
 
well the problem with creatures overall is that once they die, they get a new id, same as when the server restarts.
so setting a specific storage to a creature which exists more then once, could only be solved by it's id but then again we have the problem stated as first.

you could probably make use of I/O and dofile to load/save the stuff into a lua file.
so it's kinda like making a lua database.
 
Indeed, i wonder why mark would remove such a big feature from TFS =/ but your idea of a reserved character for a makeshift global storage is good, i'll use it :) thanks a lot!
The feature is still there just not saved as that option was less frequently needed anyway.
Still you have lua io function and database functions, so you can either dump the globalstorage table to a file or add a database table to save it.
Just use startup and shutdown events.
 
@Znote
Will only work if the player is online, just write it to a file when shutting down and load it on startup..
 
Back
Top