Hey there. First off I will NOT be using horses with my module, at all and I know that apparently can cause issues. How safe is it to save variables to the PC’s skin?
The module isn’t a PW but a DM’d campaign that I may automate and potentially release when the DM’d campaign is completed. There aren’t a lot of things I “need” to store persistently but there are some.
For example I want the player to have a chest / locker that will have it’s contents persist as just one example.
Any help or direction there would be welcome. Thanks,
I do it. It seems to work fine and is safe.
PC skins work fine. I use them all the time for variables, feats and other item properties that have nothing to do with horses.
It’s advisable to base your module OnClientEnter script on x3_mod_def_enter, to ensure that the skin is equipped as soon as the player joins the module.
I’m not aware of any issues with “not using horses”. By default, Paladins will still be able to summon mounts, but that’s harmless, though the spell can be disabled if you like.
They will be persistent as any other local is - ie save games are fine.
However in NWN:EE you can’t save variables to items and expect them to be back if you run a new instance of a module week 2 of your DM campaign.
You’d instead want to use the SQL functions to save things in a database. You can even serialise items like what you are suggesting. The pages on the lexicon may help with the basic commands: https://nwnlexicon.com/index.php?title=Category:Database_Functions
No, that’s not true. Variables on items (like the skin) save fine across server restarts. I use that for most of my PC specific persistence. Works like a champ on NWN:EE. This would be a huge change for them to make and would have messed up a lot of people.
You do need to turn off ELC on the server if you are using the skin or it gets deleted on login.
I haven’t used the new SQL based database but I think that’s a good improvement. You could certainly use that if you prefer.
Locals on the PC itself are not saved. That’s true for NWN and NWN:EE and has been.
Edit: I was thinking server, which this isn’t. So yeah, I guess LAN games are localvault only so probably does lose variables on items as jasperre was saying…
I have never used the database before. I assume that one would need to get (guessing mysql) up and running and then create and reference a database before using it. Anyone have a guide to help with that part of it? Not sure how to create that initial blank database.
1 Like
The database is now all self contained sqlite - if you use the standard campaign database functions you can also ignore learning sql itself.
For instance use this to set an integer you want to retrieve later: https://nwnlexicon.com/index.php?title=SetCampaignInt
If you want an example bit of code I’d post what you are aiming to do.
Really? That’s amazing actually. I am pretty well versed in SQL so it’s probably a case of my knowledge biting me on the ass there expecting it to be more complicated / harder than it needs to be!
So basically the first time I go to store a campaign integer it will create the database?
Here’s a question about that then, how does it tell the difference between different modules. Obviously I want different iterations of the same module to use the same database but what about to completely separate modules. How does it keep that straight or do I need to make sure I do that with variable names containing some sort of unique identifier?