Removing Negative-Count Items from Inventories

Post » Fri Oct 10, 2014 7:19 am

This discussion started in another thread about rebalancing merchant inventories, where http://www.gamesas.com/topic/1495317-whats-the-deal-with-mages/?p=23787615 that altering negative-count items in an existing NPC's inventory (such as giving them a positive-count or removing them) causes crashes when the player adds that mod to a merged objects list.

So, the idea that alterations like that could be scripted came up, and it made me realize I've never found any info about using RemoveItem on objects with negative counts. Is it even possible? Or does it cause crashes as well?

Edit: For my first test, I made an activator with a script that was set to remove a negative-count item from Arrille's inventory. Since I assume those show up as positive counts in-game, I simply did this:

TEST #1

If ( arrille->GetItemCount ingred_corkbulb_root_01 > 0 )arrille->RemoveItem ingred_corkbulb_root_01 1Endif

And it did remove all the corkbulb, but now I need to figure out if it'll work under a doOnce condition, because this is a terrible script that only makes sure Arrille will never carry corkbulb again, so you can't sell it to him.

TEST #2

This script actually works!

Short doOnce If ( doOnce == 0 )arrille->RemoveItem ingred_corkbulb_root_01 5Set doOnce to 1Endif

Proving you can completely remove negative-count items without having to spam RemoveItem. It removes it like it's a regular item, and does it...for good? For my next test, I have to figure out how the 72-hour cleanup affects this.

TEST #3

After visiting Arrille and checking his inventory, without purchasing anything, I slept until Day 5 and then quit and reloaded the game just to make doubly-sure the 72-hour cleanup took effect. After visiting Arrille again, he still had no corkbulb. Same result if you alter his inventory by buying something.

TEST #4

I used AddItem to give him 5 corkbulb after removing 5 corkbulb. They now no longer respawn.

User avatar
Adam
 
Posts: 3446
Joined: Sat Jun 02, 2007 2:56 pm

Return to III - Morrowind