The Dialogue system launch again with the OnUse trigger

Announcements, support questions, and discussion for the Dialogue System.
Lyonnais91
Posts: 8
Joined: Sun Jul 26, 2020 10:45 am

Re: The Dialogue system launch again with the OnUse trigger

Post by Lyonnais91 »

Hi,
Thanks !

This is the trace.
Capture dialogue.PNG
Capture dialogue.PNG (51.22 KiB) Viewed 229 times

Code: Select all

PixelCrushers.DialogueSystem.DialogueSystemController:StartConversation(String, Transform, Transform, Int32) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Manager/DialogueSystemController.cs:709)
PixelCrushers.DialogueSystem.DialogueManager:StartConversation(String, Transform, Transform, Int32) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Manager/DialogueManager.cs:410)
PixelCrushers.DialogueSystem.DialogueSystemTrigger:DoConversationAction(Transform) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Triggers/Triggers/DialogueSystemTrigger.cs:873)
PixelCrushers.DialogueSystem.DialogueSystemTrigger:Fire(Transform) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Triggers/Triggers/DialogueSystemTrigger.cs:635)
PixelCrushers.DialogueSystem.DialogueSystemTrigger:TryStart(Transform, Transform) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Triggers/Triggers/DialogueSystemTrigger.cs:617)
PixelCrushers.DialogueSystem.DialogueSystemTrigger:TryStart(Transform) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Triggers/Triggers/DialogueSystemTrigger.cs:603)
PixelCrushers.DialogueSystem.DialogueSystemTrigger:OnConversationStart(Transform) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Triggers/Triggers/DialogueSystemTrigger.cs:416)
UnityEngine.GameObject:BroadcastMessage(String, Object, SendMessageOptions)
PixelCrushers.DialogueSystem.DialogueSystemController:StartConversation(String, Transform, Transform, Int32) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Manager/DialogueSystemController.cs:744)
PixelCrushers.DialogueSystem.DialogueManager:StartConversation(String, Transform, Transform, Int32) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Manager/DialogueManager.cs:410)
PixelCrushers.DialogueSystem.DialogueSystemTrigger:DoConversationAction(Transform) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Triggers/Triggers/DialogueSystemTrigger.cs:873)
PixelCrushers.DialogueSystem.DialogueSystemTrigger:Fire(Transform) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Triggers/Triggers/DialogueSystemTrigger.cs:635)
PixelCrushers.DialogueSystem.DialogueSystemTrigger:TryStart(Transform, Transform) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Triggers/Triggers/DialogueSystemTrigger.cs:617)
PixelCrushers.DialogueSystem.DialogueSystemTrigger:TryStart(Transform) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Triggers/Triggers/DialogueSystemTrigger.cs:603)
PixelCrushers.DialogueSystem.DialogueSystemTrigger:OnUse() (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Triggers/Triggers/DialogueSystemTrigger.cs:494)
MonterSurPokemonVolant:Update() (at Assets/MonterSurPokemonVolant.cs:176)
The code is

Code: Select all

  void Update()
    {
        if (joueurGameObject.GetComponent<PlayerInput>().actions["Action1"].ReadValue<float>() == 1 && declencherDialogue == true && dialogueManager.GetComponent<PixelCrushers.DialogueSystem.DialogueSystemController>().IsConversationActive == false)
        {
               this.gameObject.GetComponent<PixelCrushers.DialogueSystem.DialogueSystemTrigger>().OnUse();
        }
    }
But I use it to launch the dialogue and if I remove it, the dialogue can not launch.
Maybe I need to assign a transform to the OnUse() ?

Edit : There something weird with IsConversationActive, i launch the dialogue when it's false but i see in the DialogueSystemController that it need to be set to true to display the warning : Another conversation is already active. Not starting.
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: The Dialogue system launch again with the OnUse trigger

Post by Tony Li »

In the Console window screenshot, I see that the previous line is:

Dialogue System: Dialogue System Trigger is firing OnConversationStart.

Do you have a second Dialogue System Trigger that is set to OnConversationStart? If so, then if this trigger also tries to start a conversation of course it will report the error because it runs as soon as another conversation has started.

Does your scene have only one instance of the MonterSurPokemonVolant script? If you have more than one instance, they could both be running Update() at the same time and trying to start the conversation.
Lyonnais91
Posts: 8
Joined: Sun Jul 26, 2020 10:45 am

Re: The Dialogue system launch again with the OnUse trigger

Post by Lyonnais91 »

Thanks !
I have three dialogue system trigger, one OnUse that trigger the conversation.
One on conversation start

Code: Select all

    public void HandleConversationStart()
    {
        enabled = false;
    }
One on conversation end

Code: Select all

    public void HandleConversationEnd()
    {
        // Wait one frame to allow input to clear:
        StartCoroutine(EnableAfterOneFrame());
    }
    IEnumerator EnableAfterOneFrame()
    {
        yield return new WaitForSeconds(1);
        enabled = true;
    }
And I have only one instance of "MonterSurPokemonVolant"
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: The Dialogue system launch again with the OnUse trigger

Post by Tony Li »

What is each Dialogue System Trigger configured to do? The Dialogue System Trigger that is set to OnConversationStart should not start a conversation.
Lyonnais91
Posts: 8
Joined: Sun Jul 26, 2020 10:45 am

Re: The Dialogue system launch again with the OnUse trigger

Post by Lyonnais91 »

My bad, that was that ! :o :)

The conversation start trigger had two actions : One for HandleConversationStart() and one other for starting the dialogue. Yeah, I needed to copy the dialogue system trigger from the gameobject to the dialogue manager to access the component from the gameobject (that have the script) and I forgot to remove that action ! :D

Thank you so much for your help and your time, you are awesome ! I think I will not need help now !

I will write a good review on the asset store to thank you !
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: The Dialogue system launch again with the OnUse trigger

Post by Tony Li »

Thanks! Glad to help! :-)
Post Reply