Page 1 of 1

Quest states after loading

Posted: Wed Sep 26, 2018 1:40 pm
by GorkaGames
If you leave your game and come back and load the game.... the quest and node comes back to his previous state. ok there...
But when the quest / node gets (let's supose) active again.... the messages and actions that correspond to that node / state got fired again? It's important to know this because if so it's easier to get the game the same as it was before, otherwise you have to controll it to activate / desactivate all your gameobjects again.

NOTE: (On my case it seems that I get the correct Quest / Node / State but the actions, messages, etc.. don't get fired.

Thanks

Re: Quest states after loading

Posted: Wed Sep 26, 2018 2:32 pm
by Tony Li
Hi,

That's correct, and by design. Otherwise the quests could incorrectly double-up on actions such as spawning monsters or giving items.

If you want to save any states, use Saver components. To save the active/inactive states of a GameObject, use an Active Saver component.

Re: Quest states after loading

Posted: Wed Sep 26, 2018 2:51 pm
by GorkaGames
Ok, on my case for manual crafting scenes I activae / desactivate generally a folder where there are for instance 10 enemies.
I'm adding the active saver script on one folde above this one (that is always active) to activate / desactivate the one where the enemies are.

But.... I also have the destroy script on each of this ones but aparently always see them activated (all of them even if I killed some).... so that.s not correct on my side....

Maybe its because the folder behind that activates the folder and the enemy AFTER the destroy script start to work? Can be that reason? If so... what can be the workaround? Thanks....

Re: Quest states after loading

Posted: Wed Sep 26, 2018 3:04 pm
by Tony Li
Here are two different ideas:

1. Put 10 ActiveSaver components on the folder, and assign a child enemy to each one. Deactivate the children. When you want to activate the children, activate each one individually. This will keep all the active information in sync.

2. Or try setting the Script Execution Order of ActiveSaver to run before DestructibleSaver. The folder's ActiveSaver will activate the children first. Then each child's DestructibleSaver will check if it has been destroyed.

In both cases, remember to make the save keys unique. If each GameObject has a unique name (e.g., Orc1, Orc2, etc.), then the keys will usually be unique automatically.

Re: Quest states after loading

Posted: Wed Sep 26, 2018 3:50 pm
by GorkaGames
I like option 2, I'll check in the unity manuals where can I set up the right order.
Regarding the keys.... I'm lost, I don't know what they are for.... I was leaving them blank (not filled).....

Any pleace where I can find info about the keys... I thinh I didn't see any on the save manual

Re: Quest states after loading

Posted: Wed Sep 26, 2018 3:57 pm
by GorkaGames
I don't finf the names on the editor setting as there are hundreds of scripts, can you please give me the exact complete rute (name) of the boths scripts above? (active and destructive)

Re: Quest states after loading

Posted: Wed Sep 26, 2018 4:09 pm
by Tony Li
Keys are arbitrary values that you can choose. The saved game data is like a dictionary. (If you're familiar with other save systems such as Easy Save, they work the same way.)

Let's say your GameObject is named "Orc" and you've put a Position Saver on it.

When you save the game, Orc's Position Saver will save its position under a key in the dictionary. When you load the game the Position Saver will use this key to look up its position in the dictionary.

If the Key field is blank, it will use the GameObject name ("Orc"). If you tick "Append Saver Type To Key", the key will be "Orc_PositionSaver". This is useful if Orc has several saver components, so you get keys like "Orc_PositionSaver", "Orc_DestructibleSaver", "Orc_HealthSaver", etc.

You can also assign your own value to the Key field, such as "pos-orc".

If you have two GameObjects named "Orc", you will need to assign unique keys. Otherwise each one will try to store their position in the same key ("Orc_PositionSaver").

There are two ways to assign unique keys:

1. Give each GameObject a unique name (Orc1, Orc2, Orc3, etc.),

2. Or, assign a unique value to each Key field ("Orc1-pos", "Orc2-pos", etc.).
GorkaGames wrote: Wed Sep 26, 2018 3:57 pm I don't finf the names on the editor setting as there are hundreds of scripts, can you please give me the exact complete rute (name) of the boths scripts above? (active and destructive)
ActiveSaver.cs and DestructibleSaver.cs.

There are two versions of each script. The version in the Wrappers folder is just a wrapper for the real version in Plugins / Pixel Crushers / Common / Scripts / Save System / Savers.

Re: Quest states after loading

Posted: Wed Sep 26, 2018 5:40 pm
by GorkaGames
Wouldn't be great to have a option to generate an aumatic randmon key so we don't have to deal with that?

Re: Quest states after loading

Posted: Wed Sep 26, 2018 5:49 pm
by GorkaGames
1. Wouldn't be great to have a option to generate an aumatic randmon key so we don't have to deal with that?


2. Option 2 its great but it doesn't work for me, I'have tested some times (I have already set up the scripting execution order.....) and only works if I have all the enemies on at the time the game starts.

So I'm a bit stuck on this .... I don't know how to have a parent folder (that has to be always on because the savers and listeners, a child folder to activate, and all the enemies that are child of them with the destroy savers.

Have you tested a solution like this and is working on your end? I mean a easy and practical one without adding the savers a lot of times....

How do you usually do on your projects or customers projects? May be I need a bit of inspiration :)

Re: Quest states after loading

Posted: Wed Sep 26, 2018 8:15 pm
by Tony Li
GorkaGames wrote: Wed Sep 26, 2018 5:49 pm1. Wouldn't be great to have a option to generate an aumatic randmon key so we don't have to deal with that?
The next update has a tool that does that. I'm putting together a patch that will handle the other dialogue UI issue more gracefully. I'll try to include this tool in the patch.

GorkaGames wrote: Wed Sep 26, 2018 5:49 pm2. Option 2 its great but it doesn't work for me, I'have tested some times (I have already set up the scripting execution order.....) and only works if I have all the enemies on at the time the game starts.

So I'm a bit stuck on this .... I don't know how to have a parent folder (that has to be always on because the savers and listeners, a child folder to activate, and all the enemies that are child of them with the destroy savers.

Have you tested a solution like this and is working on your end? I mean a easy and practical one without adding the savers a lot of times....

How do you usually do on your projects or customers projects? May be I need a bit of inspiration :)
Some devs write a custom saver script. Others use the Spawned Object Manager (see page 11 of the Save_System_Manual.pdf). Others add Savers to each GameObject. You can select all of the GameObjects at the same time and add a Destructible Saver in one step. Then, using the tool that I'll try to put in the patch, you can automatically assign a unique key to each one.