Hello, I need a little help. I want to make a modification to the assembly-csharp.dll to create a mod for myself and my friends that allows us to modify the quantity of certain items in the toolbar. I've tried many methods, such as creating a new class. Then I analyzed the Inventory class and noticed something interesting: the SetItem method. I saw that they use this.slots[_idx].itemStack.count = _count to modify the number. However, when I try to make modifications in my class like this:
public void SetGameManagerAndEntity(IGameManager gameManager, EntityAlive entity)
{
this.gameManager = gameManager;
this.entity = entity;
this.inventory = new Inventory(gameManager, entity);
}
...
Console.WriteLine("Item with index {0} ", _idx, inventory.slots[_idx].itemStack.count);
I get a System.NullReferenceException: Object reference not set to an instance of an object for inventory.slots[_idx].itemStack.count. I've also tried public Inventory inventory;, but I still can't succeed. Can anyone help me?
public void SetGameManagerAndEntity(IGameManager gameManager, EntityAlive entity)
{
this.gameManager = gameManager;
this.entity = entity;
this.inventory = new Inventory(gameManager, entity);
}
...
Console.WriteLine("Item with index {0} ", _idx, inventory.slots[_idx].itemStack.count);
I get a System.NullReferenceException: Object reference not set to an instance of an object for inventory.slots[_idx].itemStack.count. I've also tried public Inventory inventory;, but I still can't succeed. Can anyone help me?
Last edited by a moderator: