Re: Love/Hate + Dialog stays paused after reporting a deed twice
Posted: Fri Jul 03, 2020 5:19 pm
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!
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!