Use c# registered functions in quest descriptions
Posted: Tue Aug 09, 2022 7:24 pm
Hi,
I used the following to be able to use a C# function in the conditions and scripts part of the dialogue system
Which works perfectly fine, now I was wondering if and how I can use that function to display the value in my quest descriptions?
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
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