Save dialogue settings when closing application

Announcements, support questions, and discussion for the Dialogue System.
soniclinkerman
Posts: 82
Joined: Wed Mar 31, 2021 6:48 pm

Re: Save dialogue settings when closing application

Post by soniclinkerman »

Ohhhh that's what you meant. Ok that explains why it immediately goes to the saved scene. Ok so how can I get the game to Load once I click a button?

I want the game to load its dialogue data once the player presses start
User avatar
Tony Li
Posts: 22047
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save dialogue settings when closing application

Post by Tony Li »

Add a Save System Methods component to your UI Button. Configure the Button's OnClick() event to call SaveSystemMethods.LoadFromSlot, and set the value to 1.

If you don't want it to automatically load, and instead always load by clicking the UI Button, untick the Auto Save Load component's Load On Start checkbox.
soniclinkerman
Posts: 82
Joined: Wed Mar 31, 2021 6:48 pm

Re: Save dialogue settings when closing application

Post by soniclinkerman »

Well I do want it to load automatically, but ONLY after the player has gone through the main menu. Maybe I could add an extra scene and place the `Extra Save` there?

There's actually a black fade that happens before the game starts after clicking the "Start" button. That's when I want the load function to run: Right after the fade in
User avatar
Tony Li
Posts: 22047
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save dialogue settings when closing application

Post by Tony Li »

In that case...

On the Save System prefab's Auto Save Load component, UNtick Load On Start.

In your first gameplay scene (e.g., scene index 2), add an empty GameObject. Add an Auto Save Load component to it. Leave Load On Start ticked.

In your menu scene, inspect your UI Button. Instead of configuring the OnClick() event to call SaveSystemMethods.LoadFromSlot, configure it to call SaveSystemMethods.LoadScene, and specify the first gameplay scene's name.

When the player clicks the Button, it will load the first gameplay scene. In the first gameplay scene, the Auto Save Load component's Load On Start checkbox will check if there's a saved game. If so, it will immediately load the saved game. If that saved game was saved in a different scene, it will load the scene it was saved in. If you don't want the save system to save which scene it was saved in, inspect the Save System prefab and untick the Save System component's Save Current Scene checkbox.
soniclinkerman
Posts: 82
Joined: Wed Mar 31, 2021 6:48 pm

Re: Save dialogue settings when closing application

Post by soniclinkerman »

Ok I got something sort of working. Nearly there haha

Is there a way I could do this in code?

The reason I ask is because using Onclick IMMEDIATELY moves it to the next scene where it loads. This is an issue because I want there to be a "fade out" animation before the transition happens.

Furthermore, I'm using another software "Easy Save" which loads up the level/scene the player was last in. This is how I'm able to retrieve the most recent level the player was on even when they close the game.

So in short,

I just need a way for the delay to happen where I can determine how long it takes before it goes to the next scene. There, it can load up data and move over to the scene the player was last left on according to the Gameemanager variable "sceneLeftOn"
soniclinkerman
Posts: 82
Joined: Wed Mar 31, 2021 6:48 pm

Re: Save dialogue settings when closing application

Post by soniclinkerman »

*UPDATE*

So I decided to add an "Auto Save" in each scene and so far that's producing good results. The LAST thing I need is a way to save the game after completing a dialogue conversation.

At the moment, it only saves if I QUIT(exit play mode), but if I quit in-game (In game meaning, I pause my game and press the "quit" option I created which takes the player to the main menu) and they play again, it will take them where the left off, but the dialogue that was supposed to only play once comes back
soniclinkerman
Posts: 82
Joined: Wed Mar 31, 2021 6:48 pm

Re: Save dialogue settings when closing application

Post by soniclinkerman »

*UPDATEE*

So I decided to run thee savesystem function "SaveSlot" Every time the dialogue ends. This way, it will never repeat.

And then, instead of using OnClick in the main menu, I instead added a Gameobject with "Auto Save" and placed it in EEVERY scene. SO far, this works exactly how I wanted

Is there anyway I could set up an icon when the game is saving? It's not mandatory, was just curious since I thought it'd be a nice add-on if possible
=.

Furthermore, I thought it'd be cool if the player could RESET their progress. Which just means "Reset the database". I would like them to be able to do that with a button click. There'd be a confirmation window first, and then they could delete it
User avatar
Tony Li
Posts: 22047
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save dialogue settings when closing application

Post by Tony Li »

Hi,
soniclinkerman wrote: Sat Apr 17, 2021 11:50 pmIs there anyway I could set up an icon when the game is saving? It's not mandatory, was just curious since I thought it'd be a nice add-on if possible
Add an icon -- for example, an Image on a new Canvas that's a child of the Save System prefab. Set the icon inactive.

Then add a Save System Events component to your Save System prefab. Configure OnSaveStart() to activate the icon. Configure OnSaveEnd() to deactivate it.
soniclinkerman wrote: Sat Apr 17, 2021 11:50 pmFurthermore, I thought it'd be cool if the player could RESET their progress. Which just means "Reset the database". I would like them to be able to do that with a button click. There'd be a confirmation window first, and then they could delete it
Add a Save System Methods component. Hook up your confirmation button to call SaveSystemMethods.RestartGame. You can specify a scene to load, such as the first gameplay scene.
soniclinkerman
Posts: 82
Joined: Wed Mar 31, 2021 6:48 pm

Re: Save dialogue settings when closing application

Post by soniclinkerman »

Ok now I'm really confused. I did what you mentioned about the image and it works great!

But for some reason, all of a sudden thee game dialogue isn't saving or "loading" thee saved dialogue variables.
Retrieved.png
Retrieved.png (123.66 KiB) Viewed 605 times
The variable "IntroDone" is true, but despite that, it's still playing it. Why is that?
soniclinkerman
Posts: 82
Joined: Wed Mar 31, 2021 6:48 pm

Re: Save dialogue settings when closing application

Post by soniclinkerman »

*UPDATE*

Ok so the problem is ONLY with the "On Start" Dialogue parts. The trigger once seem to work as intended, but the dialogue that starts on "Start" depending on the variable change is going regardless of it's condition
Post Reply