Issue in Unity 5.0 with getting all active quests.

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Adam Davis
Posts: 2
Joined: Tue Mar 17, 2015 1:03 pm

Issue in Unity 5.0 with getting all active quests.

Post by Adam Davis »

Hey guys, I recently purchased your Dialogue System because it's simply the Best system available for Unity that out there. My Team and I have recently moved out project to Unity 5.0 and we've also updated to your 1.4.8 dialogue system. we've installed the 5.0 DLL files, and the Unity UI support package.



We have set an array string of

public string[] questNames;



//Used to get all the quests based on the state this should be active

questNames = QuestLog.GetAllQuests();

questCount = questNames.Length;



According to your documentation this should result in our getting a list of Active Quest Names that we can populate a QuestLog window with.



However we get an error:

InvalidCastException: Cannot cast from source type to destination type.

PixelCrushers.DialogueSystem.QuestLog.GetAllQuests (QuestState flags)



Has something changed in 5.0? Also we tried using your own Quest Tracker script and the same call in your own script causes the same exact error.
User avatar
Tony Li
Posts: 21049
Joined: Thu Jul 18, 2013 1:27 pm

Issue in Unity 5.0 with getting all active quests.

Post by Tony Li »

Hi Adam,



Sorry for the delay in replying. I've been trying to reproduce this but I haven't been able to. Would it be possible for you to please email your dialogue database to tony (at) pixelcrushers.com? If you could export it as a unitypackage, that would be ideal.



Is there any more to the error message? Can you reproduce the error, select it in the console, hit Ctrl-C (Command-C) to copy it to the clipboard, and paste it into a reply?



Nothing changed in 5.0. QuestLog.GetAllQuests() does one cast. For each element in Lua's Item[] table, it gets the element's "Is Item" field. If this field exists and its type is bool, it casts it as a bool to check its value.
Adam Davis
Posts: 2
Joined: Tue Mar 17, 2015 1:03 pm

Issue in Unity 5.0 with getting all active quests.

Post by Adam Davis »

Sent you an email containing our database as a package, the database as chat mapper file using your provided template, and a copy of our very basic script simply trying to access the GetAllQuests() information.
User avatar
Tony Li
Posts: 21049
Joined: Thu Jul 18, 2013 1:27 pm

Issue in Unity 5.0 with getting all active quests.

Post by Tony Li »

Adam,



Please check your email. I just replied. Once we have a solution, I'll post it here in case future readers are in the same boat.



Tony


User avatar
Tony Li
Posts: 21049
Joined: Thu Jul 18, 2013 1:27 pm

Issue in Unity 5.0 with getting all active quests.

Post by Tony Li »

For other readers who might be running into the same issue:

The issue was just a typo. A dialogue entry's Script field was:



Item[Introduction] = "active"



It just needed to be changed to this:



Item[Introduction].State = "active"



The QuestLog.GetAllQuests() method assumes that Item[Introduction] is a table with fields such as Item[Introduction].State, Item[Introduction].Description, etc. The original Script field turned Item[Introduction] into a single string value ("active") instead of a table. The Dialogue System will handle this more gracefully in the next version.



As an aside, the Dialogue System template Chat Mapper project (used by the game developer in this case) has this Global Script: Quest=Item. This makes Quest an alias for Item. So the Script field could optionally be changed to:



Quest[Introduction].State = "active"
Post Reply