Page 1 of 1
Don't Trigger OnConversationEnd() event just once.
Posted: Wed Nov 06, 2024 2:49 am
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?
Re: Don't Trigger OnConversationEnd() event just once.
Posted: Wed Nov 06, 2024 7:19 am
by Tony Li
Hi,
I suppose you could set a variable. For example, in that special conversation set a DS variable 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.
Re: Don't Trigger OnConversationEnd() event just once.
Posted: Wed Nov 06, 2024 10:40 pm
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?
Re: Don't Trigger OnConversationEnd() event just once.
Posted: Thu Nov 07, 2024 7:15 am
by Tony Li
Hi,
Use the
DialogueLua class. (Example in the code excerpt of my previous reply.)