Calling script to set a variable

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
timbecile
Posts: 110
Joined: Mon Mar 12, 2018 11:00 pm

Calling script to set a variable

Post by timbecile »

Hey Tony! on to another problem...

I'm trying to use a script to set a value called "HealingCost", but it doesn't seem to be working.

The LUA Script code:

Code: Select all

Variable["HealingCost"] = GetHealingCost()
and the script code:

Code: Select all

    private void OnEnable()
    {

        Lua.RegisterFunction("GetHealingCost", this, GetType().GetMethod("GetHealingCost"));

    }

    private void OnDisable()
    {
        Lua.UnregisterFunction("GetHealingCost");
    }

   double GetHealingCost()
    {
        Debug.Log("geting healing cost");
        double healingCost = 101;
        return healingCost;
    }
It appears to be doing something because it's setting the HealingCost var to 'nil' when I reach the dialog
timbecile
Posts: 110
Joined: Mon Mar 12, 2018 11:00 pm

Re: Calling script to set a variable

Post by timbecile »

duh. Nevermind.

My problem was that the function wasn't public.
Post Reply