Page 1 of 1

[SOLVED]Save a Quest Enabled Object between Scenes and Load Game

Posted: Thu Dec 31, 2020 10:55 am
by mschoenhals
Hi,
There's a part in my game where an NPC changes versions (after completing a quest and returning) so that some animation can be played out. The new version of the NPC is using Dialogue System Trigger with the relevant Quest Condition and an action that enables an important gameObject. This works perfectly provided the player doesn't change scenes and come back or save and reload. If the player does, the gameObject is no longer enabled.

The gameObject is tied to a quest (defeatOverlord). I've tried various ways to ensure that the gameObject state continues to be enabled when defeatOverlord is active but none seem to work. Do you have a suggestion?

Thanks very much for your help in advance.

Re: [HELP]Save a Quest Enabled Object between Scenes and Load Game

Posted: Thu Dec 31, 2020 11:11 am
by Tony Li
Hi,

Make sure your Dialogue Manager GameObject has a Dialogue System Saver component.

For discussion, let's say the two versions of the NPC are NPC1a and NPC1b. NPC1a starts active in the scene. When the player completes a quest NPC1a is deactivated and NPC1b is activated.

Add a Multi Active Saver component to an active GameObject in the scene. (It can be an empty GameObject.) Assign NPC1a and NPC1b to it, and set a unique Key. When the scene is saved -- either by a saved game or by leaving the scene -- the Multi Active Saver will record which version is active and which is inactive. When the scene is loaded -- either by loading a saved game or by re-entering the scene -- the Multi Active Saver will activate one and deactivate the other.

Re: [HELP]Save a Quest Enabled Object between Scenes and Load Game

Posted: Thu Dec 31, 2020 12:29 pm
by mschoenhals
Ok, that did take care of the missing GameObject. However, now both NPC1a and NPC1b show up in the scene if the player leaves and then comes back.

Re: [HELP]Save a Quest Enabled Object between Scenes and Load Game

Posted: Thu Dec 31, 2020 12:56 pm
by Tony Li
When the player leaves the scene, which version(s) are active?

Re: [HELP]Save a Quest Enabled Object between Scenes and Load Game

Posted: Thu Dec 31, 2020 1:54 pm
by mschoenhals
NPC1b is active. NPC1a is inactive.

Re: [HELP]Save a Quest Enabled Object between Scenes and Load Game

Posted: Thu Dec 31, 2020 2:21 pm
by Tony Li
Hi,

Can you share a screenshot of your Multi Active Saver component?

Re: [HELP]Save a Quest Enabled Object between Scenes and Load Game

Posted: Thu Dec 31, 2020 2:49 pm
by mschoenhals
Hi Tony,
I got it working. I ended up just using the Multi Active Saver component on the one gameObject and not on either of the NPC's. Looks like its working now.
Thanks for all your help! Happy New Year!

Re: [SOLVED]Save a Quest Enabled Object between Scenes and Load Game

Posted: Thu Dec 31, 2020 3:00 pm
by Tony Li
Glad you got it working! Happy New Year!