Page 1 of 2

A way to universally delay Conversation stop?

Posted: Thu Jun 01, 2023 12:00 pm
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.

Re: A way to universally delay Conversation stop?

Posted: Thu Jun 01, 2023 3:27 pm
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.

Re: A way to universally delay Conversation stop?

Posted: Sat Jun 03, 2023 5:29 am
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.

Re: A way to universally delay Conversation stop?

Posted: Sat Jun 03, 2023 8:17 am
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?

Re: A way to universally delay Conversation stop?

Posted: Sat Jun 03, 2023 11:20 am
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.

Re: A way to universally delay Conversation stop?

Posted: Sat Jun 03, 2023 11:46 am
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.

Re: A way to universally delay Conversation stop?

Posted: Sat Jun 03, 2023 3:05 pm
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?

Re: A way to universally delay Conversation stop?

Posted: Sat Jun 03, 2023 3:25 pm
by Tony Li
No problem at all. They're equivalent.

How do we know that the FSM is in the Listener state?

Re: A way to universally delay Conversation stop?

Posted: Sat Jun 03, 2023 3:49 pm
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:

Re: A way to universally delay Conversation stop?

Posted: Sat Jun 03, 2023 4:26 pm
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".