Automatic sorting of items.

Post » Thu Jun 21, 2012 10:20 am

I would like to attempt to create a wonderful room or four, where at a touch of a button my inventory items gets sorted out in to containers automatically. (Basic version)

I would really like to be able to have books placed on specific shelves once the traveller/adventurer/dragon born finds them and puts them in to the U-Store vault complex. (advanced).

There are lots of house mods out there and the ones I've seen are awesome, but (not much of a but) they tend to be on the roaming side and can take as much time going as if you're trawling a dungeon, I want to keep it simple, organised and if possibly pretty, otherwise, just well lit and basic. think of it as the big yellow box storage container concept but with magic containers hauling fairies.

I've taken a look at the Bag of Holding mod, which is very nice sadly I'm unsure where to start. Should I start with being able to sort one group of items in to a barrel first and go from there? ending with a one button press to do it all for me (like the ingredient sorter from oblivion).
User avatar
Lily Something
 
Posts: 3327
Joined: Thu Jun 15, 2006 12:21 pm

Post » Thu Jun 21, 2012 10:29 am

I don't have the Bag of Holding mod but I'm sure that what you need is all in there. Of course, it probably also has a lot more features than what you're asking for and probably very confusing with all the code for menus and stuff. These are two very basic scripts that should help you get started on figuring out how to do what you want:

Button script:
Spoiler
Scriptname ButtonScript extends ObjectReferenceEvent OnActivate(ObjectReference akActionRef)	if (akActionRef == Game.GetPlayer())		(akActionRef as Actor).RemoveAllItems(GetLinkedRef())	;the linked ref should be a container	endifEndEvent

Container script:
Spoiler
Scriptname ContainerScript extends ObjectReferenceObjectReference Property WeaponContainer AutoObjectReference Property ArmorContainer AutoObjectReference Property IngredientsContainer AutoObjectReference Property FoodContainer AutoObjectReference Property PotionsContainer AutoObjectReference Property BooksContainer AutoObjectReference Property MiscContainer AutoKeyword Property VendorItemFood AutoKeyword Property VendorItemFoodRaw AutoEvent OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)	if (akBaseItem as Weapon) || (akBaseItem as Ammo)		RemoveItem(akBaseItem, aiItemCount, True, WeaponContainer)	elseif (akBaseItem as Armor)		RemoveItem(akBaseItem, aiItemCount, True, ArmorContainer)	elseif (akBaseItem as Ingredient)		RemoveItem(akBaseItem, aiItemCount, True, IngredientsContainer)	elseif (akBaseItem as Potion)		if (akBaseItem.HasKeyword(VendorItemFood) || akBaseItem.HasKeyword(VendorItemFoodRaw))			RemoveItem(akBaseItem, aiItemCount, True, FoodContainer)		else			RemoveItem(akBaseItem, aiItemCount, True, PotionsContainer)		endif	elseif (akBaseItem as Book)		RemoveItem(akBaseItem, aiItemCount, True, BooksContainer)	else		RemoveItem(akBaseItem, aiItemCount, True, MiscContainer)	endifEndEvent
User avatar
KRistina Karlsson
 
Posts: 3383
Joined: Tue Jun 20, 2006 9:22 pm

Post » Thu Jun 21, 2012 8:52 am

Excellent thank you.

Just to clarify then - The button script will put everything currently in the players inventory in to the container pointed to inside the brackets on the;

(akActionRef as Actor).RemoveAllItems(GetLinkedRef(xxxx))

Where I've put the xxx's inside the brackets in fact.

How (why?) does the two work together? If I click on the container I'll see the contents, but if I click on the button it will automatically move the inventory in to the container.

I've always wondered why Beth likes duality in code.
User avatar
Eduardo Rosas
 
Posts: 3381
Joined: Thu Oct 18, 2007 3:15 pm


Return to V - Skyrim