Page 1 of 1

Quest State

Posted: Sun Feb 14, 2016 11:25 am
by garrett123
I'm trying to make my quest state set to active by using this

Code: Select all

Quest["Find_Apples"].State == "active"; Variable["Alert"] = "Quest: Find me some apples!"
The alert shows up but the state is not becoming active, I tried other states as well but no luck. I tried setting the state with the LUA Console but still no luck, but when I tried setting it in the Dialogue Editor' Quests/Items tab as active, it worked. Please help me.

Re: Quest State

Posted: Sun Feb 14, 2016 11:47 am
by Tony Li
Hi,

Use a single equals sign to assign values:

Code: Select all

Quest["Find_Apples"].State = "active"; Variable["Alert"] = "Quest: Find me some apples!"
Version 1.5.9 added a new Lua function SetQuestState that you might prefer to use:

Code: Select all

SetQuestState("Find Apples", "active"); Variable["Alert"] = "Quest: Find me some apples!"
The Lua wizards now use this function instead of setting the value directly. This also allows the new OnQuestStateChange message to work. And you don't need to fiddle with those underscore ( _ ) characters.

There's also a new CurrentQuestState function to check the current quest state. But you still need to use double equals signs to test values (as compared to single equals to assign values):

Code: Select all

CurrentQuestState("Find Apples") == "unassigned"
^ The condition above is true if the Find Apples quest is unassigned.

Re: Quest State

Posted: Mon Feb 15, 2016 12:38 am
by garrett123
Tony Li wrote:Hi,

Use a single equals sign to assign values:

Code: Select all

Quest["Find_Apples"].State = "active"; Variable["Alert"] = "Quest: Find me some apples!"
Version 1.5.9 added a new Lua function SetQuestState that you might prefer to use:

Code: Select all

SetQuestState("Find Apples", "active"); Variable["Alert"] = "Quest: Find me some apples!"
The Lua wizards now use this function instead of setting the value directly. This also allows the new OnQuestStateChange message to work. And you don't need to fiddle with those underscore ( _ ) characters.

There's also a new CurrentQuestState function to check the current quest state. But you still need to use double equals signs to test values (as compared to single equals to assign values):

Code: Select all

CurrentQuestState("Find Apples") == "unassigned"
^ The condition above is true if the Find Apples quest is unassigned.
I actually realized that before I saw this. Sorry for the dumb question. Thanks!
Another question is how to get rid of the "track ui"? It is supposed to be gone after I complete a gathering object quest.

Re: Quest State

Posted: Mon Feb 15, 2016 10:15 am
by Tony Li
garrett123 wrote:Another question is how to get rid of the "track ui"? It is supposed to be gone after I complete a gathering object quest.
If your quest is complete (i.e., the state is "success", "failure", or "done"), it should only show up in the quest tracker HUD if you've ticked Show Completed Quests. (And in this case it will show up in the Text style you've specified for Success Description or Failure Description on the Unity UI Quest Track Template.)

You can check your quest's state on the Dialogue Editor's Watches tab or the Lua Console, which is handy if you're in a build and not in the editor. For example, you could enter this in the Lua Console:

Code: Select all

return CurrentQuestState("Find Apples")