Hello! I just recently started using the dialogue manager, so I'm still doing stupid things...
So! I'm trying to register items through Lua that I put in my own inventory. I followed the tutorialhttps://www.youtube.com/watch?v=55I0psnQp7Q, but for some reason it doesn't work
I will be glad to receive your help!
That all looks correct so far. If you set the Dialogue Manager GameObject's Other Settings > Debug Level to Info and reproduce the issue, does the Console have a line similar to the one below?
If it's Block On False Link, this means the Conditions are false. They could be false because the FindCard quest isn't active, or because ItemPicked("poop") doesn't return true.
If you see a red error that ItemPicked() is not a registered Lua function, then what GameObject is the InventoryManager script on?
public class InventoryManager : MonoBehaviour
{
public GameObject InventoryMenu;
private bool menuActivated;
public ItemSlot[] itemSlot;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if (Input.GetButtonDown("Inventory") && menuActivated)
{
Time.timeScale = 1;
InventoryMenu.SetActive(false);
menuActivated = false;
}
else if (Input.GetButtonDown("Inventory") && !menuActivated)
{
Time.timeScale = 0;
InventoryMenu.SetActive(true);
menuActivated = true;
}
}
public void AddItem(string itemName, int quantity, Sprite itemSprite, string itemDescription)
{
for (int i = 0; i < itemSlot.Length; i++)
{
if (itemSlot[i].isFull == false)
{
itemSlot[i].AddItem(itemName, quantity, itemSprite, itemDescription);
return;
}
}
}
public void DeselectAllSlots()
{
for (int i = 0; i < itemSlot.Length; i++)
{
itemSlot[i].selectedShader.SetActive(false) ;
itemSlot[i].thisItemSelected = false ;
}
}
}
If your InventoryManager is in the Dialogue Manager GameObject's hierarchy, register your ItemPicked() method with Lua in an Awake() method instead of OnEnable(), and remove the OnDisable() method.