Writing Custom Sequencer for Movement

Announcements, support questions, and discussion for the Dialogue System.
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Writing Custom Sequencer for Movement

Post by Tony Li »

Did you add your MyLuaFunctions script to the scene, such as on the Dialogue Manager GameObject?
Mackerel_Sky
Posts: 111
Joined: Mon Apr 08, 2019 8:01 am

Re: Writing Custom Sequencer for Movement

Post by Mackerel_Sky »

That's correct. I've verified the script runs on enable as well.
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Writing Custom Sequencer for Movement

Post 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".
Mackerel_Sky
Posts: 111
Joined: Mon Apr 08, 2019 8:01 am

Re: Writing Custom Sequencer for Movement

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

Re: Writing Custom Sequencer for Movement

Post 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.
Post Reply