Page 1 of 1

Trigger conversation start in period of time

Posted: Fri May 22, 2020 1:38 pm
by joeylu
I'm trying to make my narrative game more "live", by adding random conversations from NPCs

for instance, a NPC is following the player to explorer some area, other than scripted conversations, the NPC will trigger some random conversations while following.

Question #1: How do I trigger a random conversation from the database?
I'm thinking to added an additional Dialogue System Trigger to the NPC, specified a conversation and input RandomizeNextEntry() for <START> node sequence area. Am I doing the correct way? also, how do I trigger the conversation at first place?

Question #2: How do I track the last conversation end time?
In order to "NOT" make these dialogues too predictable, the conversation should be triggered after the previous conversion end in a random time period (for example: 15 seconds to 25 seconds)
I'm thinking to add a variable in the database to hold the last conversation end time, then add a custom script in dialogue manager game object and override the OnConversationEnd() and set the timer in the method, am I doing the correct way?

tks Tony

Re: Trigger conversation start in period of time

Posted: Fri May 22, 2020 4:31 pm
by Tony Li
joeylu wrote: Fri May 22, 2020 1:38 pmQuestion #1: How do I trigger a random conversation from the database?
I'm thinking to added an additional Dialogue System Trigger to the NPC, specified a conversation and input RandomizeNextEntry() for <START> node sequence area. Am I doing the correct way? also, how do I trigger the conversation at first place?
Yes. That's a good way. You might trigger the conversation using Dialogue System Triggers set to OnTriggerEnter in various places around the game world. Or you could start a conversation manually by calling DialogueManager.StartConversation() in code when interesting things happen, such as when a battle ends. Or you could just run a semi-randomized timer in a script, and start the conversation whenever the timer is up.
joeylu wrote: Fri May 22, 2020 1:38 pmQuestion #2: How do I track the last conversation end time?
In order to "NOT" make these dialogues too predictable, the conversation should be triggered after the previous conversion end in a random time period (for example: 15 seconds to 25 seconds)
I'm thinking to add a variable in the database to hold the last conversation end time, then add a custom script in dialogue manager game object and override the OnConversationEnd() and set the timer in the method, am I doing the correct way?
That's how I'd do it.