LoadLevel at the end of a conversation

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Shores
Posts: 3
Joined: Mon Feb 01, 2016 2:35 pm

LoadLevel at the end of a conversation

Post by Shores »

Hello,

First of all sorry if it has already been asked but I've been searching and wasn't able to find any answer I can understand with my limited skills.

I'm trying to load a scene at the end a conversation.
There's the OnConversationEnd(Transform actor) but when I write an application.loadlevel here nothing happens.

Is it the right place to do it? Is it possible within the editor?

Anyway thank you!
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: LoadLevel at the end of a conversation

Post by Tony Li »

Hi!

The easiest way is to use the LoadLevel() sequencer command.

When you're writing your conversation, set the Sequence field of the last dialogue entry node to something like:
  • Dialogue Text: "Let's go to the movies!"
  • Sequence: LoadLevel(MovieTheater)
If you don't know which dialogue entry node will be last, you can use that command in a Sequence Trigger set to OnConversationEnd. The Sequence Trigger must be on the Dialogue Manager or one of the conversation participants.

Finally, if you want to use your own script, it must be on the Dialogue Manager or one of the conversation participants. It's usually better to use the LoadLevel() sequencer command rather than Application.LoadLevel() because it will coordinate with the Level Manager component if you've added one to your Dialogue Manager. (The Level Manager component takes care of saving and loading persistent data as you move between levels.)
Shores
Posts: 3
Joined: Mon Feb 01, 2016 2:35 pm

Re: LoadLevel at the end of a conversation

Post by Shores »

It works! Thanks a lot.

The subtitle doesn't load though, as the scene load when the answer button is pressed. Is there something simple to wait a few seconds before loading the scene?

Anyway thanks again!
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: LoadLevel at the end of a conversation

Post by Tony Li »

Yup, try this sequence:

Code: Select all

LoadLevel(MovieTheater)@{{end}}
This tells the LoadLevel() command to wait for a duration based on the length of the subtitle text.
Shores
Posts: 3
Joined: Mon Feb 01, 2016 2:35 pm

Re: LoadLevel at the end of a conversation

Post by Shores »

Thanks a lot! (Again)

It works perfectly and I now know how to use sequences! +1 skill point.
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: LoadLevel at the end of a conversation

Post by Tony Li »

Awesome! Happy to help!
Post Reply