How to save user data

Prairial

Chieftain
Joined
May 2, 2014
Messages
25
Location
China
For example, a new uu added to the game and it can build traps on plots. When user saves game, coordinates of the plots should be writen to the saved file so the traps can be rebuild after the game load again. But it seems no "save game" event in Events or GameEvents...
 
This is what we call "persistent data" and can be accomplished in a couple different ways. (I'm also experimenting with one) If I'm understanding you correctly though, you don't need it. Basically, you don't want your traps to disappear upon reloading a saved game? Well, no other improvement disappears, so why would yours?
 
Unless "traps' are not improvements. In that case, I'd suggest plot:SetScriptData() and plot:GetScriptData(). That can save and retrieve a text string associated with each plot (that is persisted with saves).
 
Unless "traps' are not improvements. In that case, I'd suggest plot:SetScriptData() and plot:GetScriptData(). That can save and retrieve a text string associated with each plot (that is persisted with saves).

Thank you, I'll try it later.
 
Back
Top Bottom