Hello, I am using the Dialogue System Menus extra, is there a way to load the saved game via dialogue?
What I want is, when the conversation ends, it will load a saved game. thanks
Load Game (PlayerPrefs) via dialogue.
Re: Load Game (PlayerPrefs) via dialogue.
Hello,
Add a small script with an OnConversationEnd method to the Dialogue Manager. For example, something like:
I have to emphasize that it will be something like the script above. I'm out of the office for most of the day today, so I can't double-check the syntax right now.
To use this, create a Number variable in your dialogue database named "LoadSlot", and set its value to -1. In your conversation, set the variable to a slot number. At the end of the conversation, this script will load the game in that slot.
Add a small script with an OnConversationEnd method to the Dialogue Manager. For example, something like:
Code: Select all
using UnityEngine;
using PixelCrushers.DialogueSystem;
using PixelCrushers.DialogueSystem.Menus;
public class LoadGameOnConversationEnd : MonoBehaviour {
public void OnConversationEnd(Transform actor) {
var loadSlot = DialogueLua.GetVariable("LoadSlot").AsInt;
if (loadSlot >= 0) FindObjectOfType<SaveHelper>.LoadGameInSlot(loadSlot);
}
}
To use this, create a Number variable in your dialogue database named "LoadSlot", and set its value to -1. In your conversation, set the variable to a slot number. At the end of the conversation, this script will load the game in that slot.
-
- Posts: 45
- Joined: Sat Jul 30, 2016 8:37 am
Re: Load Game (PlayerPrefs) via dialogue.
Thanks, I will try to make it work. Gonna comeback to give a feedback
Re: Load Game (PlayerPrefs) via dialogue.
Sounds good. If you get stuck, let me know. I'll be back in the office later today and can provide more details then.