Calling script to set a variable
Posted: Sat Mar 17, 2018 5:06 pm
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:
and the script code:
It appears to be doing something because it's setting the HealingCost var to 'nil' when I reach the dialog
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()
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;
}