I used the following to be able to use a C# function in the conditions and scripts part of the dialogue system
Code: Select all
void OnEnable()
{
Lua.RegisterFunction("ItemInInventory", this, SymbolExtensions.GetMethodInfo(() => ItemInInventory(string.Empty)));
}
void OnDisable()
{
Lua.UnregisterFunction("ItemInInventory");
}
public double ItemInInventory(string itemName)
{
return (double)inventoryController.GetAmountOfItem(itemName);
}
Like:
Items collected:
Cheese (ItemInInventory("Cheese") / 1)
I could've sworn that I read somewhere that this is possible but I can't find it anymore or get it to work.
Any help would be appreciated!
- Kimosabe