Hi tony!
it is possible to save a database in particular, im using multi database and i allways have 2 database loaded, and i switch one of them between chapters, i think the save system work over a big one database where all the databases are loaded right?
thanks
save multidatabase
Re: save multidatabase
Hi Alfonso,
The save system saves the Lua environment. When you load an extra database, it adds its data to the Lua environment. When you unload the database, it removes its data from the Lua environment.
Since the save system saves the Lua environment, it saves the runtime data of all loaded databases.
Many people who use multiple databases use a main database that's always loaded (and assigned to the Dialogue Manager's Initial Database field). This contains "global" information that you always want to include in saved games.
Then they load and unload other databases as they move between chapters, villages, planets, etc. These other databases contain data that's only used in that chapter or location and don't need to remember anything when leaving. If you need to remember something -- for example, a choice the player made on another planet -- put that data in the main database.
If you really need to save only one database, you could try this:
1. Save the entire Lua environment:
2. Remove all the other databases:
3. Get the Lua environment:
4. Add the other databases back, and restore the data:
The saved data for your one database will be in the data variable.
But, given the way that the Dialogue System works, you probably don't want to save it like this.
The save system saves the Lua environment. When you load an extra database, it adds its data to the Lua environment. When you unload the database, it removes its data from the Lua environment.
Since the save system saves the Lua environment, it saves the runtime data of all loaded databases.
Many people who use multiple databases use a main database that's always loaded (and assigned to the Dialogue Manager's Initial Database field). This contains "global" information that you always want to include in saved games.
Then they load and unload other databases as they move between chapters, villages, planets, etc. These other databases contain data that's only used in that chapter or location and don't need to remember anything when leaving. If you need to remember something -- for example, a choice the player made on another planet -- put that data in the main database.
If you really need to save only one database, you could try this:
1. Save the entire Lua environment:
Code: Select all
string allData = PersistentDataManager.GetSaveData();
Code: Select all
DialogueManager.RemoveDatabase(someDatabase); // Repeat for all databases except the one to save.
Code: Select all
string data = PersistentDataManager.GetSaveData();
Code: Select all
DialogueManager.AddDatabase(someDatabase); // Repeat for all.
PersistentDataManager.ApplySaveData(allData);
But, given the way that the Dialogue System works, you probably don't want to save it like this.
Re: save multidatabase
mmm then no matter in which database was the data but if the Lua enviaroment have it?
i mean, i have a _global one where is all the quests, variables, and more, but in each conversation (the others databases) I have a Count value to know how many times you speak to a npc and with this value say one thing o another.
so if i for example keep all the lua environment, its ok if i have some data of a database that is not loaded? that can produce an error or something?
i mean, i have a _global one where is all the quests, variables, and more, but in each conversation (the others databases) I have a Count value to know how many times you speak to a npc and with this value say one thing o another.
so if i for example keep all the lua environment, its ok if i have some data of a database that is not loaded? that can produce an error or something?
Re: save multidatabase
Hi Alfonso,
It's okay to have the extra data. It shouldn't produce any errors.
It's okay to have the extra data. It shouldn't produce any errors.
Re: save multidatabase
great them i think is more easy to have a big luaEnvironment with all player progress.
thanks for all men
thanks for all men