Page 1 of 1

Execute event after ConversationEnded in only one branch

Posted: Tue Mar 03, 2020 4:10 am
by Zlus
Hello everyone,

I'm currently trying to execute a method in a script after the conversation ended. However, the catch is that only one Outcome of the conversation should cause the execution.

Currently, the solution attempt is to use OnExecute() in the Events inspector field in the dialogue window at the last sequence of the conversation. However, the method is executed WHILE the sequence is active, not after the conversation.

Adding an empty sequence also doesn't work because it waits for the user click.

Did anyone have the same Problem and solve it?

Re: Execute event after ConversationEnded in only one branch

Posted: Tue Mar 03, 2020 8:23 am
by Tony Li
You could add an empty node and include the Continue() sequencer command in the Sequence so the player doesn't have to click.

Or you could set a variable in the two branches -- for example setting the Script fields in the 2 possible ending nodes like this:

lastChoice1.png
lastChoice1.png (5.67 KiB) Viewed 352 times
lastChoice2.png
lastChoice2.png (5.75 KiB) Viewed 352 times

And adding a Dialogue System Trigger set to On Conversation End that checks the variable:

lastChoiceEnd.png
lastChoiceEnd.png (35.13 KiB) Viewed 352 times

Or, if you don't want to use a Dialogue System Trigger, you can add an OnConversationEnd method to a script:

Code: Select all

void OnConversationEnd(Transform actor)
{
    if (DialogueLua.GetVariable("LastChoice").asInt == 2)
    {
        // do something
    }
}

Re: Execute event after ConversationEnded in only one branch

Posted: Fri Mar 06, 2020 12:14 pm
by Zlus
Hi,

thanks a lot! Everything worked!

Re: Execute event after ConversationEnded in only one branch

Posted: Fri Mar 06, 2020 1:12 pm
by Tony Li
Glad to help! :-)