Jump to content

Trying to make a way to modify the inventory in assembly-csharp.dll.


Recommended Posts

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 by Nick403 (see edit history)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...