Page 3 of 3
Re: Writing Custom Sequencer for Movement
Posted: Fri Jan 10, 2020 10:01 pm
by Tony Li
Did you add your MyLuaFunctions script to the scene, such as on the Dialogue Manager GameObject?
Re: Writing Custom Sequencer for Movement
Posted: Fri Jan 10, 2020 11:53 pm
by Mackerel_Sky
That's correct. I've verified the script runs on enable as well.
Re: Writing Custom Sequencer for Movement
Posted: Sat Jan 11, 2020 8:46 am
by Tony Li
This line of code tells Lua that the function is named "CheckForItem":
Code: Select all
Lua.RegisterFunction("CheckForItem", this, SymbolExtensions.GetMethodInfo(() => CheckForItem(0,0)));
The Conditions line should look like this:
(CurrentQuestState("Test Quest - Collect") == "active") and (CheckForItem(0, 2) == true)
If it didn't generate that when you used the "..." menu, make sure to use the name "CheckForItem" in your CustomLuaFunctionInfo asset. For testing, you can also just manually fix the name in the Conditions field to be "CheckForItem".
Re: Writing Custom Sequencer for Movement
Posted: Sat Jan 11, 2020 7:56 pm
by Mackerel_Sky
I think I get it now- I thought I had to use the class name in the CustomLuaFunctionInfo asset instead of the function name. Everything works now! Am I also right in assuming I don't need a new script for any new lua functions I might want to add- I just need to add them to the Monobehaviour script and the CustomLuaFunctionInfo asset?
Thanks for your help!
Re: Writing Custom Sequencer for Movement
Posted: Sat Jan 11, 2020 11:55 pm
by Tony Li
Glad to help!
And that's correct, you can add all of your Lua functions to the same script if you want.