Page 1 of 1

Lua commands

Posted: Thu Dec 14, 2017 4:18 am
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?

Re: Lua commands

Posted: Thu Dec 14, 2017 9:47 am
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.