Quest Bool Field not being recognized

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Strig
Posts: 40
Joined: Fri Aug 21, 2020 12:33 pm

Quest Bool Field not being recognized

Post by Strig »

Hello, I've recently started implementing boolean variables inside my quests, because I want them to trigger different dialogue trees for multiple NPCs at once. However, I'm running into a problem.
Captura de Tela (33).png
Captura de Tela (33).png (32.03 KiB) Viewed 230 times
At first I place the Boolean variable in the corresponding Quest's Fields. And then I try to invoke it like this (I know there's a typo on the print, I already fixed it).
Captura de Tela (34).png
Captura de Tela (34).png (7.38 KiB) Viewed 230 times
However, I get the following error message:

Code: Select all

Dialogue System: Lua code 'return Quest["Travel to the Heart"].Talk_to_P_Dro == false and CurrentQuestState("Travel to the Heart") == "active"' threw exception 'Lookup of field 'Talk_to_P_Dro' in the table element failed because the table element itself isn't in the table.'
UnityEngine.Debug:LogError(Object)
PixelCrushers.DialogueSystem.Lua:RunRaw(String, Boolean, Boolean) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Wrapper/Lua Interpreter/Lua.cs:226)
PixelCrushers.DialogueSystem.Lua:Run(String, Boolean, Boolean) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Wrapper/Lua Interpreter/Lua.cs:127)
PixelCrushers.DialogueSystem.Lua:IsTrue(String, Boolean, Boolean) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Wrapper/Lua Interpreter/Lua.cs:169)
PixelCrushers.DialogueSystem.ConversationModel:EvaluateLinksAtPriority(ConditionPriority, DialogueEntry, List`1, List`1, List`1, Boolean) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Model/Logic/Model/ConversationModel.cs:378)
PixelCrushers.DialogueSystem.ConversationModel:EvaluateLinks(DialogueEntry, List`1, List`1, List`1, Boolean) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Model/Logic/Model/ConversationModel.cs:358)
PixelCrushers.DialogueSystem.ConversationModel:GetState(DialogueEntry, Boolean, Boolean, Boolean) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Model/Logic/Model/ConversationModel.cs:252)
PixelCrushers.DialogueSystem.ConversationModel:.ctor(DialogueDatabase, String, Transform, Transform, Boolean, IsDialogueEntryValidDelegate, Int32, Boolean, Boolean) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Model/Logic/Model/ConversationModel.cs:127)
PixelCrushers.DialogueSystem.DialogueSystemController:ConversationHasValidEntry(String, Transform, Transform) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Manager/DialogueSystemController.cs:604)
PixelCrushers.DialogueSystem.DialogueManager:ConversationHasValidEntry(String, Transform, Transform) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Manager/DialogueManager.cs:343)
PixelCrushers.DialogueSystem.DialogueSystemTrigger:DoConversationAction(Transform) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Triggers/Triggers/DialogueSystemTrigger.cs:829)
PixelCrushers.DialogueSystem.DialogueSystemTrigger:Fire(Transform) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Triggers/Triggers/DialogueSystemTrigger.cs:619)
PixelCrushers.DialogueSystem.DialogueSystemTrigger:TryStart(Transform, Transform) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Triggers/Triggers/DialogueSystemTrigger.cs:601)
PixelCrushers.DialogueSystem.DialogueSystemTrigger:TryStart(Transform) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Triggers/Triggers/DialogueSystemTrigger.cs:587)
PixelCrushers.DialogueSystem.DialogueSystemTrigger:OnUse(Transform) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Triggers/Triggers/DialogueSystemTrigger.cs:468)
UnityEngine.GameObject:BroadcastMessage(String, Object, SendMessageOptions)
PixelCrushers.DialogueSystem.ProximitySelector:UseCurrentSelection() (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Triggers/Interaction/ProximitySelector.cs:246)
System.Reflection.MethodBase:Invoke(Object, Object[])
BetterEventEntry:Invoke() (at Assets/Scripts/External Scripts/Better Events/BetterEventEntry.cs:33)
BetterEvent:Invoke() (at Assets/Scripts/External Scripts/Better Events/BetterEvent.cs:16)
GameEventListener:OnEventRaised() (at Assets/Scripts/GameEvent/GameEventListener.cs:20)
GameEvent:Raise() (at Assets/Scripts/GameEvent/GameEvent.cs:17)
Interact_Component:InputWasPressed(PlayerAction) (at Assets/Interact_Component.cs:14)
Input_Component:AssignInput(PlayerAction, IInputHandler) (at Assets/Scripts/Input_Component.cs:115)
Input_Component:Update() (at Assets/Scripts/Input_Component.cs:63)
So from what I understand, the system is treating the variable as if it doesn't exist... but it's right there! Am I doing something wrong while invoking it?
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Quest Bool Field not being recognized

Post by Tony Li »

Hi,

Use this:

Code: Select all

Quest["Travel_to_the_Heart"].Talk_to_P_Dro
Table indices -- that is, the part inside Quest[here] -- can't have blank spaces. When initializing the table, the Dialogue System automatically replaces spaces and other special characters with underscores. (more info)
Strig
Posts: 40
Joined: Fri Aug 21, 2020 12:33 pm

Re: Quest Bool Field not being recognized

Post by Strig »

It worked, thanks! I thought only the variables needed the underscores, not the quest name.

Thanks for the help!
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Quest Bool Field not being recognized

Post by Tony Li »

Hi,

Glad to help! Anything inside Actor["..."], Quest["..."], Item["..."], Location["..."], or Variable["..."] needs the underscores.
Post Reply