Writing Custom Sequencer for Movement
Re: Writing Custom Sequencer for Movement
Did you add your MyLuaFunctions script to the scene, such as on the Dialogue Manager GameObject?
-
- Posts: 111
- Joined: Mon Apr 08, 2019 8:01 am
Re: Writing Custom Sequencer for Movement
That's correct. I've verified the script runs on enable as well.
Re: Writing Custom Sequencer for Movement
This line of code tells Lua that the function is named "CheckForItem":
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".
Code: Select all
Lua.RegisterFunction("CheckForItem", this, SymbolExtensions.GetMethodInfo(() => CheckForItem(0,0)));
(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".
-
- Posts: 111
- Joined: Mon Apr 08, 2019 8:01 am
Re: Writing Custom Sequencer for Movement
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!
Thanks for your help!
Re: Writing Custom Sequencer for Movement
Glad to help!
And that's correct, you can add all of your Lua functions to the same script if you want.
And that's correct, you can add all of your Lua functions to the same script if you want.