Hi. I don't want to start conversation by default triggers in Dialogue system trigger.
I searched everywhere but I couldn't find a way for it.
Is there any code for starting the conversation from inside my scripts?
How to Start conversation by script
Re: How to Start conversation by script
Ok, finally I found this. But how can I get the conversation title from Dialogue system trigger component?
PixelCrushers.DialogueSystem.DialogueManager.StartConversation ( string title,
Transform actor,
Transform conversant,
int initialDialogueEntryID
)
PixelCrushers.DialogueSystem.DialogueManager.StartConversation ( string title,
Transform actor,
Transform conversant,
int initialDialogueEntryID
)
Re: How to Start conversation by script
Again Found the solution!
I hope I'm doing it right..
DialogueManager.StartConversation(TargetObject.GetComponent<DialogueSystemTrigger>().conversation.ToString(), TargetObject.transform);
But as always faced a new problem!
Now the Dialogue system events, doesn't work and my codes for OnConversationStart or End, are useless.
I hope I'm doing it right..
DialogueManager.StartConversation(TargetObject.GetComponent<DialogueSystemTrigger>().conversation.ToString(), TargetObject.transform);
But as always faced a new problem!
Now the Dialogue system events, doesn't work and my codes for OnConversationStart or End, are useless.
Re: How to Start conversation by script
Hi,
The Dialogue Manager always receives Dialogue System event messages. If you want the actor or conversant to receive Dialogue System event messages, you must specify the actor and conversant in DialogueManager.StartConversation():
If you want, you can also add these fields directly to your own script and bypass Dialogue System Trigger:
Or you can set up the Dialogue System Trigger with the correct actor and conversant, set its Trigger to OnUse, and call OnUse() manually:
The Dialogue Manager always receives Dialogue System event messages. If you want the actor or conversant to receive Dialogue System event messages, you must specify the actor and conversant in DialogueManager.StartConversation():
Code: Select all
var conversation = TargetObject.GetComponent<DialogueSystemTrigger>().conversation;
var actor = TargetObject;
var conversant = /* some other GameObject? */
DialogueManager.StartConversation(conversation, actor, conversant);
Code: Select all
[ConversationPopup] public string conversation;
public Transform actor;
public Transform conversant;
...
void StartMyConversation()
{
DialogueManager.StartConversation(conversation, actor, conversant);
}
Code: Select all
TargetObject.GetComponent<DialogueSystemTrigger>().OnUse();
Re: How to Start conversation by script
Hi I have a follow up question.
What if my actor is talking to himself? Can I leave conversant as Null?
Also, how do I specify which to use in the following code?
var conversation = TargetObject.GetComponent<DialogueSystemTrigger>().conversation;
Thank you!
What if my actor is talking to himself? Can I leave conversant as Null?
Also, how do I specify which to use in the following code?
var conversation = TargetObject.GetComponent<DialogueSystemTrigger>().conversation;
Thank you!
Re: How to Start conversation by script
Hi,
Yes, you can leave the conversant as null.
Yes, you can leave the conversant as null.
The previous poster already had a TargetObject value. I don't know what it was. But presumably it's an NPC or object that has a Dialogue System Trigger component.