[Solved] Invector + Quest Machine + Dialogue System Save System

Announcements, support questions, and discussion for Quest Machine.
KingCeryn
Posts: 70
Joined: Sun Aug 23, 2020 5:12 pm

[Solved] Invector + Quest Machine + Dialogue System Save System

Post by KingCeryn »

So I'm having some trouble getting my character that uses both Quest Machine AND Dialogue System to use the save system properly, in both the Template Demo scenes for each separate integration, the save system works- however in my test scene that uses both, Whenever i try a test save and load, the whole thing breaks. The camera doesnt follow the player, and all sorts of other issues, and I was wondering if theres something that specifically needs to be done to get them both working?
Last edited by KingCeryn on Mon Jan 24, 2022 5:32 pm, edited 1 time in total.
User avatar
Tony Li
Posts: 21928
Joined: Thu Jul 18, 2013 1:27 pm

Re: Invector + Quest Machine + Dialogue System Save System

Post by Tony Li »

Hi,

Nothing special needs to be done.

Are there any errors or warnings in the Console window?

Is your camera tagged MainCamera?

Are you saving and loading while a conversation is active?
KingCeryn
Posts: 70
Joined: Sun Aug 23, 2020 5:12 pm

Re: Invector + Quest Machine + Dialogue System Save System

Post by KingCeryn »

Hey no im just doing basic movement tests, like walking across the scene and saving, then back and loading. I'll screenshot the errors below. The Main Cam is the same setup as the Invector Camera. Basically when i load a save, the new vThirdpersonCamera just stays in the same place at 0,0,0 and doesnt follow the player.

EDIT: it looks like I've solved most of the errors, the main issue is I'm using a modified vThirdPersonCamera script that uses Cinemachine, and that seems to be causing some issues when reloading the scene.
Is there anything in the Invector bridges that deal with the camera? If not its probably on the Invector side then, i can look there

EDIT: Definitely looks like its on the Invector vCinemachine integration they have, so ill try and track it down there. Thanks!
User avatar
Tony Li
Posts: 21928
Joined: Thu Jul 18, 2013 1:27 pm

Re: Invector + Quest Machine + Dialogue System Save System

Post by Tony Li »

Hi,

The DS and QM integrations call InvectorPlayerUtility.PausePlayer() when starting a conversation or showing the journal. This method checks if the player is using the mouse. If so, it shows the mouse cursor so the player can select dialogue responses, etc. When the UI (conversation or journal) is done, the integrations call InvectorPlayerUtility.UnpausePlayer() to hide the mouse again.
KingCeryn
Posts: 70
Joined: Sun Aug 23, 2020 5:12 pm

Re: Invector + Quest Machine + Dialogue System Save System

Post by KingCeryn »

Hey, so I've actually solved the camera issue now, but it looks like whenever i reload a scene or a save, my player loses all references to the previous version of the QuestMachine or DialogueManager objects.

For instance the "DialogueSystemEvents" component on my player is set to do a few things- "fade-out the HUD," "lock the player," "enable an animator bool," etc.
But when i reload the scene or a save, it no longer works. Could this be related to the "only have one instance in the scene" option? I.E. the player in the scene is referencing an instance of the Dialogue Manager that gets deleted by the reload?
I also lose all references to the Quest Machine Canvas, which I add directly to an Array of "Canvases" on my Player.

EDIT: Im guessing it could be related to the "Don't Destroy on Load" option, can i remove that from both of them to force the scene to use the existing instance of them thats already being referenced, or will that mess with my quest statuses/save states?

EDIT: I found another thread where you explain that things that reference those objects need to be in the hierarchy, but what about the "DialogueSystemEvents" component on the Player? any reason why that wouldnt be properly activating OnConversationStart/End events?
User avatar
Tony Li
Posts: 21928
Joined: Thu Jul 18, 2013 1:27 pm

Re: Invector + Quest Machine + Dialogue System Save System

Post by Tony Li »

If a GameObject exists only in the scene and doesn't survive scene changes along with the Dialogue Manager, Quest Machine, or Save System GameObjects, don't assign direct references to the Dialogue Manager, Quest Machine, or Save System GameObjects.

If you want to do something with the Save System, add a Save System Methods component to the GameObject that has the reference field, and assign that component to the reference field. From there, you can choose methods such as SaveSystemMethods.SaveToSlot that will automatically find the Save System GameObject at runtime.

For Quest Machine, you can generally do the same thing with a Quest Control component.

For the Dialogue System, you can use a Dialogue System Trigger for most operations.
KingCeryn
Posts: 70
Joined: Sun Aug 23, 2020 5:12 pm

Re: Invector + Quest Machine + Dialogue System Save System

Post by KingCeryn »

Got it! I'll try that.

Can you think of any reason why my player no longer does the DialogueSystemEvents when I start conversations after reloading though? Before reload, i can talk to NPCs with all the proper things happening- Hud turns off, player input locks, etc.

But after reloading, it looks like the OnConversationStart/End events simply dont get triggered, any reason why that might be happening?
User avatar
Tony Li
Posts: 21928
Joined: Thu Jul 18, 2013 1:27 pm

Re: Invector + Quest Machine + Dialogue System Save System

Post by Tony Li »

Are the DialogueSystemEvents still connected properly after reloading? Or are they unassigned after reloading?
KingCeryn
Posts: 70
Joined: Sun Aug 23, 2020 5:12 pm

Re: Invector + Quest Machine + Dialogue System Save System

Post by KingCeryn »

They're connected, but they reference the player- so the DialogueSystemEvents component is on the player root, and they reference scripts on the same root object.

But they just dont seem to get triggered when I enter a conversation after a reload. Is there something in there that might be checking for a DialogueManager that it isnt finding?

EDIT: Ah it seems to be working now! I was getting some residual errors after loading from some other scripts but after fixing those it seems to have been fixed. Maybe some random issues with Unity preventing functions from initiating when other variables arent found. Thanks for your help!
User avatar
Tony Li
Posts: 21928
Joined: Thu Jul 18, 2013 1:27 pm

Re: Invector + Quest Machine + Dialogue System Save System

Post by Tony Li »

Happy to help! I'm glad you got it working!
Post Reply