Hello!
I've made a script in Unity that allows talking with NPCs whenever you walk into a collider area.
When the main character is in the area, you can activate the dialogue by pressing a button.
The script blocks the character animation ad controller input, then in the last sentence, it gets reactivated by interacting through the script.
When the conversation ends, the character can move again. But if I'm using an NPC dialogue, the character will move while the dialogue box is still open, it will close only if I click on Continue. If I use a dialogue option, however, the player can click on the option and the box will disappear allowing the character the move.
How can I create a dialogue block that allows the character movement ONLY after the player closes the finished dialogue?
I would like to have the dialogue behave like in any other role-playing game . Can you help me with this or suggest a smarter method? Thank you so much!
Link to the dialogues setup:
Exit from Conversation
Re: Exit from Conversation
Hi,
I recommend using a Dialogue System Events component on the player GameObject, as described at 07:00 of the Interaction Tutorial.
I recommend using a Dialogue System Events component on the player GameObject, as described at 07:00 of the Interaction Tutorial.
Re: Exit from Conversation
Thank you! Now it works like a charm
Re: Exit from Conversation
Oh, I've encountered another problem.
So, the system you've suggested works, but I need to specify a Conversation Conversant (set to my Main Character prefab) otherwise it won't work.
Problem is that by using a character through different scenes (with DontDestroyOnLoad component), whenever I change scene the Conversation Conversant connection is lost. How can I keep the connection on?
Screenshot for reference (MC_Princess is my main character):
So, the system you've suggested works, but I need to specify a Conversation Conversant (set to my Main Character prefab) otherwise it won't work.
Problem is that by using a character through different scenes (with DontDestroyOnLoad component), whenever I change scene the Conversation Conversant connection is lost. How can I keep the connection on?
Screenshot for reference (MC_Princess is my main character):
Re: Exit from Conversation
Hi,
Add a Dialogue Actor component to the conversation conversant's GameObject, and set the Actor dropdown to the conversant actor. Then leave the Dialogue System Trigger's Conversation Conversant unassigned.
Add a Dialogue Actor component to the conversation conversant's GameObject, and set the Actor dropdown to the conversant actor. Then leave the Dialogue System Trigger's Conversation Conversant unassigned.
Re: Exit from Conversation
Should the Actor be the Main Character, as a best practice?
Re: Exit from Conversation
Hi,
Yes. If it's a player - NPC conversation, I usually set the conversation's Actor to the player and the Conversant to the NPC.
You usually set up Dialogue System Triggers on NPCs. If the Dialogue System Trigger's Conversation Conversant field is blank, and if no GameObject has a Dialogue Actor component for the conversant, then the Dialogue System Trigger will use its own GameObject (the NPC GameObject) as the conversation conversant. This matches up nicely if you've set the conversation's Conversant to the NPC. (More info: Character GameObject Assignments)
If you want to be able to use the same "generic" conversation for multiple characters, such as a generic villager conversation for all villager NPCs, you can only specify GameObjects for the primary actor and conversant. So the generic NPC should be the conversation's primary actor or conversant. (And I recommend it be the conversant for the reasons above.)
Yes. If it's a player - NPC conversation, I usually set the conversation's Actor to the player and the Conversant to the NPC.
You usually set up Dialogue System Triggers on NPCs. If the Dialogue System Trigger's Conversation Conversant field is blank, and if no GameObject has a Dialogue Actor component for the conversant, then the Dialogue System Trigger will use its own GameObject (the NPC GameObject) as the conversation conversant. This matches up nicely if you've set the conversation's Conversant to the NPC. (More info: Character GameObject Assignments)
If you want to be able to use the same "generic" conversation for multiple characters, such as a generic villager conversation for all villager NPCs, you can only specify GameObjects for the primary actor and conversant. So the generic NPC should be the conversation's primary actor or conversant. (And I recommend it be the conversant for the reasons above.)