QuestLog.GetAllQuests (QuestState.Unassigned);

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
andrew2110
Posts: 39
Joined: Wed Sep 03, 2014 2:44 am

QuestLog.GetAllQuests (QuestState.Unassigned);

Post by andrew2110 »

I'm trying to get the Dialogue System working so I can display quests that are available to the player on a little minimap.

To do this I want to get a list of the quests in the game that are currently unassigned, then I have a field on them which is a comma delimited list of prerequisite quests that need to be completed for this quest to be considered as "available".

QuestLog.GetAllQuests - seems to be the way to do this, however this only seems to return anything if the quests are set to "active". Is there any way to get a list of all quests from the Lua tables without going through QuestLog?
User avatar
Tony Li
Posts: 22099
Joined: Thu Jul 18, 2013 1:27 pm

Re: QuestLog.GetAllQuests (QuestState.Unassigned);

Post by Tony Li »

Hi Andrew,

QuestLog.GetAllQuests(QuestState.Unassigned) should work. (Are you sure your quests are in the unassigned state?) I'll double check this today and reply back as soon as I can. If it doesn't work for some reason, I'll make sure it's working in the next version and put out a patch.

If you want to bypass QuestLog.GetAllQuests, you can get the quest table yourself:

Code: Select all

var questTable = Lua.Run("return Quest").AsTable; 
This returns a LuaTableWrapper, which is a generic wrapper that isolates you from how different Lua implementations implement arrays.

In the Dialogue System, the Quest[] table is an alias for the Item[] table. Items and quests share the same table. This was a concession to Chat Mapper, which doesn't have a concept of quests. As you iterate through the table, ignore any elements that have a sub-element "Is_Item" whose value is False, since these are items and not quests.
andrew2110
Posts: 39
Joined: Wed Sep 03, 2014 2:44 am

Re: QuestLog.GetAllQuests (QuestState.Unassigned);

Post by andrew2110 »

Moved back to my laptop and QuestLog.GetAllQuests appears to work as expected on here. Am updating Unity on my Laptop so it's the same as the one on my Desktop (5.3.3p3) and seeing if it's either a new bug in Unity or just some issues with my environment in general. Sorry to waste your time, knowing about: var questTable = Lua.Run("return Quest").AsTable; will be useful at some point in the future though I'm sure :)
User avatar
Tony Li
Posts: 22099
Joined: Thu Jul 18, 2013 1:27 pm

Re: QuestLog.GetAllQuests (QuestState.Unassigned);

Post by Tony Li »

Hi Andrew,

No worries! If the issue is still there after updating, just let me know.
Post Reply