Save dialogue settings when closing application
Re: Save dialogue settings when closing application
What are the settings on the Dialogue System Saver component?
Since you're using Auto Save Load with Load On Start ticked, you may need to delay the Dialogue System Trigger for one or more frames. Here's a test:
1. Change the Dialogue System Trigger to OnUse.
2. Add a TimedEvent component to the same GameObject. Set the dropdown to Frames. Set the value to 2. Configure the OnTimeReached() event to call the Dialogue System Trigger's DialogueSystemTrigger.OnUse method.
Since you're using Auto Save Load with Load On Start ticked, you may need to delay the Dialogue System Trigger for one or more frames. Here's a test:
1. Change the Dialogue System Trigger to OnUse.
2. Add a TimedEvent component to the same GameObject. Set the dropdown to Frames. Set the value to 2. Configure the OnTimeReached() event to call the Dialogue System Trigger's DialogueSystemTrigger.OnUse method.
-
- Posts: 82
- Joined: Wed Mar 31, 2021 6:48 pm
Re: Save dialogue settings when closing application
Here are my settings
I just replaced my "Start" conversation and made it use "OnUse" as you mentioned. So far, this seems to work except for the last level dialogue at the start of the game. Should I increase the amount of frames it takes?2. Add a TimedEvent component to the same GameObject. Set the dropdown to Frames. Set the value to 2. Configure the OnTimeReached() event to call the Dialogue System Trigger's DialogueSystemTrigger.OnUse method.
Re: Save dialogue settings when closing application
Hi,
Yes, that's correct. Since both Auto Save Load and the Dialogue System Trigger do their thing in Start, the trigger was going first. You can keep it set up the way it is now, or you can go into Script Execution Order and set Auto Save Load to run first.
Yes, that's correct. Since both Auto Save Load and the Dialogue System Trigger do their thing in Start, the trigger was going first. You can keep it set up the way it is now, or you can go into Script Execution Order and set Auto Save Load to run first.
-
- Posts: 82
- Joined: Wed Mar 31, 2021 6:48 pm
Re: Save dialogue settings when closing application
Gotcha. Ok I just went through the whole game and it looks like it works as intended!
You mentioned how to restart dialogue earlier using onclick, but I was curious if there was a way where it would restart on runtime WITHOUT having to load to the next scene right away?
I pretty much just want it to reset on the "Menu" scene without having to reload
You mentioned how to restart dialogue earlier using onclick, but I was curious if there was a way where it would restart on runtime WITHOUT having to load to the next scene right away?
I pretty much just want it to reset on the "Menu" scene without having to reload
-
- Posts: 82
- Joined: Wed Mar 31, 2021 6:48 pm
Re: Save dialogue settings when closing application
I just placed this in my script as shown
The console.log runs, but the game hasn't reset. Am I doing this wrong?
I put this on the top of my script
It shows re squiggles, but I assume that's just because Visual Studio doesn't recognize this
Code: Select all
if (Input.GetKeyDown(KeyCode.R) && canResetData)
{
PixelCrushers.SaveSystem.ResetGameState();
Debug.Log("RESET");
}
I put this on the top of my script
Code: Select all
using PixelCrushers.DialogueSystem;
Re: Save dialogue settings when closing application
By "reset," I assume you want to clear all save data from memory and reset all Dialogue System variables to their initial values, correct? If so, that should do it. Make sure the scene has a Dialogue System Saver component at the time that you run SaveSystem.ResetGameState().
-
- Posts: 82
- Joined: Wed Mar 31, 2021 6:48 pm
Re: Save dialogue settings when closing application
Ok so my "Save System" GameObject has the script "Dialogue System Saver".
So what supposed to happens is: when I press the Z button, the game should just reset it's dialogue variables
But for some reason, this isn't actually producing those results. It always prints out "reset", but when I push the button that's meant to start the game, the retrieved data doesn't set the variables that are meant to go back to normal. They're still values from the "saved" version
So what supposed to happens is: when I press the Z button, the game should just reset it's dialogue variables
Code: Select all
if (Input.GetKeyDown(KeyCode.Z))
{
audioSource.PlayOneShot(selected);
PixelCrushers.SaveSystem.ResetGameState();
Debug.Log("RESET");
}
Re: Save dialogue settings when closing application
Thanks for the explanation. The problem is that you're resetting the variable values in memory, but then you're loading the old saved variable values from the saved game back into memory. If you use SaveSystem.ResetGameState(), don't undo that by reloading your saved game.
If you want to reset the game state and clear out the saved game, also call SaveSystem.DeleteSavedGameInSlot():
If you want to reset the game state and clear out the saved game, also call SaveSystem.DeleteSavedGameInSlot():
Code: Select all
PixelCrushers.SaveSystem.ResetGameState();
PixelCrushers.SaveSystem.DeleteSavedGameInSlot(1);
-
- Posts: 82
- Joined: Wed Mar 31, 2021 6:48 pm
Re: Save dialogue settings when closing application
That was it! Now it works as intended!
I can't think you enough for your help and guiding me through this. I really appreciate it. I'm about to leave a 5 start review right now for this product and amazing service !
I can't think you enough for your help and guiding me through this. I really appreciate it. I'm about to leave a 5 start review right now for this product and amazing service !