[Bug] Quest node conditions don't stop checking when node is set to inactive

Announcements, support questions, and discussion for Quest Machine.
Post Reply
User avatar
nratcliff
Posts: 23
Joined: Tue Sep 27, 2022 10:47 am

[Bug] Quest node conditions don't stop checking when node is set to inactive

Post by nratcliff »

I have a quest setup detailed in this thread: https://www.pixelcrushers.com/phpbb/vie ... f=9&t=6747

After fixing the issue in that thread, however, I noticed that the quest can skip to the "win" node being true (and then on to the Success node) after the first time the player loses. After some digging, I realized this was because the lua condition the "win" node checks for never stops checking after the node is set to Inactive. I think this is because QuestConditionSet.ResetConditions() is called before StopChecking() when the node state changes to Inactive. Because ResetConditions sets m_isChecking to false, StopChecking returns out as soon as it is called, based on the if ... return block at the top.

My fix is to call StopChecking at the very top of ResetConditions if m_isChecking is true.

This seems to fix my issue but please let me know if there are any unintentional side effects this change could cause!
Lead Dev @ aesthetic.games
Creator of Easy Feedback Form
User avatar
Tony Li
Posts: 22098
Joined: Thu Jul 18, 2013 1:27 pm

Re: [Bug] Quest node conditions don't stop checking when node is set to inactive

Post by Tony Li »

That'll work. For version 1.2.34, I've put StopChecking() in QuestCondition.ResetState() as well. It's slightly redundant, but it will handle the case where a single QuestCondition's ResetState() is called.
Post Reply