Lua commands

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
hapciupalit
Posts: 24
Joined: Tue Nov 28, 2017 10:04 am

Lua commands

Post by hapciupalit »

In my game I would like to try hide the triggers if some conditions are not fulfilled. I created a gameobject with a "Condition Observer", where I added three Lua Commands and one Action Command
So I tried this, but I was getting the 'Invoke function call on non function value.' and I taught that maybe I'm doing something wrong, so I used the Lua Console.

In my Hierarchy I have a game Object called Test and the command I used in the console is

Code: Select all

SetActive(Test, false);
and the result is

Code: Select all

Dialogue System: Lua code 'SetActive(Test, false);' threw exception 'Invoke function call on non function value.'
.
Am I doing something wrong?
User avatar
Tony Li
Posts: 22061
Joined: Thu Jul 18, 2013 1:27 pm

Re: Lua commands

Post by Tony Li »

Hi,

Move SetActive(Test, false) to the Sequence field.

The Dialogue System has two different types of commands: sequencer commands and Lua functions.

SetActive() is a sequencer command. Use it in a Sequence Trigger or the Sequence field of a dialogue entry node, Condition Observer, etc.


There is a reason why the Dialogue System has two different types of commands. If you're curious, this is the reason:
  • Lua commands generally work with the Dialogue System's internal data, such as variables and quest states. Third party editors such as Chat Mapper and articy:draft allow you express logic in Lua. (In articy:draft, the code is in articy:expresso, but the Dialogue System automatically converts it to Lua.) So the Dialogue System needs to support Lua for these purposes.
  • Sequencer commands generally change things in the Unity scene, such as activating GameObjects or playing animations. Since third party editors work outside of Unity, they don't have a concept of changing things in Unity. Text-based sequencer commands let you specify in third party editors (and in the Dialogue Editor window of course) how to change things in the Unity scene.
Post Reply