Int Value from Script checked inside Lua
Posted: Tue Sep 27, 2022 2:37 pm
So I have been wracking my head for an hour and sure its something simple I am just missing.
I have public Int Xp
So far i have got it working correctly to GIVE XP from dialouge and is set up inside custom lua function for ease of use.
public void GiveXP(double amount)
{
Xp += (int)amount;
}
void OnEnable()
{
Lua.RegisterFunction("GiveXP", this, SymbolExtensions.GetMethodInfo(() => GiveXP((double)0)));
Then setting custom lua to
Name: GiveXP
Parameter: Double
Return Value: None
That works great. However, I need to setup method and custom lua function for the XP Ammount (total ammount of xp player has) and then be able to check for conditions like XPAmount greater than, equal to etc. Hoping this can then make real easy way to set up RPG like quests and dialogue. Hope that was clear enough.
I have public Int Xp
So far i have got it working correctly to GIVE XP from dialouge and is set up inside custom lua function for ease of use.
public void GiveXP(double amount)
{
Xp += (int)amount;
}
void OnEnable()
{
Lua.RegisterFunction("GiveXP", this, SymbolExtensions.GetMethodInfo(() => GiveXP((double)0)));
Then setting custom lua to
Name: GiveXP
Parameter: Double
Return Value: None
That works great. However, I need to setup method and custom lua function for the XP Ammount (total ammount of xp player has) and then be able to check for conditions like XPAmount greater than, equal to etc. Hoping this can then make real easy way to set up RPG like quests and dialogue. Hope that was clear enough.