Quest active state
-
- Posts: 7
- Joined: Thu Aug 24, 2023 7:05 am
Quest active state
Hello, I have an issue where I have an enemy spawner that I want only active if the quest is active. But on the next load the quest is always set to unassigned, meaning these conditions are not true. Does it have an easy fix?
- Attachments
-
- As you can see the conditions are all set. This is after loading the same.
- slika_2023-08-26_113023687.png (152.16 KiB) Viewed 341 times
Re: Quest active state
Hi,
One solution is to set up the save system. This will let you save the game, including quest states.
Then you can either:
One solution is to set up the save system. This will let you save the game, including quest states.
Then you can either:
- Add a Dialogue System Trigger to the scene and set its Trigger to OnSaveDataApplied. Set the Conditions > Quest Conditions to require that the quest state is active. Set Actions > OnExecute() UnityEvent to activate the spawner.
- Or, instead of a Dialogue System Trigger, set up an Active Saver component on an active GameObject. Assign a unique key value of your choice (e.g., "enemySpawner001") and assign the spawner to the Target field. This will save the spawner's active/inactive state.
-
- Posts: 7
- Joined: Thu Aug 24, 2023 7:05 am
Re: Quest active state
I am not using save system, I am only using 2 lines of code you provided in the different forum post to save the quests. The solution you gave did not really work for me, the first one is already set up in the scene and the quest state is still set to unassigned, the second solution one did not save the state of the object, it is still inactive after loading the game
Re: Quest active state
Are you using "PersistentDataManager.GetSaveData()" and "PersistentDataManager.ApplySaveData()" to save and restore the quest states? If so, make sure that's working first. In other words, after calling PersistentDataManager.ApplySaveData(), confirm that the quest states are correct.
If so, then after restoring the quest states with PersistentDataManager.ApplySaveData() you'll need to check the quest state and activate or deactivate the spawner accordingly. Another alternative is to add a PersistentActiveData component to an active GameObject in the scene. Assign the spawner to the Target field, and set the Condition to require that the quest is active.
Or use the save system, which will take care of this by using an ActiveSaver.
If so, then after restoring the quest states with PersistentDataManager.ApplySaveData() you'll need to check the quest state and activate or deactivate the spawner accordingly. Another alternative is to add a PersistentActiveData component to an active GameObject in the scene. Assign the spawner to the Target field, and set the Condition to require that the quest is active.
Or use the save system, which will take care of this by using an ActiveSaver.
-
- Posts: 7
- Joined: Thu Aug 24, 2023 7:05 am
Re: Quest active state
I am only saving quests in a string with these lines:
string s = PixelCrushers.DialogueSystem.PersistentDataManager.GetSaveData();
PixelCrushers.DialogueSystem.PersistentDataManager.ApplySaveData(s);
I am pretty sure that this does not save quest states, right?
string s = PixelCrushers.DialogueSystem.PersistentDataManager.GetSaveData();
PixelCrushers.DialogueSystem.PersistentDataManager.ApplySaveData(s);
I am pretty sure that this does not save quest states, right?
Re: Quest active state
That does save quest states and DS variable values.
The first line (PersistentDataManager.GetSaveData) returns a string containing the saved quest states and variable values.
The second line (PersistentDataManager.ApplySaveData) accepts a string and uses it to restore quest states and variable values.
The first line (PersistentDataManager.GetSaveData) returns a string containing the saved quest states and variable values.
The second line (PersistentDataManager.ApplySaveData) accepts a string and uses it to restore quest states and variable values.
-
- Posts: 7
- Joined: Thu Aug 24, 2023 7:05 am
Re: Quest active state
Thank you, using Persistent Active Data script worked! Thank you for your time and for making the best asset on the store!
Re: Quest active state
Thanks! Glad to help.