A way to universally delay Conversation stop?

Announcements, support questions, and discussion for the Dialogue System.
User avatar
Abelius
Posts: 312
Joined: Fri Jul 21, 2017 12:45 pm

A way to universally delay Conversation stop?

Post by Abelius »

Hi there,

I've just identified an issue in my game engine, where I encounter all kids of problems caused by a DS conversation starting and stopping in the same frame.

I'm using some convos, not as conversations per se, but to check variables and setup the scene accordingly, so they start and stop extremely fast. And that seems to be a problem with the rest of my logic.

Now, I know I could just add a delay node on those convos, but I'm wondering if I could do that in a "universal" way by modifying DS scripts related to how conversations are stopped. (?)

Thanks.
Unity 2019.4.9f1
Dialogue System 2.2.15
User avatar
Tony Li
Posts: 21681
Joined: Thu Jul 18, 2013 1:27 pm

Re: A way to universally delay Conversation stop?

Post by Tony Li »

Hi,

Can you identify what problems it's causing with the game's logic? You may be able to hook into a different C# event or script method to make it work the way you want without having to modify DS scripts.
User avatar
Abelius
Posts: 312
Joined: Fri Jul 21, 2017 12:45 pm

Re: A way to universally delay Conversation stop?

Post by Abelius »

Heh, I'd wish! :D

My game is kind of a "put all together and pray" kind of thing. And I do 90% of the logic with PlayMaker, which doesn't offer a much convenient way to debug, tbh.

Anyway, what's causing the various issues is that I'm running actions triggered by Conversation Start and Conversation End, and both run on the same PlayMaker FSM, so I suspect Conversation End logic doesn't run at all when a conversation starts and ends in the same frame (the FSM is still running the start actions and doesn't "hear" the end event).

That's why I need to make sure every conversation lasts for at least 0.1 seconds after it's started.
Unity 2019.4.9f1
Dialogue System 2.2.15
User avatar
Tony Li
Posts: 21681
Joined: Thu Jul 18, 2013 1:27 pm

Re: A way to universally delay Conversation stop?

Post by Tony Li »

Do you think it would help if I were to send you a version of the Dialogue System Events To PlayMaker component that waits one frame before raising the OnConversationEnd event if OnConversationStart happened on the same frame?
User avatar
Abelius
Posts: 312
Joined: Fri Jul 21, 2017 12:45 pm

Re: A way to universally delay Conversation stop?

Post by Abelius »

That would be great but I'm actually not sure if waiting another frame would be enough.

If it could be a configurable amount, or even better, a fixed real-time delay, that would do the trick in the worst case scenario.
Unity 2019.4.9f1
Dialogue System 2.2.15
User avatar
Tony Li
Posts: 21681
Joined: Thu Jul 18, 2013 1:27 pm

Re: A way to universally delay Conversation stop?

Post by Tony Li »

Is there a specific event it could wait for? If it waits for a realtime duration in seconds, it's possible that the OnConversationEnd event could still happen too early on a very slow computer.
User avatar
Abelius
Posts: 312
Joined: Fri Jul 21, 2017 12:45 pm

Re: A way to universally delay Conversation stop?

Post by Abelius »

I just need to make sure all actions in that FSM are done, so when the OnConversationEnd event is sent to it, it's again in the Listener state.

So, if there was a way to communicate the FSM is now in that state, by running an action when it's back there, for example, that would work.

But now that I think about it... I'm actually using the plain Dialogue System Events, not the "...To PlayMaker" version.

Image

Is that a problem?
Unity 2019.4.9f1
Dialogue System 2.2.15
User avatar
Tony Li
Posts: 21681
Joined: Thu Jul 18, 2013 1:27 pm

Re: A way to universally delay Conversation stop?

Post by Tony Li »

No problem at all. They're equivalent.

How do we know that the FSM is in the Listener state?
User avatar
Abelius
Posts: 312
Joined: Fri Jul 21, 2017 12:45 pm

Re: A way to universally delay Conversation stop?

Post by Abelius »

Each PlayMakerFSM component has the .ActiveStateName string property, it seems. But I guess it would need to be polled each frame.

Sounds like a complex thing to do because you'd need to get the FSM component from the Dialogue System Events, no?

Well, maybe just a configurable number of frames before sending the event will do. :lol:
Unity 2019.4.9f1
Dialogue System 2.2.15
User avatar
Tony Li
Posts: 21681
Joined: Thu Jul 18, 2013 1:27 pm

Re: A way to universally delay Conversation stop?

Post by Tony Li »

Hi,

Import this updated PlayMaker integration:

DS_PlayMakerSupport_2023-06-03.unitypackage

And this custom subclass:

DS_CustomDialogueSystemEventsToPlayMaker_2023-06-03.unitypackage

Then add CustomDialogueSystemEventsToPlayMaker to your Dialogue Manager.

Set "Frames To Wait Before Conversation End Event" to whatever value works.

Configure your FSM to listen for the event "OnConversationEnd" instead of "Stop".
Post Reply