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

Announcements, support questions, and discussion for Quest Machine.
Post Reply
mschoenhals
Posts: 118
Joined: Thu Dec 19, 2019 7:38 am

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

Post 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.
Last edited by mschoenhals on Thu Dec 31, 2020 2:50 pm, edited 1 time in total.
User avatar
Tony Li
Posts: 21722
Joined: Thu Jul 18, 2013 1:27 pm

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

Post 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.
mschoenhals
Posts: 118
Joined: Thu Dec 19, 2019 7:38 am

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

Post 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.
User avatar
Tony Li
Posts: 21722
Joined: Thu Jul 18, 2013 1:27 pm

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

Post by Tony Li »

When the player leaves the scene, which version(s) are active?
mschoenhals
Posts: 118
Joined: Thu Dec 19, 2019 7:38 am

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

Post by mschoenhals »

NPC1b is active. NPC1a is inactive.
User avatar
Tony Li
Posts: 21722
Joined: Thu Jul 18, 2013 1:27 pm

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

Post by Tony Li »

Hi,

Can you share a screenshot of your Multi Active Saver component?
mschoenhals
Posts: 118
Joined: Thu Dec 19, 2019 7:38 am

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

Post 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!
User avatar
Tony Li
Posts: 21722
Joined: Thu Jul 18, 2013 1:27 pm

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

Post by Tony Li »

Glad you got it working! Happy New Year!
Post Reply