Page 1 of 1

Error when barking from Lua

Posted: Mon May 29, 2017 12:17 pm
by chud575
Howdy,

When I call a bark from Lua, it works, but I also get an error message:

Code: Select all

MissingMethodException: The best match for method OnBarkLine has some invalid parameter.
System.MonoType.InvokeMember (System.String name, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object target, System.Object[] args, System.Reflection.ParameterModifier[] modifiers, System.Globalization.CultureInfo culture, System.String[] namedParameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/MonoType.cs:520)
UnityEngine.SetupCoroutine.InvokeMember (System.Object behaviour, System.String name, System.Object variable) (at C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:31)
UnityEngine.Component:BroadcastMessage(String, Object, SendMessageOptions)
PixelCrushers.DialogueSystem.BarkController:InformParticipantsLine(String, Transform, Subtitle)
PixelCrushers.DialogueSystem.<Bark>c__Iterator7:MoveNext()
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
PixelCrushers.DialogueSystem.DialogueSystemController:BarkString(String, Transform, Transform, String)
PixelCrushers.DialogueSystem.DialogueManager:BarkString(String, Transform, Transform, String)
<BarkNonActor2>c__Iterator0:MoveNext() (at Assets/_Freeport/Scripts/Gameplay/Other/Custom Dialogue Manager Scripts/CustomLuaFunctions.cs:56)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
and here's the Lua Code:

Code: Select all

 public void BarkNonActor(string barkText, string barker, double delay)
    {
        if ((int)delay == -1)
        {
            Transform subject = GameObject.Find(barker).GetComponent<Transform>(); //PixelCrushers.DialogueSystem.SequencerCommands.SequencerCommand.GetSubject(barker);
            print("Bark? " + barkText);// + ", " + subject);
            DialogueManager.BarkString(barkText, subject);
        }
        else
        {
            StartCoroutine(BarkNonActor2(barkText, barker, delay));
        }
    }

    IEnumerator BarkNonActor2(string barkText, string barker, double delay)
    {
        yield return new WaitForSeconds((float)delay);
        Transform subject = GameObject.Find(barker).GetComponent<Transform>(); //PixelCrushers.DialogueSystem.SequencerCommands.SequencerCommand.GetSubject(barker);
        print("Bark2? " + barkText);// + ", " + subject);
        DialogueManager.BarkString(barkText, subject);
    }

Re: Error when barking from Lua

Posted: Mon May 29, 2017 4:16 pm
by Tony Li
That'll be fixed in version 1.7.1 this week. The "OnBarkLine" message that's sent to the Dialogue Manager incorrectly passes the speaker's transform, not the subtitle. It will be corrected to work line the "OnBarkLine" message that's sent to the speaker, which passes the subtitle.

Re: Error when barking from Lua

Posted: Tue May 30, 2017 10:50 am
by chud575
look at you - being a step ahead of me and stuff :p

Re: Error when barking from Lua

Posted: Tue May 30, 2017 11:52 am
by Tony Li
It just means some other poor soul ran into the same issue first. ;)