Choose Your Language

Saturday 30 August 2008

Inventory Item Quantity Fix

I was over at the Seahaven Blog where Merecraft had started the ball rolling (after a tip from Amraphael) to fix the limit of items placed within an inventory. I posted a new script to his blog and repeat it below (because there was a slight bug in his) and I also updated the script so that it would give feedback of the items to quantity limit in the Container GUI. It meant updating the container.xml slightly more as well, and as I could not post it in a comment to him, I will try to post it here instead (as an image). NB: The quantity figure does not show until after the PC has interacted with the inventory in some way. One could script it to show the figure OnUsed, but I am not sure if the extra coding is necessary.

Note, this alters an official XML file, and so it should be placed in a hak to be used with a specific module only. It only fixes the issue for modders and their scripted modules and does not fix modules that have not used the scripting initially.

First, here is the script that goes on the container's OnInventory Disturbed:

(CLICK ON IMAGE TO ENLARGE VIEW TO READ)

Note: I have not altered the original code that determines how many slots the object has, which is currently set as a variable on the object. This can, of course, be made more accessible by tying the quantity figure to one of the less used (but more accessible variables from properties) such as Reflex Save or Will Save. (I have tested the Will Save property and this works fine.)

And then here are the XML alterations to the Container.xml file:

(CLICK ON IMAGE TO ENLARGE VIEW TO READ - UPDATED 22/04/09)

I have highlighted the additions in yellow. NB: There is also a commented line in the XML code above the last yellow line to ensure it is not used instead. (Marked with an exclamation mark.)

My thanks go to Merecraft & Amraphael for the inspiration.

5 comments:

Merecraft said...

Great blog Lance! I've added you to my list of blogs to keep track of. Thanks for the help with the inventory script too - works like a charm :)

Merecraft said...

Thanks for the help Lance! Your fix works great :)

I've added your blog to my blog list too - I've got some catching up to do!

Lance Botelle (Bard of Althéa) said...

Hi Merecraft,

Glad my scripts could help. :)

I hope you enjoy the blog. I will be keeping up with yours as well. :)

Lance.

Anonymous said...

Hey Lance! Your podcast will be out in about 2 hours! Thanks for being on the show!

Lance Botelle (Bard of Althéa) said...

Hi Ashercon,

Thanks for having me on the show. :)

I hope it is interesting for the listeners.

Lance.