Page 1 of 1

SetQuestState not working

Posted: Mon Dec 30, 2019 5:15 am
by Mackerel_Sky
Hi,

I'm looking to integrate quests into my project now, but for some reason the SetQuestState function in the dialogue function doesn't seem to be functioning correctly.

The point-and-click wizard writes the code correctly, and I think it should be running because I tried messing with the Lua and it threw an error when it got to the node, but otherwise nothing's happening to the test state. The code is just

Code: Select all

SetQuestState("Test Quest - Talk", "active")

as prefilled by the wizard but after it finishes running the quest entry's state remains at unassigned. Not getting any error messages for it as well. Any ideas?

Re: SetQuestState not working

Posted: Mon Dec 30, 2019 9:14 am
by Tony Li
Hi,

Let's make sure the line is actually running. Please temporarily set the Dialogue Manager's Other Settings > Debug Level to Info. In play mode, the Dialogue Editor's Templates tab turns into a Watches tab. You can set a watch on the quest state and tick Auto Refresh. Then play through the conversation or whatever calls SetQuestState. In the Console window, make sure you see this line:

Dialogue System: Lua(SetQuestState("Test Quest - Talk", "active"))

And check the state of the quest in the Watches tab.

If it's still not setting the quest state, is some other trigger or dialogue entry node perhaps setting the state back to unassigned? If that doesn't help, please feel free to send a reproduction project to tony (at) pixelcrushers.com.

Re: SetQuestState not working

Posted: Mon Dec 30, 2019 7:56 pm
by Mackerel_Sky
Hey Tony,

Thanks for the information. I assumed the regular quest window updated quest status/progress in play mode but using debug mode and watching the quest does indeed show that it gets updated as required.

Thanks for the help, and have a happy new year!

Re: SetQuestState not working

Posted: Mon Dec 30, 2019 8:31 pm
by Tony Li
Glad to help!

Only the Watches tab updates at runtime. The other tabs (Actors, Quests as you mentioned, Locations, Variables, and Conversations) don't update -- with the exception of the Conversations tab showing the state of the active conversation. If you open the Conversations tab onto the active conversation at runtime, the current dialogue entry node will be colored green. Links to valid nodes (Conditions are true) will also be green. Links to invalid nodes (Conditions are false) will be red.

Have a happy new year!

Re: SetQuestState not working

Posted: Tue Mar 12, 2024 9:07 am
by zzzz
Hello Tony, I'm encountering an issue with SetQuestState, it's not assigning my quest and returns the following error :

Dialogue System: Lua code 'SetQuestState(“acquire essentials”, "active")' threw exception 'Code has syntax errors:
Line 1, Col 15 '“': Failed to parse Expr of GroupExpr.
Line 1, Col 14 '(': Failed to parse Letter of Name.
Line 1, Col 14 '(': Failed to parse Name of VarName.
Line 1, Col 14 '(': Failed to parse 'nil' of NilLiteral.
Line 1, Col 14 '(': Failed to parse Text of BoolLiteral.
Line 1, Col 14 '(': Failed to parse '0'...'9' of Digit.
Line 1, Col 14 '(': Failed to parse (Digit)+ of FloatNumber.
Line 1, Col 14 '(': Failed to parse Name of VariableArg.
Line 1, Col 14 '(': Failed to parse firstTerm of OperatorExpr.
Line 1, Col 14 '(': Failed to parse Expr of ExprStmt.
Line 1, Col 14 '(': Failed to parse remaining input.

I had no problems until creating a second database for testing different dialogue mechanics, but I did set everything in the scene to use this new test database. Where do you suspect the issue may lie?

thank you

Re: SetQuestState not working

Posted: Tue Mar 12, 2024 9:44 am
by Tony Li
Hi,

Fix the double quotes around “acquire essentials”.
They're using fancy formatted quotes (“ ”), but Lua requires basic quotes (" "): "acquire essentials".

Re: SetQuestState not working

Posted: Tue Mar 12, 2024 9:59 pm
by zzzz
wow, I never considered that could be the cause... thanks

Re: SetQuestState not working

Posted: Tue Mar 12, 2024 10:27 pm
by Tony Li
Glad to help!