Forum rules - please read before posting.

runtimeinventory.add overwriting inventory count?

Hi

I have this code on a custom script which runs when a player picks up an item;

                if (debugIsAwesome) { OllyTools.logWarning("Item added " + inventoryItemName); }
                KickStarter.runtimeInventory.Add(KickStarter.inventoryManager.GetItem(inventoryItemName).id,1);

However, no matter how many items the player picks up (and how many times the script runs, there's only ever 1 instance of that item in the player inventory. The inventory item is set to allow multiples.

I can't share Imgur images as imgur is now blocked in the UK, but here's a link to an image that shows the above debug line being printed three times, the breakpoint also hits the inventory line three times, but the player inventory only shows one item.

https://drive.google.com/file/d/1BG9JOX7k49bGvUNguOmzmZo_nmZnIwZX/view?usp=sharing

Is there a correct way to do this? Do I need to see whether the item is already in the inventory, then +1 to the current count? Seems long winded.

Olly

Comments

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.