How to make a save game and load game?
-
- Posts: 80
- Joined: Sun Jul 17, 2016 3:38 pm
How to make a save game and load game?
Good day!
Is there a guide for making a save game and load game for dialogue system?
It seems like I'm lost.
The save and load game are in a panel which contains 10 buttons, and those buttons where you can save the game and load the game.
I'm also trying to modify the in feature demo script. I replace the clear game save to Settings, then the save and load game opens a panel having 10 buttons.
Thank you and have a great day!
Is there a guide for making a save game and load game for dialogue system?
It seems like I'm lost.
The save and load game are in a panel which contains 10 buttons, and those buttons where you can save the game and load the game.
I'm also trying to modify the in feature demo script. I replace the clear game save to Settings, then the save and load game opens a panel having 10 buttons.
Thank you and have a great day!
Re: How to make a save game and load game?
You can download the Menu Framework from the Dialogue System Extras page. It's the first download button under EXTRAS. This provides an entire menu framework, including a title menu, in-game pause menu, and save/load game menus.
I recommend not using FeatureDemo.cs. This script was designed just to drive the demo scenes. You can use it as a base, but I think there are better solution now, such as the Menu Framework above.
If you don't want to do that, try these steps:
1. Add a GameSaver and a LevelManager to your Dialogue Manager.
2. Set up a Unity UI button to save a slot. Set the UI button's OnClick() event to GameSaver.SaveSlot, and specify a slot number.
3. Set up a Unity UI button to load a slot. Set the UI button's OnClick() event to GameSaver.LoadSlot, and specify a slot number.
I recommend not using FeatureDemo.cs. This script was designed just to drive the demo scenes. You can use it as a base, but I think there are better solution now, such as the Menu Framework above.
If you don't want to do that, try these steps:
1. Add a GameSaver and a LevelManager to your Dialogue Manager.
2. Set up a Unity UI button to save a slot. Set the UI button's OnClick() event to GameSaver.SaveSlot, and specify a slot number.
3. Set up a Unity UI button to load a slot. Set the UI button's OnClick() event to GameSaver.LoadSlot, and specify a slot number.
-
- Posts: 80
- Joined: Sun Jul 17, 2016 3:38 pm
Re: How to make a save game and load game?
Instead of using the feature demo, I tried what you recommend which is putting a game saver and level manager in dialogue manager and it work.
Now I understand, thanks to your help.
But I still have a question.
Does it save and load variables?
Now I understand, thanks to your help.
But I still have a question.
Does it save and load variables?
Re: How to make a save game and load game?
Yes, it saves and loads variables. The complete list of what it saves is on the Saved Game Data page.
-
- Posts: 80
- Joined: Sun Jul 17, 2016 3:38 pm
Re: How to make a save game and load game?
Thank you!
-
- Posts: 80
- Joined: Sun Jul 17, 2016 3:38 pm
Re: How to make a save game and load game?
Gamesaver and Levelmanager can save/load the gameobjects that is set on active or not?
For example, I have a school gate and there are 2 gameobjects on the schoolgate. Those gameobjects are "GateClosed" and "GateOpen". If the player enters the gate, the gameobject "GateClosed" will be set on true and the gameobject "GateOpen" will be set on false.
if not, this should be done by scripting? Any help will be appreciated, thank you!
For example, I have a school gate and there are 2 gameobjects on the schoolgate. Those gameobjects are "GateClosed" and "GateOpen". If the player enters the gate, the gameobject "GateClosed" will be set on true and the gameobject "GateOpen" will be set on false.
if not, this should be done by scripting? Any help will be appreciated, thank you!
Re: How to make a save game and load game?
Hi,
You don't need to do any scripting. The Feature Demo scene contains an example. In the middle of the room, there is a terminal. This is actually two GameObjects: "TerminalActive" and "TerminalInactive". The save system controls them using a Persistent Active Data component and a Dialogue System variable.
I recommend this:
1. Add a Dialogue System variable named "SchoolGateIsOpen". Set the Type to Boolean, and set the Value to True.
2. Add a Persistent Active Data component to the schoolgate. Set the Target to GateOpen. Expand Condition > Lua Conditions, and add this Lua condition:
3. Add another Persistent Active Data component to the schoolgate. Set the Target to GateClosed. Expand Condition > Lua Conditions, and add this Lua condition:
When the player enters the gate, set the variable "SchoolGateIsOpen" false. For example, you can add a Lua Trigger set to OnTriggerEnter.
You don't need to do any scripting. The Feature Demo scene contains an example. In the middle of the room, there is a terminal. This is actually two GameObjects: "TerminalActive" and "TerminalInactive". The save system controls them using a Persistent Active Data component and a Dialogue System variable.
I recommend this:
1. Add a Dialogue System variable named "SchoolGateIsOpen". Set the Type to Boolean, and set the Value to True.
2. Add a Persistent Active Data component to the schoolgate. Set the Target to GateOpen. Expand Condition > Lua Conditions, and add this Lua condition:
Code: Select all
Variable["SchoolGateIsOpen"] == true
Code: Select all
Variable["SchoolGateIsOpen"] == false
-
- Posts: 80
- Joined: Sun Jul 17, 2016 3:38 pm
Re: How to make a save game and load game?
Good day!
How can I delete a save game?
What will I do to make the game object such as Text records the time and date when the player saves the game?
Also, What will I do to make a panel appear that tells if the player wants to overwrite a game data?
Thank you for the help!
How can I delete a save game?
What will I do to make the game object such as Text records the time and date when the player saves the game?
Also, What will I do to make a panel appear that tells if the player wants to overwrite a game data?
Thank you for the help!
Re: How to make a save game and load game?
Hi,
For text records and a overwrite panel, I recommend using the free Menu Framework on the Dialogue System Extras page. It's the first download button under the EXTRAS section. It also lets players delete saved games.
To delete a saved game without the Menu Framework, you'll have to delete the PlayerPrefs keys. You can use a PlayerPrefs editor tool or write a script that uses PlayerPrefs.DeleteKey().
For text records and a overwrite panel, I recommend using the free Menu Framework on the Dialogue System Extras page. It's the first download button under the EXTRAS section. It also lets players delete saved games.
To delete a saved game without the Menu Framework, you'll have to delete the PlayerPrefs keys. You can use a PlayerPrefs editor tool or write a script that uses PlayerPrefs.DeleteKey().