Page 2 of 2

Re: Love/Hate + Dialog stays paused after reporting a deed twice

Posted: Fri Jul 03, 2020 5:19 pm
by swampytable
Hi,

I think I got to the root of the problem, though I wish I was sure why it was happening. Here's what was going on.

When I talked to an NPC, it would trigger a Dialogue System Trigger event. The Dialogue system trigger on the NPC had the "Pause game during conversation" box ticked. When that box is ticked, when a dialogue system trigger event is fired, the current time scale is saved to a "previousTimeScale" variable, and when the conversation end event fires, the time.Timescale is set to the previousTimeScale. Pretty standard stuff.

The first time I would talk to an NPC, the event would fire once, the conversation would end, the ending event would reset the time. Everything as it should be.

The second time I would talk to the NPC, the event would fire twice in a row. The "previousTimeScale" would get set to 1 and Time.Timescale would get set to 0 on the first run, then the second event that immediately followed would see the current time is 0, and set the previousTimeScale to 0 and the current timescale to 1, effectively unpausing the game ONLY DURING CONVERSATION, and then the conversation ends and the previousTimeScale, which is now 0, is set to the Time.Timescale, and so the game appears to freeze or needs manually reset.

The simple solution is to check the box "Exclusive" so that the double triggering thing can't happen. It was so difficult to work that out! I am curious why the event fires twice the second time around anyway, I didn't dig that far because I think the exclusive box will fix all the issues i've been having. If you know why I'd be interested to know.

Anyhow, just thought I'd share my solution in case it helps anyone down the road. Thanks!

Re: Love/Hate + Dialog stays paused after reporting a deed twice

Posted: Fri Jul 03, 2020 8:01 pm
by Tony Li
I don't know why the Dialogue System Trigger would fire twice -- unless perhaps you're using OnTriggerEnter or OnCollisionEnter and the player or NPC has two or more colliders, in which case more than one collider could cause the trigger to fire. If you'd like to send me a reproduction project, I'll be happy to take a look and let you know what's going on.

Re: Love/Hate + Dialog stays paused after reporting a deed twice

Posted: Fri Jul 03, 2020 8:40 pm
by swampytable
It's okay, I'm curious but not that curious. :p

Thanks for all your help Toni, I really appreciate you supporting your packages well!