Page 1 of 1

Lua Code exception: Object reference not set

Posted: Fri May 26, 2023 2:19 pm
by papafhill
The problem occurs whenever I talk to an NPC. it worked last night, but booting up my project today it is throwing this error, then my dialogue is shutting down complete and no NPC will talk to me. This happens after it tries to set the "Gathering A Team" quest to "active."

The exact language of the error is:

Dialogue System: Lua code 'return CurrentQuestState("Gathering A Team") == "active" and and (Actor["Commoner"].IsRecruited == false)' threw exception 'Object reference not set to an instance of an object'
UnityEngine.Debug:LogError (object)

Not sure what I'm missing.

Re: Lua Code exception: Object reference not set

Posted: Fri May 26, 2023 3:09 pm
by papafhill
I figured it out!

It had nothing to do with setting a reference. it was the "and and" part of the Conditions statement within the Dialogue Manager. By removing the doubled up logical condition statements it now works flawlessly! Hopeful this helps someone else some day!

Re: Lua Code exception: Object reference not set

Posted: Fri May 26, 2023 3:41 pm
by Tony Li
Thanks for sharing your solution.