Registering Lua Functions + Skill Checks

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
GreenConure
Posts: 26
Joined: Sun Oct 24, 2021 10:32 am

Registering Lua Functions + Skill Checks

Post by GreenConure »

Hello!

Thank you again for your support last time. I'm trying to set up a skill check using the C# and Lua Functions video tutorial.
I followed everything in the video but for some reason I'm getting this compile error.
1.JPG
1.JPG (17.01 KiB) Viewed 462 times
2.JPG
2.JPG (19.04 KiB) Viewed 462 times
I'm also using the Player Skill Check example but the response panel buttons do not show up and I get this in the console. In game it only shows up to the "What should I do?" node.
3.JPG
3.JPG (45.69 KiB) Viewed 460 times
4.JPG
4.JPG (50.23 KiB) Viewed 460 times
Let me know what you think!
Thank you for your time.
User avatar
Tony Li
Posts: 21981
Joined: Thu Jul 18, 2013 1:27 pm

Re: Registering Lua Functions + Skill Checks

Post by Tony Li »

Hi,

What is the code for Honesty? Is it a C# method?

In your second Console window screenshot (the one with multiple lines), what are the details of the first error? Is it reporting a syntax error? If so, try removing the double semicolons on the last line.

What are the details of the second error (the one about not starting a coroutine)? Is it related to a Lua function? If so, and if the Lua function script is on the response menu panel, try moving the script to the Dialogue Manager GameObject or the top-level dialogue UI GameObject, or make the method static and register it like this (with 'null' for the second parameter):

Code: Select all

Lua.RegisterFunction("YourFunc", null, SymbolExtensions.GetMethodInfo(() => YourFunc());
GreenConure
Posts: 26
Joined: Sun Oct 24, 2021 10:32 am

Re: Registering Lua Functions + Skill Checks

Post by GreenConure »

Hello!

Just realized I was using the wrong name for the register lua function, it all works now!

As for the 2nd error, I apologize, I didn't add any other script other than using the PlayerSkills.cs included in the Skills Check example and having it on the player game object and copying the same format of the conversation in the example where there is a skill check node.

This error appears after the "canPersuade = CheckSkill("persuasion", 50); canIntimidate = CheckSkill("intimidation", 50);" script in the dialogue and you can choose to either persuade or intimidate. The demo scene works for me and shows the response buttons, so could it be something to do with my dialogue UI/Manager instead? Other conversations that do not have this CheckSkill script work fine.

EDIT: Checked again and i just realized that any branching dialogue that only has the Player as the actor and no conversant leads to this error? I have the Always Force Response Menu ticked off in my manager. Is there any way that the player can have dialogue with themselves that leads to multiple response menus?

As an example:

Player: What should I do next?
A. Eat
B. Go Outside
C. Sleep

Code: Select all

Coroutine couldn't be started because the the game object 'Response Menu Panel' is inactive!
UnityEngine.MonoBehaviour:StartCoroutine (System.Collections.IEnumerator)
PixelCrushers.DialogueSystem.StandardUIMenuPanel:ShowResponsesNow (PixelCrushers.DialogueSystem.Subtitle,PixelCrushers.DialogueSystem.Response[],UnityEngine.Transform) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/UI/Standard/Dialogue/StandardUIMenuPanel.cs:199)
PixelCrushers.DialogueSystem.StandardUIMenuPanel:ShowResponses (PixelCrushers.DialogueSystem.Subtitle,PixelCrushers.DialogueSystem.Response[],UnityEngine.Transform) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/UI/Standard/Dialogue/StandardUIMenuPanel.cs:174)
PixelCrushers.DialogueSystem.StandardUIResponseMenuControls:ShowResponses (PixelCrushers.DialogueSystem.Subtitle,PixelCrushers.DialogueSystem.Response[],UnityEngine.Transform) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/UI/Standard/Dialogue/StandardUIResponseMenuControls.cs:286)
PixelCrushers.DialogueSystem.AbstractDialogueUI:ShowResponses (PixelCrushers.DialogueSystem.Subtitle,PixelCrushers.DialogueSystem.Response[],single) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/UI/Abstract/Dialogue/AbstractDialogueUI.cs:298)
PixelCrushers.DialogueSystem.StandardDialogueUI:ShowResponses (PixelCrushers.DialogueSystem.Subtitle,PixelCrushers.DialogueSystem.Response[],single) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/UI/Standard/Dialogue/StandardDialogueUI.cs:256)
PixelCrushers.DialogueSystem.ConversationView:StartResponses (PixelCrushers.DialogueSystem.Subtitle,PixelCrushers.DialogueSystem.Response[]) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/View/View/ConversationView.cs:446)
PixelCrushers.DialogueSystem.ConversationController:OnFinishedSubtitle (object,System.EventArgs) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Controller/ConversationController.cs:282)
PixelCrushers.DialogueSystem.ConversationView:FinishSubtitle () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/View/View/ConversationView.cs:418)
PixelCrushers.DialogueSystem.ConversationView:HandleContinueButtonClick () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/View/View/ConversationView.cs:390)
PixelCrushers.DialogueSystem.ConversationView:OnConversationContinue (PixelCrushers.DialogueSystem.IDialogueUI) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/View/View/ConversationView.cs:373)
PixelCrushers.DialogueSystem.AbstractDialogueUI:OnContinueConversation () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/UI/Abstract/Dialogue/AbstractDialogueUI.cs:366)
PixelCrushers.DialogueSystem.AbstractDialogueUI:OnContinue () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/UI/Abstract/Dialogue/AbstractDialogueUI.cs:356)
PixelCrushers.DialogueSystem.StandardUIContinueButtonFastForward:OnFastForward () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/UI/Standard/Effects/StandardUIContinueButtonFastForward.cs:75)
UnityEngine.EventSystems.ExecuteEvents:Execute<UnityEngine.EventSystems.ISubmitHandler> (UnityEngine.GameObject,UnityEngine.EventSystems.BaseEventData,UnityEngine.EventSystems.ExecuteEvents/EventFunction`1<UnityEngine.EventSystems.ISubmitHandler>)
PixelCrushers.UIButtonKeyTrigger/<SimulateButtonClick>d__15:MoveNext () (at Assets/Plugins/Pixel Crushers/Common/Scripts/UI/UIButtonKeyTrigger.cs:93)
UnityEngine.SetupCoroutine:InvokeMoveNext (System.Collections.IEnumerator,intptr)
Here is the error that shows up.

Let me know what you think,
Thank you!
User avatar
Tony Li
Posts: 21981
Joined: Thu Jul 18, 2013 1:27 pm

Re: Registering Lua Functions + Skill Checks

Post by Tony Li »

Hi,

Here's an example scene that plays the conversation you described above:

DS_PlayerSubtitleMenuExample_2021-11-30.unitypackage

I exported it from Unity 2020.3 and Dialogue System 2.2.22. Does it work for you, too?
GreenConure
Posts: 26
Joined: Sun Oct 24, 2021 10:32 am

Re: Registering Lua Functions + Skill Checks

Post by GreenConure »

Hello!

Thank you for this! This works for me. I saw that a NPC actor was a conversant but does not appear in the conversation. How can something like that work? I'm currently using a modified version of the VN dialogue UI. Is it by setting a separate subtitle panel that has the actor name and image disabled?
User avatar
Tony Li
Posts: 21981
Joined: Thu Jul 18, 2013 1:27 pm

Re: Registering Lua Functions + Skill Checks

Post by Tony Li »

Sorry, I don't understand. What are you trying to accomplish?
GreenConure
Posts: 26
Joined: Sun Oct 24, 2021 10:32 am

Re: Registering Lua Functions + Skill Checks

Post by GreenConure »

Hi!

I apologize for the confusion! I just figured out what was causing the response panel error. Deleting the CorgiStandardDialogueControls nestled under my conversation zone+ dialogue trigger prefabs fixed it! For some reason it was trying to grab the response panel from it?

As always, thank you so much for your time!
User avatar
Tony Li
Posts: 21981
Joined: Thu Jul 18, 2013 1:27 pm

Re: Registering Lua Functions + Skill Checks

Post by Tony Li »

Hi,

Glad you got it working! There are a few ways to set up dialogue UIs with Corgi. If you have it the way you want it, great! If you want some other configuration, such as a response menu in a bubble over the player's head, etc., let me know and I'll link you to the right example.
Post Reply