Page 1 of 1

Change background while dialogue is active

Posted: Sun Mar 12, 2017 2:33 pm
by omonoia91
Hello,
I would like to know how can i change the background while the dialogue is active.
My game is 3rd person open world and i have some mini-quiz games around the world. But sometimes when the quiz (dialogue) starts
i don't want to show the character or the world at background. For example one quiz starts when the character interacts with the computer, so i would like to show something like a computer screen with the dialogue on top of it, so it can feel like the character actually uses the computer for the quiz.

Re: Change background while dialogue is active

Posted: Sun Mar 12, 2017 5:19 pm
by Tony Li
Hi,

I recommend using Override Dialogue UI. Here are the steps:

1. Create a new dialogue UI specifically for the computer conversation. You could create a fullscreen dialogue UI that covers the screen, or you could create a world space Unity UI Dialogue UI that's positioned on top of the computer screen model in the scene.

2. Make sure the computer is configured to be the conversant of the conversation. If you've added Usable and Conversation Trigger components to the computer, the computer will be the conversant by default. (You can change this by manually assigning a different GameObject to the Conversation Trigger's Conversant field.)

3. Add an Override Dialogue UI component to the computer. Assign the special dialogue UI you created. If you're using a fullscreen dialogue UI, that's all you need to do.

4. If you're using a world space dialogue UI positioned on top of the computer screen model in the scene, you'll probably want to run a Camera() command to make the camera look squarely at the screen. In these cases, I like to create an empty GameObject in the position where I'd like the camera to be. Let's say that GameObject is named "Computer Conversation Angle". Set the conversation START node's Sequence to something like:

Code: Select all

Camera(Computer Conversation Angle,,1)
This will move the camera from its gameplay position to Computer Conversation Angle over 1 second.

Re: Change background while dialogue is active

Posted: Sun Mar 12, 2017 6:53 pm
by omonoia91
Hello and thanks for your answer.
The UI is changing now but the camera doesn't point to computer screen. I made a new Camera angle named ComputerConversationAngle that points the computer screen for the selected angle and subject. At START node now i have Camera(ComputerConversationAngle,quizTrigger,1); at the Sequence but i am getting those 2 errors when the conversation starts:

Code: Select all

NullReferenceException: Object reference not set to an instance of an object
PixelCrushers.DialogueSystem.Sequencer.TakeCameraControl ()
PixelCrushers.DialogueSystem.SequencerCommands.SequencerCommandCamera.Start ()

Code: Select all

NullReferenceException: Object reference not set to an instance of an object
PixelCrushers.DialogueSystem.SequencerCommands.SequencerCommandCamera.OnDestroy ()
and the camera doesn't focus on computer screen.
What am i doing wrong?
Thank you!

Re: Change background while dialogue is active

Posted: Sun Mar 12, 2017 8:10 pm
by Tony Li
Hi,

Set your camera's Tag to MainCamera, or assign a camera (or camera prefab) to the Dialogue Manager's Display Settings > Camera Settings > Sequencer Camera.

need more help/advices

Posted: Sat Mar 25, 2017 6:15 pm
by omonoia91
Hello after some days.
I did it and all are okay! :)

I would like to ask something else now. Is it possible to connect the dialogue system database with MySQL and read the questions for the quiz game from there?( and if possible to add/change/remove from there ) (and how can i randomize the nodes so the quiz conversations are different every time?)
Also i am using the save/load commands that were included in the feature demo (menu) and im saving/loading from a txt file.
But because i am going to make a login system , how can i store every users save into database? shall i just add a string column and read/write from there? But i think that the string output from the save is big for a string . What do you suggest?

Thanks !

Re: need more help/advices

Posted: Sat Mar 25, 2017 6:41 pm
by Tony Li
omonoia91 wrote:Hello after some days.
I did it and all are okay! :)
Great! :-)
omonoia91 wrote:I would like to ask something else now. Is it possible to connect the dialogue system database with MySQL and read the questions for the quiz game from there?( and if possible to add/change/remove from there ) (and how can i randomize the nodes so the quiz conversations are different every time?)
Yes, but it's somewhat advanced. You will add the dialogue database at runtime using DialogueManager.AddDatabase().

But first you need to retrieve the database from a remote source. The easiest way to retrieve a database is to put it in an AssetBundle. Refer to the Unity documentation to create AssetBundles and retrieve assets from them at runtime.

If you want to use MySQL, you can export your dialogue database as a text file in Chat Mapper XML format (instructions).

Store the text file in your MySQL database. When you retrieve the text file at runtime, use these steps to load it into the Dialogue System:
How To Import Chat Mapper At Runtime.

To randomize nodes, see this post.

omonoia91 wrote:Also i am using the save/load commands that were included in the feature demo (menu) and im saving/loading from a txt file.
But because i am going to make a login system , how can i store every users save into database? shall i just add a string column and read/write from there? But i think that the string output from the save is big for a string . What do you suggest?
Your idea sounds good. It shouldn't be a problem that the strings are big.