If I want to set as a condition the bool from a script outside the Dialogue System, how should I proceed?
I have a public bool IsItemInInventory(string searchedObject) in Inventory.cs, which uses the RPG.Core namespace.
Now I want to only display conversation option 2 if this bool returns true for IsItemInInventory("FireEssence"), i.e. I need the true value of this bool to be a condition.
Getting bool from other script
Re: Getting bool from other script
1. Register IsItemInInventory with Lua.
2. Set conversation option 2's Conditions field to:
Example
Code: Select all
using PixelCrushers.DialogueSystem;
...
void OnEnable() {
Lua.RegisterFunction("IsItemInInventory", this, SymbolExtensions.GetMethodInfo(() => IsItemInInventory(string.Empty)));
}
void OnDisable() {
Lua.UnregisterFunction("IsItemInInventory");
}
Code: Select all
IsItemInInventory("FireEssence") == true
-
- Posts: 30
- Joined: Sat Jan 19, 2019 2:14 pm
Re: Getting bool from other script
Fantastic! That works.