How can I specify starting dialogue after a conversation
-
- Posts: 10
- Joined: Thu Feb 29, 2024 10:11 am
How can I specify starting dialogue after a conversation
For example, I talk to an NPC at node 4, then I leave, and when I come back, I want to continue at node 5.
Re: How can I specify starting dialogue after a conversation
Hi,
Here are two options:
1. Use a dialogue database variable to record the player's position. Then use Conditions to go to that entry. This works best if you want to record specific parts in the conversation. Example:
2. Or record the current dialogue entry ID in a C# script and use DialogueManager.StartConversation() to start the conversation again at the next entry. Example:
Here are two options:
1. Use a dialogue database variable to record the player's position. Then use Conditions to go to that entry. This works best if you want to record specific parts in the conversation. Example:
2. Or record the current dialogue entry ID in a C# script and use DialogueManager.StartConversation() to start the conversation again at the next entry. Example:
Code: Select all
int nextEntryID = -1;
void OnConversationLine(Subtitle subtitle)
{
var npcResponses = DialogueManager.currentConversationState.npcResponses;
nextEntryID = (npcResponses.Length > 0) ? npcResponses[0] : -1;
}
public void ResumeConversation()
{
DialogueManager.StartConversation("conversation-title", playerTransform, npcTransform, nextEntryID);
}
-
- Posts: 10
- Joined: Thu Feb 29, 2024 10:11 am
Re: How can I specify starting dialogue after a conversation
Thank you Tony, very quick and informative reply
-
- Posts: 10
- Joined: Thu Feb 29, 2024 10:11 am
Re: How can I specify starting dialogue after a conversation
Is it the same solution to this case
an NPC has 2 conversations, I named it A and B.
an NPC has 2 conversations, I named it A and B.
- The conversation A will be triggered if I click that NPC
- The conversation B will be triggered if the player touch him (by collider)
Last edited by hoangvm2307 on Fri Mar 01, 2024 11:01 am, edited 1 time in total.
Re: How can I specify starting dialogue after a conversation
Hi,
You can use two separate Dialogue System Triggers on the same NPC.
You can use two separate Dialogue System Triggers on the same NPC.
- Set conversation A's trigger to OnUse and add a Usable component and a collider to the NPC. Configure a Selector component on the player/camera to use mouse position, and set the Use Key to Mouse 0.
- Set conversation B's trigger to OnCollisionEnter. Make sure the player and NPC are on layers that will register collisions.
-
- Posts: 10
- Joined: Thu Feb 29, 2024 10:11 am
Re: How can I specify starting dialogue after a conversation
Thank you for your help
Re: How can I specify starting dialogue after a conversation
Happy to help!