Page 1 of 1

LoadLevel at the end of a conversation

Posted: Mon Feb 01, 2016 2:41 pm
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!

Re: LoadLevel at the end of a conversation

Posted: Mon Feb 01, 2016 3:56 pm
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.)

Re: LoadLevel at the end of a conversation

Posted: Mon Feb 01, 2016 4:17 pm
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!

Re: LoadLevel at the end of a conversation

Posted: Mon Feb 01, 2016 4:24 pm
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.

Re: LoadLevel at the end of a conversation

Posted: Mon Feb 01, 2016 8:06 pm
by Shores
Thanks a lot! (Again)

It works perfectly and I now know how to use sequences! +1 skill point.

Re: LoadLevel at the end of a conversation

Posted: Mon Feb 01, 2016 8:33 pm
by Tony Li
Awesome! Happy to help!