Save System Question ;)

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
User avatar
HawkX
Posts: 147
Joined: Mon Feb 27, 2017 1:50 pm
Location: Quebec
Contact:

Save System Question ;)

Post by HawkX »

Hey again! :)
Hope you are doing well!

I have a question regarding the save system that comes with the Dialogue System...
I noticed there are 3 "save system" sub forums, but wasnt sure if this question should go in either of them since they might be from completely separate modules... Let me know if I should have written this elsewhere!! :)

The question is regarding the "keys"
I added an "active" saver as well as a "position" saver to some items drops from our game...
I did check the append save type to prevent "duplicate" key...
However, as is often the case, if there are 2 crates that produces a potion (clone) item, they both share the same name...
and since the key uses the name by default, when i reload, only 1 of the X amount of potion item remain on the ground...
Same thing happen with many other types of objects in the save system (3 destructible crates) for example...

When I took a "RPG class" from gamedev.tv, they also made a very rudimentary save system that I hesitated to use... and eventually opted to use yours (not only because of the AMAZING support you have been giving over the years, but because your save system seems a lot more robust, suporting destructibles, position, multiple save slots, etc...) --- That being said, in the basic tutorial I did, the "key" used to save was always uniquely generated "hash" and had 0 chances of ever having a duplicate... Why isnt yours doing the same thing? :) Or do you have a quick and easy solution I could implement to solve this?

As always, thanks a lot for your time and have a nice day!
User avatar
Tony Li
Posts: 22102
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save System Question ;)

Post by Tony Li »

Hi,

The Pixel Crushers save system gives you the option of specifying a key value or using a unique hash. To automatically add unique hashes to the savers in your scene, select menu item Tools > Pixel Crushers > Common > Save System > Assign Unique Keys....
User avatar
HawkX
Posts: 147
Joined: Mon Feb 27, 2017 1:50 pm
Location: Quebec
Contact:

Re: Save System Question ;)

Post by HawkX »

This looks really nice... but seems to only work on stuff that is already in the scene...
and not for items that are spawned (for example when breaking a crate)
Anyway to make that "unique key" setting permanant for every saver in every scene and (most importantly) every version of every prefab? :)
User avatar
Tony Li
Posts: 22102
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save System Question ;)

Post by Tony Li »

If you're spawning stuff, you may want to use the Spawned Object Manager. The folder Assets / Pixel Crushers / Common / Documentation has a save system manual that explains how to set up the Spawned Object Manager.
User avatar
HawkX
Posts: 147
Joined: Mon Feb 27, 2017 1:50 pm
Location: Quebec
Contact:

Re: Save System Question ;)

Post by HawkX »

This seems to work indeed... im getting errors on the restored items (because they were not spawned "their normal way" and not setup properly)... but i'll try to fix that :)

Final thing (for now) lol..
Any "suggestion" on how best to save "data" along with everything else...
like player stats, hp, mp, time played, inventory/equipments, (floats/ integers/ item(class),equipments/ etc.)
User avatar
Tony Li
Posts: 22102
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save System Question ;)

Post by Tony Li »

See: How To: Write Custom Savers.

If you're using an Asset Store product such as Opsive's Ultimate Character Controller or More Mountains' TopDown Engine, the Dialogue System's integrations for them include saver components.
User avatar
HawkX
Posts: 147
Joined: Mon Feb 27, 2017 1:50 pm
Location: Quebec
Contact:

Re: Save System Question ;)

Post by HawkX »

I used the unity 3rd person controller (from unity) as a start... but heavily modified it

The inventory system is pretty much the one from gamedev.tv in the "rpg course"

besides those two, not using anything else pre-made

for the stats, everything is stored manually in a public static class I created :)
User avatar
Tony Li
Posts: 22102
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save System Question ;)

Post by Tony Li »

Alright, then a simple custom saver script should do the trick.
User avatar
HawkX
Posts: 147
Joined: Mon Feb 27, 2017 1:50 pm
Location: Quebec
Contact:

Re: Save System Question ;)

Post by HawkX »

yeah thats what i was thinking...

just didnt know if you had any "custom saver" template hidden somewhere :D hehe...
User avatar
Tony Li
Posts: 22102
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save System Question ;)

Post by Tony Li »

There is! :-) The starter template is named SaverTemplate.cs. Just duplicate it, move it into your scripts folder, and customize it where the comments indicate. Then add it to a GameObject.
Post Reply