Don't Trigger OnConversationEnd() event just once.

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
LostContinentGames
Posts: 4
Joined: Tue Oct 29, 2024 5:28 am

Don't Trigger OnConversationEnd() event just once.

Post by LostContinentGames »

I have an OnConversationEnd event on my player; however, there are very few situations in which I do not want it to trigger. Is it possible to add an exception in the conversation somewhere?
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Don't Trigger OnConversationEnd() event just once.

Post by Tony Li »

Hi,

I suppose you could set a variable. For example, in that special conversation set a DS variable true:

Code: Select all

Variable["SkipEndEvents"] = true
Then check that variable in your OnConversationEnd() handlker and set it back to false. If you're using a script:

Code: Select all

void OnConversationEnd(Transform actor)
{
    if (DialogueLua.GetVariable("SkipEndEvents").asBool == true)
    {
        DialogueLua.SetVariable("SkipEndEvents", false);
        return;
    }
    // Here, do your end event handling.
}
If you're using a Dialogue System Events component, you could replace it with two Dialogue System Triggers set to OnConversationEnd. In the first, set Conditions > Lua Conditions to check if "SkipEndEvents" is true. If so, run Action > Run Lua Code to set it false. In the second, set Conditions > Lua Conditions to check if "SkipEndEvents" is false. If so, do your regular event handling.
LostContinentGames
Posts: 4
Joined: Tue Oct 29, 2024 5:28 am

Re: Don't Trigger OnConversationEnd() event just once.

Post by LostContinentGames »

Oh, yeah, that's a good way to handle it.

If I'm on my Player Movement script, and I want to access a bool in the variable section of my dialogue system database, how do I do that?
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Don't Trigger OnConversationEnd() event just once.

Post by Tony Li »

Hi,

Use the DialogueLua class. (Example in the code excerpt of my previous reply.)
Post Reply