Page 2 of 6

Re: Some advises on start needed

Posted: Tue Jul 24, 2018 9:52 am
by pavsikakyj
Hi! I need some help again.

Is it possible to create additional menus inside VN framework? I'd like to set some navigation simulation in some conversations. So I'd like to hide dialogue panel in some conversation nodes and show those additional menus or sets of buttons. By clicking on them they should start another conversations wit another backgrounds. Also I would like to create some panes, which would display some stats (variables).

I fell that VN framework has enough tools to do this, but didn't find it in docs. Or may be I didn't understand, where so search.

Re: Some advises on start needed

Posted: Tue Jul 24, 2018 10:17 am
by Tony Li
Hi,

You can add them to the Visual Novel Menu Canvas, similar to the "Gameplay Panel".

To hide the dialogue UI during a conversation, you can use this sequencer command:

Code: Select all

SetActive(VN Template Standard Dialogue UI,false)
Replace "VN Template Standard Dialogue UI" with the name of your dialogue UI.

To show another panel:

Code: Select all

SetActive(My Panel,true)

If you just want to change backgrounds and start another conversation, you don't need to do this.

To change conversations, just link to another conversation in the Dialogue Editor:

1. Inspect a node.

2. In the Inspector's Link To: menu, select (Another Conversation).

3. Select the destination conversation from the dropdown menu. (See page 6 of the manual.)


To show a new background, add a custom field named "Background" to your conversation and specify the new background image. (Also on page 6 of the manual.)


However, let's say you have a map panel, and the player can click on locations (buttons) on the map. When the player clicks on a location, it starts a new conversation. To do this, configure the buttons to call the Dialogue Manager's StopConversation() and StartConversation() methods. You may also need to reactivate the dialogue UI GameObject if you deactivated it. You will also need to untick the Visual Novel Menu Canvas > Menus component's Return To Menu On Conversation End checkbox. (See page 7, step 15 of the manual.)

Re: Some advises on start needed

Posted: Wed Jul 25, 2018 8:33 am
by pavsikakyj
Thanks for a rapid answer. I mae some things you described, but when I tried to run test conversation, got this report:
NullReferenceException: Object reference not set to an instance of an object
PixelCrushers.DialogueSystem.DialogueManager.ResetDatabase (DatabaseResetOptions databaseResetOptions) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Manager/DialogueManager.cs:276)
PixelCrushers.DialogueSystem.LevelManager+<LoadLevelFromSaveData>c__Iterator0.MoveNext () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Save Subsystem/LevelManager.cs:79)
UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
PixelCrushers.DialogueSystem.LevelManager:RestartGame() (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Save Subsystem/LevelManager.cs:68)
PixelCrushers.DialogueSystem.VisualNovelFramework.SaveHelper:RestartGame() (at Assets/Dialogue System Extras/Visual Novel Framework/Scripts/SaveHelper.cs:166)
UnityEngine.EventSystems.EventSystem:Update()
I added all the scenes to Build Settings, put customized UI to Display settings of the dialogue manager, and set starting conversation in VN menu canas Save Helper. Did I forget to set something else?

Re: Some advises on start needed

Posted: Wed Jul 25, 2018 9:10 am
by Tony Li
Hi,

I'm not sure exactly what you're trying to do. Can you please post some sketches or mock-ups of what you want the UI to do?

Re: Some advises on start needed

Posted: Thu Jul 26, 2018 5:24 am
by pavsikakyj
For now I just visually customized the UI, changed start conversation and tried to run it. It showed me the main menu, I hit "Start" and got empty screen and that message.

Then I created a new project. Absolutelly clean. Added VN framework. Changed the build settings as it shown in manual and tried to run the game from the Start scene. No more actions and changes. And got allmost the same. After starting the main menu is shown. I pick "Start" and nothing is shown, except Gameply Panel. And in Cosole i get theese messages:

http://prntscr.com/kb7puh
http://prntscr.com/kb7qk1
http://prntscr.com/kb7q4j

Scene 'Example Gameplay' couldn't be loaded because it has not been added to the build settings or the AssetBundle has not been loaded.
To add a scene to the build settings use the menu File->Build Settings...
UnityEngine.SceneManagement.SceneManager:LoadSceneAsync(String)
PixelCrushers.DialogueSystem.Tools:LoadLevelAsync(String) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Utility/Tools.cs:632)
PixelCrushers.DialogueSystem.<LoadLevelFromSaveData>c__Iterator0:MoveNext() (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Save Subsystem/LevelManager.cs:103)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
PixelCrushers.DialogueSystem.LevelManager:RestartGame() (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Save Subsystem/LevelManager.cs:68)
PixelCrushers.DialogueSystem.VisualNovelFramework.SaveHelper:RestartGame() (at Assets/Dialogue System Extras/Visual Novel Framework/Scripts/SaveHelper.cs:166)
UnityEngine.EventSystems.EventSystem:Update()
NullReferenceException: Object reference not set to an instance of an object
PixelCrushers.DialogueSystem.LevelManager+<LoadLevelFromSaveData>c__Iterator0.MoveNext () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Save Subsystem/LevelManager.cs:105)
UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
PixelCrushers.DialogueSystem.LevelManager:RestartGame() (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Save Subsystem/LevelManager.cs:68)
PixelCrushers.DialogueSystem.VisualNovelFramework.SaveHelper:RestartGame() (at Assets/Dialogue System Extras/Visual Novel Framework/Scripts/SaveHelper.cs:166)
UnityEngine.EventSystems.EventSystem:Update()
Unity; 2018.02.0f2
DS fo Unity: 2.0.2
VN framefork: 2.0.0.5

Re: Some advises on start needed

Posted: Thu Jul 26, 2018 8:55 am
by pavsikakyj
Ok. I solved the issue with new project. In Visual Novel Menu Canvas Level Manger I put "Start" - the name of the VN Framework start scene. And conversation showed. And after I dragged custom dialogue UI and Dialogue database into new projects - the conversation started. So I just have customize start panel again (will do very carefully this time).

For now I have three new questions.

1. My custom dialogue UI added as an instance to Dialogue Manager Canvas. When I hide it and start the game, nothing is shown. How shoul I make Unity to activate it automatically?

2. For the navigation button StopConversation() and StartConversation() methods you mean this: http://prntscr.com/kbaq8n ? Should I put new conversation name in the empty field?

3. Why Gameplay panel isn't shown, when the conversation starts? Shoul it turned on manually with sequence command?

Re: Some advises on start needed

Posted: Thu Jul 26, 2018 9:48 am
by Tony Li
In version 2.0.0.5, I accidentally left the Visual Novel Menu Canvas prefab pointing to the example gameplay scene, 'Example Gameplay'. It should point to the empty gameplay scene, 'Gameplay'. I fixed this in version 2.0.1, which you can download now on the Extras page or right here.

However, if you've already customized it for your project, you don't need to import the updated package. Instead, just change the Visual Novel Menu Canvas > Level Manager to 'Gameplay' (not 'Start').

Here is an example of changing conversations:

VN_ChangeConversationExample_2018-07-26.unitypackage

This is how I set it up:

1. Inspected Visual Novel Menu Canvas. Unticked Menus > Return To Menu On Conversation End.

2. Added Map Panel. Left it inactive.

3. Map Panel has two conversation buttons. Each button:
  • Stops the current conversation (DialogueSystemController.StopConversation).
  • Starts a new conversation (DialogueSystemController.StartConversation - specify conversation title).
  • Deactivates the Menu Panel.
4. Added Map Button to Menu Panel. Set OnClick() to activate Map Panel.

You will want to use dialogue database variables to record where the conversation should jump to when starting. The example does not use variables, so conversations start from the beginning.

Re: Some advises on start needed

Posted: Sat Jul 28, 2018 3:17 pm
by pavsikakyj
Thank you for fine example! It helped me a lot.

For now I still have some question.

I created in Gameplay Menu a text panel and I want it to show the value of a number variable. Some [var=varName] doesn't work. It works, when I use in subtitle panel, but does not work in Gameplay Menu (though the two text panels have same components). Is there a way to make it work?

And maybe a stupid question, but I looked several times in documentation, but didn't succeed… I want to read about managing and manipulating with manual variables, using variables to jump to specific part of the coversation, not to bugger you with endless questions. Is there a chapter about it in docs?

Re: Some advises on start needed

Posted: Sat Jul 28, 2018 7:29 pm
by Tony Li
Hi,
pavsikakyj wrote: Sat Jul 28, 2018 3:17 pmI created in Gameplay Menu a text panel and I want it to show the value of a number variable. Some [var=varName] doesn't work. It works, when I use in subtitle panel, but does not work in Gameplay Menu (though the two text panels have same components). Is there a way to make it work?
Use the FormattedText.ParseCode(string) method to process the text. The code below is an example.

Code: Select all

UnityEngine.UI.Text uiText;
...
string s = "I am [var=Age] years old.";
string processed = FormattedText.ParseCode(s);
uiText.text = processed;
pavsikakyj wrote: Sat Jul 28, 2018 3:17 pmI want to read about managing and manipulating with manual variables, using variables to jump to specific part of the coversation, not to bugger you with endless questions. Is there a chapter about it in docs?
There's a step-by-step tutorial: Conversation Conditions Tutorial

These links may also help:

Re: Some advises on start needed

Posted: Sun Jul 29, 2018 10:05 am
by pavsikakyj
Use the FormattedText.ParseCode(string) method to process the text. The code below is an example.
Code: Select all

UnityEngine.UI.Text uiText;
...
string s = "I am [var=Age] years old.";
string processed = FormattedText.ParseCode(s);
uiText.text = processed;
Hi. Should this code to be placed in the text field? As far as could understand from Documentaion, it should. But in this case it doesn't work for me. May be it works only from conversation nodes?

Here, how the tex field looks:
http://prntscr.com/kcekra
http://prntscr.com/kcel0x

Maybe I used wrong components?

P.S.
I'm really grateful for your efforts to teach me.