SetQuestState not working

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Mackerel_Sky
Posts: 111
Joined: Mon Apr 08, 2019 8:01 am

SetQuestState not working

Post 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?
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: SetQuestState not working

Post 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.
Mackerel_Sky
Posts: 111
Joined: Mon Apr 08, 2019 8:01 am

Re: SetQuestState not working

Post 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!
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: SetQuestState not working

Post 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!
zzzz
Posts: 11
Joined: Thu Feb 22, 2024 10:15 pm

Re: SetQuestState not working

Post 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
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: SetQuestState not working

Post by Tony Li »

Hi,

Fix the double quotes around “acquire essentials”.
They're using fancy formatted quotes (“ ”), but Lua requires basic quotes (" "): "acquire essentials".
zzzz
Posts: 11
Joined: Thu Feb 22, 2024 10:15 pm

Re: SetQuestState not working

Post by zzzz »

wow, I never considered that could be the cause... thanks
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: SetQuestState not working

Post by Tony Li »

Glad to help!
Post Reply