New and Lost :(

Announcements, support questions, and discussion for the Dialogue System.
User avatar
Tony Li
Posts: 21722
Joined: Thu Jul 18, 2013 1:27 pm

Re: New and Lost :(

Post by Tony Li »

Raelyr wrote:One last (lol) question did come up though. For the textinput I have to collect the player's name, it works - it even stores the name and I can get to it fine so that part's great. But for some reason when it first displays the input field, it has 'nil' in there instead of being empty and displaying the placeholder text. Any idea why?
Define the variable in your dialogue database. Set its Type to Text, and leave its Initial Value blank unless you want to assign a default value such as "John Doe". The TextInput() command shows the current value of the variable when its starts. If the variable isn't defined, its value is "nil".
Raelyr wrote:Oh! I lied again...just one more question! If I'm using a script to change the character name like we discussed before, and then, say, the player saves the game and loads it later, will it remember the 'new' name or revert to 'Stranger'?
As long as you also set the value in the Actor table in Lua (as in the example scene I attached above), it'll be recorded in saved games. Saved games basically record the state of the Lua environment. You can control what it saves in the Save Settings section of the Dialogue Manager.
Raelyr
Posts: 19
Joined: Sat Aug 12, 2017 11:47 am

Re: New and Lost :(

Post by Raelyr »

Oh thanks! Everything working great for the moment. :)
Raelyr
Posts: 19
Joined: Sat Aug 12, 2017 11:47 am

Re: New and Lost :(

Post by Raelyr »

Hey thanks so much again for all your help! Things are coming along great. This is what I made so far:

https://www.dropbox.com/s/uxkwk7e7ruu7a83/demo.rar?dl=0

PS: is there a better way to share it? I'm new-ish to Unity as well...
PPS: Disclaimer - I am NOT an artist!

Anyway, I have just one small issue right now. I'm using the ChangeActorName we talked about previously, and it works great - in the current conversation. But when we get to the next conversation, for some reason it's calling the character 'Manager' (which is incidentally the name of the gameobject that starts that conversation). I'm not sure why it's doing that instead of using the modified display name though. Any ideas?
User avatar
Tony Li
Posts: 21722
Joined: Thu Jul 18, 2013 1:27 pm

Re: New and Lost :(

Post by Tony Li »

Hi,

Thanks for the link! I'll check it out today.

Add an OverrideActorName component to the Manager GameObject, or assign the appropriate NPC GameObject to the Conversation Trigger's Conversant field. If you don't specify the Conversant, it uses the Conversation Trigger's GameObject. (More details here.)
Raelyr
Posts: 19
Joined: Sat Aug 12, 2017 11:47 am

Re: New and Lost :(

Post by Raelyr »

Thanks for your help! I assigned the object as the Conversant and it doesn't seem to be saving it. I thought at first maybe I somehow changed scenes without saving, so assigned it again and saved, then played through...same thing. So I went back to the scene in question and it had cleared the Conversant field.

I noticed it IS saving the Conversant in my other scene, however...so I'm not really sure why? Am I missing something somehow?

I guess I could just as easily attach the trigger to the character instead of the scene's manager...I just wanted to understand how this works!
User avatar
Tony Li
Posts: 21722
Joined: Thu Jul 18, 2013 1:27 pm

Re: New and Lost :(

Post by Tony Li »

Hmm, is it possible your scene's manager is an instance of a prefab, and Unity is reverting it to the prefab state? I've come across that bug in some versions of Unity.

(BTW, thanks for the link to your WIP. That's a lot of progress for just a couple days!)
Raelyr
Posts: 19
Joined: Sat Aug 12, 2017 11:47 am

Re: New and Lost :(

Post by Raelyr »

Tony Li wrote:Hmm, is it possible your scene's manager is an instance of a prefab, and Unity is reverting it to the prefab state? I've come across that bug in some versions of Unity.
It's not a prefab, no. It's just an empty game object that holds all that scene's stuff like the background image and the characters in the scene. It's set up exactly like my first 'story' scene, except the first one works and the second one doesn't. :(
Tony Li wrote:(BTW, thanks for the link to your WIP. That's a lot of progress for just a couple days!)
Yeah! So you can see how central something like dialogue system will be to the game :P
User avatar
Tony Li
Posts: 21722
Joined: Thu Jul 18, 2013 1:27 pm

Re: New and Lost :(

Post by Tony Li »

Raelyr wrote:
Tony Li wrote:Hmm, is it possible your scene's manager is an instance of a prefab, and Unity is reverting it to the prefab state? I've come across that bug in some versions of Unity.
It's not a prefab, no. It's just an empty game object that holds all that scene's stuff like the background image and the characters in the scene. It's set up exactly like my first 'story' scene, except the first one works and the second one doesn't. :(
Strange. What happens if you close the scene and re-open it? If that doesn't help, what version of Unity are you using?
Raelyr
Posts: 19
Joined: Sat Aug 12, 2017 11:47 am

Re: New and Lost :(

Post by Raelyr »

Sorry! Busy couple of days where I didn't really work on it. But no, closing and reopening the scene didn't work, and neither did closing and reopening Unity. I'm using the latest version, though the personal one.

Also I have a small suggestion - unless there's a way to do this already and I just missed it, haha. But a way to 'disable' conversation nodes would be really neat and helpful. For example, I don't want to go through the whole first scene when I'm testing changes to my second scene, but the dialogue manager and player object are in the first scene and dontdestroyonload, so I have to start playmode from the first scene. So I added an option in the first set of responses to 'skip' to the last node in the conversation. I'd like to be able to disable that node when I go to build the game, and just enable it again afterward. Right now, I have to destroy and recreate it each time.
User avatar
Tony Li
Posts: 21722
Joined: Thu Jul 18, 2013 1:27 pm

Re: New and Lost :(

Post by Tony Li »

Raelyr wrote:Sorry! Busy couple of days where I didn't really work on it. But no, closing and reopening the scene didn't work, and neither did closing and reopening Unity. I'm using the latest version, though the personal one.
Thanks. I'll look into this. You're using Unity 2017.2? Maybe the editor is caching something strangely.
Raelyr wrote:Also I have a small suggestion - unless there's a way to do this already and I just missed it, haha. But a way to 'disable' conversation nodes would be really neat and helpful. For example, I don't want to go through the whole first scene when I'm testing changes to my second scene, but the dialogue manager and player object are in the first scene and dontdestroyonload, so I have to start playmode from the first scene. So I added an option in the first set of responses to 'skip' to the last node in the conversation. I'd like to be able to disable that node when I go to build the game, and just enable it again afterward. Right now, I have to destroy and recreate it each time.
Good suggestion. I'll look into adding that.

However, you may prefer this solution: Add a Dialogue Manager to your second scene. If you've saved the Dialogue Manager in the first scene as a prefab, just add an instance to your second scene, too. This will let you start playmode directly in the second scene. When you come in from the first scene, the first scene's Dialogue Manager will automatically destroy the second scene's Dialogue Manager.

In your dialogue database, define a Boolean variable named something like "Debug". Then add a "skip" response to your conversation whose Conditions require that Debug is true:

Code: Select all

Variable["Debug"] == true
On the second scene's Dialogue Manager, add a Lua Trigger set to OnStart. Set the Lua Code field (e.g., using the "..." wizard) to:

Code: Select all

Variable["Debug"] = true
When you playtest directly in the second scene, Debug will be true, so the "skip" response will be available.
Post Reply