Page 1 of 2
Start conversation when new scene is loaded? (ink)
Posted: Sat Dec 26, 2020 6:02 pm
by Frost Mage
Hello,
Apologies if this is a RTFM question but I can't seem to find a straight forward answer and have tried multiple approaches. I simply want to set up each scene so that a conversation starts as soon as the scene loads. Is it possible to do this with dialogue triggers or will I need to create my own system with scripts? I am using inkle to generate my conversations.
Re: Start conversation when new scene is loaded? (ink)
Posted: Sat Dec 26, 2020 7:31 pm
by Tony Li
Hi,
Set the scene's Dialogue System Trigger to OnStart.
Re: Start conversation when new scene is loaded? (ink)
Posted: Sat Dec 26, 2020 7:33 pm
by Frost Mage
Hi Tony
I tried that. but it only seems to run when the game first starts, even if I include a dialogue manager in every scene. If I switch scenes while the game is running, the conversation does not start.
Re: Start conversation when new scene is loaded? (ink)
Posted: Sat Dec 26, 2020 8:13 pm
by Tony Li
Hi,
Are the Dialogue Manager's Other Settings > Allow Only One Instance and Don't Destroy On Load checkboxes ticked?
Are there any errors or warnings in the Console window?
Re: Start conversation when new scene is loaded? (ink)
Posted: Sat Dec 26, 2020 9:04 pm
by Frost Mage
Both settings are checked on the Dialogue Manager object. There are no errors in the console. I have also double checked that all json files are registered with the Dialogue Manager ink integration script. I don't know if this would make a difference, but I am changing the scene via LoadLevel() called in my ink script.
Re: Start conversation when new scene is loaded? (ink)
Posted: Sat Dec 26, 2020 9:35 pm
by Tony Li
Hi,
Frost Mage wrote: ↑Sat Dec 26, 2020 9:04 pmI don't know if this would make a difference, but I am changing the scene via LoadLevel() called in my ink script.
That's probably it. Your Ink script runs within the context of a Dialogue System conversation. The conversation is still active when it calls LoadLevel(), so the Dialogue System won't let it start a new conversation.
One way to handle it is to set a Dialogue System variable to the name of the next scene:
1. Define a variable -- for example, named "NextScene" -- and set its initial value to "none".
2. In your Ink script, use {Sequence(SetVariable(NextScene,
sceneName))} to set the NextScene variable.
3. Add a Dialogue System Trigger to the Dialogue Manager.
- Set it to OnConversationEnd.
- In the Conditions section, check if the variable NextScene is no longer "none".
- In the Actions section, select Add Action > Play Sequence. In the Sequence, use LoadLevel() to load the scene and SetVariable() to set the variable back to "none".
When the conversation ends, this Dialogue System Trigger will see that you set the NextScene variable, and it will load the specified scene.
- loadLevelOnConversationEnd.png (40.17 KiB) Viewed 1140 times
Re: Start conversation when new scene is loaded? (ink)
Posted: Sun Dec 27, 2020 5:56 am
by Frost Mage
Thank you Tony, that worked like a charm!
Re: Start conversation when new scene is loaded? (ink)
Posted: Sun Dec 27, 2020 6:28 am
by Frost Mage
Addendum:
I am trying to add saving to my project, but every time I add the Dialogue System saver component to my project the scene transitions break down. No errors are shown, and it appears that the new dialogue is run for a split second before closing.
Re: Start conversation when new scene is loaded? (ink)
Posted: Sun Dec 27, 2020 8:21 am
by Tony Li
Hi,
What Saver components are you using? If you're using a Conversation State Saver component, remove it. Conversation State Saver isn't designed to work with the Ink integration.
Are there any warnings or errors in the Console window?
Re: Start conversation when new scene is loaded? (ink)
Posted: Sun Dec 27, 2020 3:11 pm
by Frost Mage
I removed the Dialogue save system component and everything seems to work fine. I am using a "JSON data serializer" and "Playerprefs Saved Game Data Storer" components. I have the "include in save data" option checked on my Ink integrator.