Hi,
I want to allow players to save during dialogue and load the conversation back where they left off.
What would be the best way to approach this? I have a lot of dialogue so I'm looking for a way that does not require manual work on each node if possible.
Thanks
Saving and loading during dialogue flow
Re: Saving and loading during dialogue flow
Hi,
The GameSaver Example on the Dialogue System Extras page. It includes a RememberCurrentDialogueEntry script that works automatically; it doesn't require anything special on dialogue entry nodes. Although the example uses GameSaver (to make it easy for non-scripters), you can ignore the GameSaver part of the example if you want.
This may not be relevant, but there's also a Backtracking Example to allow players to step backward in conversations.
The GameSaver Example on the Dialogue System Extras page. It includes a RememberCurrentDialogueEntry script that works automatically; it doesn't require anything special on dialogue entry nodes. Although the example uses GameSaver (to make it easy for non-scripters), you can ignore the GameSaver part of the example if you want.
This may not be relevant, but there's also a Backtracking Example to allow players to step backward in conversations.
-
- Posts: 112
- Joined: Tue Jan 19, 2016 11:37 pm
Re: Saving and loading during dialogue flow
Awesome thank you!
As I understand these would re-trigger the sequence commands-right?. So for example if I'm adding 1 to variable, if player reloads the game it will add 1 to variable twice?
I'm thinking of adding custom override for this, how would you recommend I avoid this?
I was thinking of somehow saving dialogue node ID and adding custom Tag for sequencer like [once]. And ignoring the sequence with [once] tag if it's fired a second time.
As I understand these would re-trigger the sequence commands-right?. So for example if I'm adding 1 to variable, if player reloads the game it will add 1 to variable twice?
I'm thinking of adding custom override for this, how would you recommend I avoid this?
I was thinking of somehow saving dialogue node ID and adding custom Tag for sequencer like [once]. And ignoring the sequence with [once] tag if it's fired a second time.
Re: Saving and loading during dialogue flow
If you're adding 1 to a variable, I'm guessing you're using the Script field. The Script field is Lua, which is a real programming language. Instead of this:
you could do this:
You'll probably want to play the Sequence field even when you reload. For example if it sets up the camera position for the dialogue entry:
Code: Select all
Variable["x"] = Variable["x"] + 1
Code: Select all
if (Variable["set_x"] == false) then
Variable["x"] = Variable["x"] + 1
Variable["set_x"] = true
end
- Dialogue Text: "Look into my eyes..."
- Sequence: Camera(Closeup)
- Dialogue Text: "Look into my eyes..."
- Sequence: CameraOnce(eyes_closeup, Closeup)
-
- Posts: 112
- Joined: Tue Jan 19, 2016 11:37 pm
Re: Saving and loading during dialogue flow
Thanks!
I would prefer to avoid making custom variables for each situation where player reloading might break the logic. Is there a way for sequence or for example custom Lua function to get something like dialogue conversation ID + dialogue node ID to use as automatic variable name? Then I could make it universal.
I would prefer to avoid making custom variables for each situation where player reloading might break the logic. Is there a way for sequence or for example custom Lua function to get something like dialogue conversation ID + dialogue node ID to use as automatic variable name? Then I could make it universal.
Re: Saving and loading during dialogue flow
Hi,
If you're not using RememberCurrentDialogueEntry.cs, you can get the same information from DialogueManager.CurrentConversationState. You can also check DialogueManager.IsConversationActive to check if a conversation is active, DialogueManager.LastConversationStarted to get the title of the last conversation that was started, and DialogueManager.CurrentActor and DialogueManager.CurrentConversant to get the transforms of the current actor and conversant.
Yes. If you're using the RememberCurrentDialogueEntry.cs script, it sets these variables (and includes them in saved games):hellwalker wrote:I would prefer to avoid making custom variables for each situation where player reloading might break the logic. Is there a way for sequence or for example custom Lua function to get something like dialogue conversation ID + dialogue node ID to use as automatic variable name? Then I could make it universal.
- CurrentConversationActor: (string) Name of the current actor.
- CurrentConversationConversant: (string) Name of the current conversant.
- CurrentConversationID: (int) Current conversation ID.
- CurrentEntryID: (int) Current dialogue entry ID in the conversation.
If you're not using RememberCurrentDialogueEntry.cs, you can get the same information from DialogueManager.CurrentConversationState. You can also check DialogueManager.IsConversationActive to check if a conversation is active, DialogueManager.LastConversationStarted to get the title of the last conversation that was started, and DialogueManager.CurrentActor and DialogueManager.CurrentConversant to get the transforms of the current actor and conversant.