Nick403 Posted July 3, 2023 Share Posted July 3, 2023 (edited) 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? Edited July 3, 2023 by Nick403 (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now