Lua Code exception: Object reference not set

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
papafhill
Posts: 2
Joined: Fri May 26, 2023 2:06 pm

Lua Code exception: Object reference not set

Post 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.
papafhill
Posts: 2
Joined: Fri May 26, 2023 2:06 pm

Re: Lua Code exception: Object reference not set

Post 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!
User avatar
Tony Li
Posts: 21684
Joined: Thu Jul 18, 2013 1:27 pm

Re: Lua Code exception: Object reference not set

Post by Tony Li »

Thanks for sharing your solution.
Post Reply