Issue with saving system and Topdown integration

Announcements, support questions, and discussion for Quest Machine.
Peter
Posts: 7
Joined: Mon Nov 11, 2024 4:00 pm

Issue with saving system and Topdown integration

Post by Peter »

Hi

I have setup the Quest Machine and created handwritten quests together with the topdown engine. Which are working good. Now I what to be able to jump back and forth between scenes while keeping track of the quests. I have setup the saving system and it works kind of ... It does remember the progress across the scenes but I get both error and warning.

NullReferenceExecebtion error:
NullReferenceException: Object reference not set to an instance of an object
PixelCrushers.QuestMachine.QuestJournal.VerifyTrueNodeChildrenAreActive () (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestJournal.cs:264)
PixelCrushers.QuestMachine.QuestJournal.ApplyData (System.String data) (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestJournal.cs:255)
PixelCrushers.SaveSystem.ApplySavedGameData (PixelCrushers.SavedGameData savedGameData) (at Assets/Plugins/Pixel Crushers/Common/Scripts/Save System/SaveSystem.cs:912)
UnityEngine.Debug:LogException(Exception)
PixelCrushers.SaveSystem:ApplySavedGameData(SavedGameData) (at Assets/Plugins/Pixel Crushers/Common/Scripts/Save System/SaveSystem.cs:917)
PixelCrushers.TopDownEngineSupport.SaveSystemTopDownEventListener:Load() (at Assets/Pixel Crushers/Common/Third Party Support/TopDown Engine Support/Scripts/SaveSystemTopDownEventListener.cs:59)
PixelCrushers.TopDownEngineSupport.SaveSystemTopDownEventListener:OnMMEvent(MMGameEvent) (at Assets/Pixel Crushers/Common/Third Party Support/TopDown Engine Support/Scripts/SaveSystemTopDownEventListener.cs:42)
MoreMountains.Tools.MMEventManager:TriggerEvent(MMGameEvent) (at Assets/TopDownEngine/ThirdParty/MoreMountains/MMTools/Core/MMEvents/MMEventManager.cs:181)
MoreMountains.Tools.MMGameEvent:Trigger(String, Int32, Vector2, Vector3, Boolean, String) (at Assets/TopDownEngine/ThirdParty/MoreMountains/MMTools/Core/MMEvents/MMEventManager.cs:37)
MoreMountains.TopDownEngine.<InitializationCoroutine>d__41:MoveNext() (at Assets/TopDownEngine/Common/Scripts/Managers/LevelManager.cs:177)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
MoreMountains.TopDownEngine.LevelManager:Start() (at Assets/TopDownEngine/Common/Scripts/Managers/LevelManager.cs:136)

And warning:

Quest Machine: A QuestListContainer with id 'Player1' is already registered. Can't register ANR_LargeAlienCharacter Green(Clone) (PixelCrushers.QuestMachine.Wrappers.QuestJournal)
UnityEngine.Debug:LogWarning (object,UnityEngine.Object)
PixelCrushers.QuestMachine.QuestMachine:RegisterQuestListContainer (PixelCrushers.QuestMachine.IdentifiableQuestListContainer) (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest Machine/QuestMachine.cs:136)
PixelCrushers.QuestMachine.IdentifiableQuestListContainer:OnEnable () (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/IdentifiableQuestListContainer.cs:111)
PixelCrushers.QuestMachine.QuestJournal:OnEnable () (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestJournal.cs:111)
UnityEngine.Object:Instantiate<MoreMountains.TopDownEngine.Character> (MoreMountains.TopDownEngine.Character)
MoreMountains.TopDownEngine.CharacterSwitchManager:InstantiateCharacters () (at Assets/TopDownEngine/Common/Scripts/Managers/CharacterSwitchManager.cs:64)
MoreMountains.TopDownEngine.CharacterSwitchManager:Start () (at Assets/TopDownEngine/Common/Scripts/Managers/CharacterSwitchManager.cs:51)

I can see in the DontDestroyOnload the Questmachines creates a double when going back to the original scene.

Do you have an approach to how i could fix or troubleshoot the issue?

I think I have followed the guides and I do not have that much else going on in the project yet :) I have three scenes plus the loadingscene. First scene will hold the Quest Machine Manager including the Quest Machine Canvas. Do I need to split it up?

hope you can help

Kind regards
Peter
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Issue with saving system and Topdown integration

Post by Tony Li »

Hi,

Add a SaveSystem component or InputDeviceManager component to the Quest Machine GameObject. These components ensure that only one GameObject having the component exists, so you won't get doubles when switching scenes. (If either of these components are on a different GameObject in your scene, remove the component from that GameObject.)
Peter
Posts: 7
Joined: Mon Nov 11, 2024 4:00 pm

Re: Issue with saving system and Topdown integration

Post by Peter »

Hi

Thanks I will try it out

Also I found the check box in Quest Machine "allow Only one Instance" fixed the dublication issue.

It works fine now.

Next problem I may want to solve is to make the "swap/switchs character ability to work" this is not a must have though :)

:)
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Issue with saving system and Topdown integration

Post by Tony Li »

Peter wrote: Tue Nov 12, 2024 3:51 pmAlso I found the check box in Quest Machine "allow Only one Instance" fixed the duplication issue.
Doh, I really should have suggested that first. Good find.
Peter wrote: Tue Nov 12, 2024 3:51 pmNext problem I may want to solve is to make the "swap/switch character ability to work" this is not a must have though :)

What's currently not working? Do you want to save the state of switched abilities? If so, you can write a custom saver: How To: Write Custom Savers
Peter
Posts: 7
Joined: Mon Nov 11, 2024 4:00 pm

Re: Issue with saving system and Topdown integration

Post by Peter »

Thanks for the help. Now for just keeping destroyed objects in a scene from population when going back to the same scene. I guess the "Active saver" component would be best. Or can you suggest a better method? And are there a example somehere I can plank ?
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Issue with saving system and Topdown integration

Post by Tony Li »

Add a DestructibleSaver to the object and set a unique Key value. (You can mass-assign unique keys using menu item Tools > Pixel Crushers > Common > Save System > Assign Unique Keys.)
Peter
Posts: 7
Joined: Mon Nov 11, 2024 4:00 pm

Re: Issue with saving system and Topdown integration

Post by Peter »

Right got it. Works like I want it to now. Thanks
Peter
Posts: 7
Joined: Mon Nov 11, 2024 4:00 pm

Re: Issue with saving system and Topdown integration

Post by Peter »

One more thing though. The "Pause Topdown" component gives me some issues. I put it on the quest machine prefab, the issue points to the QuestGiver that starts the StartDialogWithPlayer function

Can you tell want I am not seeing ??
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Issue with saving system and Topdown integration

Post by Tony Li »

Hi,

What's the issue? Is there a warning or error message in the Console window?

What are the settings in your Pause Topdown component?
Peter
Posts: 7
Joined: Mon Nov 11, 2024 4:00 pm

Re: Issue with saving system and Topdown integration

Post by Peter »

I get error in the console. if I ignore, the player will not unpause after I close the Quest UI, the game will go on though.

On the savesytem prefab I have the following components: Json data Serialiser; PlayerPrefs Saved Game Data Storer; Save System; Save System Topdown Event Listner; Auto save Load

On the Questgiver prefab I have: Quest Giver; Quest Entity;Inventory Engine Reward System; Quest Indicator Manager; Trigger Event; Box Collider


Error message
NullReferenceException: Object reference not set to an instance of an object
MoreMountains.TopDownEngine.CharacterPause.PauseCharacter () (at Assets/TopDownEngine/Common/Scripts/Characters/CharacterAbilities/CharacterPause.cs:79)
MoreMountains.TopDownEngine.LevelManager.ToggleCharacterPause () (at Assets/TopDownEngine/Common/Scripts/Managers/LevelManager.cs:496)
MoreMountains.TopDownEngine.GameManager.Pause (MoreMountains.TopDownEngine.PauseMethods pauseMethod, System.Boolean unpauseIfPaused) (at Assets/TopDownEngine/Common/Scripts/Managers/GameManager.cs:332)
PixelCrushers.TopDownEngineSupport.TDEPauseUtility.Pause (System.Boolean pause, System.Boolean disableInput, System.String[] floatAnimatorParametersToStop, System.String[] boolAnimatorParametersToStop) (at Assets/Pixel Crushers/Common/Third Party Support/TopDown Engine Support/Scripts/TDEPauseUtility.cs:34)
PixelCrushers.QuestMachine.TopDownEngineSupport.PauseTopDown.Pause () (at Assets/Pixel Crushers/Quest Machine/Third Party Support/TopDown Engine Support/Scripts/PauseTopDown.cs:49)
PixelCrushers.QuestMachine.TopDownEngineSupport.PauseTopDown.OnMessage (PixelCrushers.MessageArgs messageArgs) (at Assets/Pixel Crushers/Quest Machine/Third Party Support/TopDown Engine Support/Scripts/PauseTopDown.cs:39)
PixelCrushers.MessageSystem.SendMessageToListener (PixelCrushers.MessageSystem+ListenerInfo x, System.Object sender, System.Object target, System.String message, System.String parameter, PixelCrushers.MessageArgs messageArgs) (at Assets/Plugins/Pixel Crushers/Common/Scripts/Message System/MessageSystem.cs:402)
PixelCrushers.MessageSystem.SendMessageWithTarget (System.Object sender, System.Object target, System.String message, System.String parameter, System.Object[] values) (at Assets/Plugins/Pixel Crushers/Common/Scripts/Message System/MessageSystem.cs:371)
PixelCrushers.MessageSystem.SendMessageWithTarget (System.Object sender, System.Object target, PixelCrushers.StringField message, PixelCrushers.StringField parameter, System.Object[] values) (at Assets/Plugins/Pixel Crushers/Common/Scripts/Message System/MessageSystem.cs:428)
PixelCrushers.MessageEvents.SendToMessageSystem (System.Int32 index) (at Assets/Plugins/Pixel Crushers/Common/Scripts/Message System/MessageEvents.cs:125)
UnityEngine.Events.InvokableCall`1[T1].Invoke (T1 args0) (at /Users/bokken/build/output/unity/unity/Runtime/Export/UnityEvent/UnityEvent.cs:219)
UnityEngine.Events.CachedInvokableCall`1[T].Invoke (System.Object[] args) (at /Users/bokken/build/output/unity/unity/Runtime/Export/UnityEvent/UnityEvent.cs:357)
UnityEngine.Events.UnityEvent.Invoke () (at /Users/bokken/build/output/unity/unity/artifacts/generated/UnityEvent/UnityEvent_0.cs:69)
PixelCrushers.UIPanel.Open () (at Assets/Plugins/Pixel Crushers/Common/Scripts/UI/UIPanel.cs:240)
PixelCrushers.QuestMachine.UnityUIBaseUI.Show () (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest UIs/Unity UI/Unity UI Content Templates/UnityUIBaseUI.cs:97)
PixelCrushers.QuestMachine.UnityUIQuestDialogueUI.ShowContents (PixelCrushers.QuestMachine.QuestParticipantTextInfo speaker, System.Collections.Generic.List`1[T] contents) (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest UIs/Unity UI/Unity UI Quest Dialogue UI/UnityUIQuestDialogueUI.cs:149)
PixelCrushers.QuestMachine.UnityUIQuestDialogueUI.ShowQuestList (PixelCrushers.QuestMachine.QuestParticipantTextInfo speaker, System.Collections.Generic.List`1[T] activeQuestsContents, System.Collections.Generic.List`1[T] activeQuests, System.Collections.Generic.List`1[T] offerableQuestsContents, System.Collections.Generic.List`1[T] offerableQuests, PixelCrushers.QuestMachine.QuestParameterDelegate selectHandler) (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest UIs/Unity UI/Unity UI Quest Dialogue UI/UnityUIQuestDialogueUI.cs:276)
PixelCrushers.QuestMachine.QuestGiver.ShowQuestList () (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestGiver.cs:722)
PixelCrushers.QuestMachine.QuestGiver.StartMostRelevantDialogue () (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestGiver.cs:678)
PixelCrushers.QuestMachine.QuestGiver.StartDialogue (UnityEngine.GameObject player) (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestGiver.cs:595)
PixelCrushers.QuestMachine.QuestGiver.StartDialogueWithPlayer () (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestGiver.cs:565)
UnityEngine.Events.InvokableCall.Invoke () (at /Users/bokken/build/output/unity/unity/Runtime/Export/UnityEvent/UnityEvent.cs:178)
UnityEngine.Events.UnityEvent`1[T0].Invoke (T0 arg0) (at /Users/bokken/build/output/unity/unity/artifacts/generated/UnityEvent/UnityEvent_1.cs:62)
PixelCrushers.TriggerEvent.OnTriggerEnter (UnityEngine.Collider other) (at Assets/Plugins/Pixel Crushers/Common/Scripts/UnityEvents/TriggerEvent.cs:36)
Post Reply