SKYRIM
Modders Resource - Auto sorting and auto looting when crafting by Sjogga
Skyrim » Modders resources and tutorials
Added: 27/09/2012 - 02:58PM
Updated: 10/10/2012 - 10:47PM

32 Endorsements

1.1 Latest version

458 Unique D/Ls

675 Total D/Ls

10,335 Total Views

Uploaded by Sjogga

Description

Last updated at 22:47, 10 Oct 2012 Uploaded at 14:58, 27 Sep 2012

What this mod containes:
Within this zip-file, you'll find the scripts used in the Dawnspires auto-sorting and crafting auto-loot system, along with a test file. Bellow you'll find instructions for how to implement it into your mod.

To use this, you agree to:
- Not distribute it to other sites. Translating the tutorial is fine, but no files may be uploaded.
- Give me credit in your description.
- Place links back to this mod-page and my profile.

You are free to modify the scripts in any way you want. If you modify the scripts, I cannot be held responsible for any bugs that might arise.

Note that this mod will not give your house >9000 endorsements. The design is often more important than the features.

First of, things you need to know:

There are two different types of chests:
- Storage chests; these holds your items
- Sorting chests; These only sorts your items and cannot store items

There are three sub-types of Sorting Chests:
- Basic Sorting Chest; every item placed within by the player gets sorted.
- Lever Sorting Chest; same as the basic chest, but with a button attached to it. Pressing the button drags every item stored within the system into the linked chest. Press it again to sort items within.
- Master Sorting Chest; same as the basic chest, but also sorts items not placed by the player. Generally you only want one of these.

IMPORTANT NOTE:
Users have reported that dumping to many items in a container may cause items to go missing. I've dumped hundreds of items at once without losing a single item, but try to not overload it. If you have 3000+ weight, dump some of the items in, wait for it to be sorted and repeat. This also applies to the button feature.

There are several global control variables implemented. This is so that the player can enable/disable the scripted systems if they want to. Disabling is done by the following console-command:
"set to < 1 to enable, 0 to disable >" , without quotes of course.
Example:
"Set _autolootAllowAutoLoot to 1"
Note that there is a space between Set and _autolootAllowAutoLoot.

By default, the sorting categories are:
- Heavy Armor
- Light Armor
- Clothing
- Weapons, including Staffs and bows
- Arrows, including Dawnguard Bolts
- Jewelry
- Gems
- Books
- Scrolls
- Raw Food
- Cooked Food
- Poisons
- Potions
- Ingredients
- Soul Gems
- Keys
- Ore, including dwemer scrap
- Leather, including animal hides and leather stripes
- Ingots
- Gold coins
- Misc items

You do not need to create a unique chest for every category. Merging chests are possible without modifying th script, which I will get to later.


What you need to create:

- 1 to 21 Storage Chest container-entries, depending on how well sorted you want your items to be.
- One container entry for the Sorting Chest (Optional, but required for Crafting auto loot and pullbar functionality)
- One primitive Activator (the Master Activator)
- One button/lever Activator (Optional, but required for the pullbar functionality)
- Three Formlists
- Two Global variables
- One Spell (Optional, but required for Crafting auto loot)
- One Magic Effect (Optional, but required for Crafting auto loot)

The scripts
_sgaAutosortContainer : This script goes on every container, both Storage Chests and Sorting Chests.
_sgaAutosortMaster : This script goes on a the custom primitive activator.
_sgaAutosortLever : Must be attached to a button, pullbar or something else the player can activate.
_sgaCraftingAutoLoot : Attach it to the crafting stations you wish to include in the auto-loot system.
_sgaCraftingSpell : Attached on a Magic Effect

It is recomended that you try the system out before you start, This is done by oopening the console in the main menu and typing "coc AutoSortCell".

First step: Creating containers

To create containers, navigate to WorldObjects->Containers. Duplicate a container of choice, then double click it. In my test cell, I chose the MerchantWCollegeTolfdirChest.
Once the container window is open, type in something easy to reconize in the ID field, such as "autosort" (e.g autosortIngredientsChest). In the name field, type what the chest is meant for (e.g Ingredient Chest). Clear the Item List and make sure the Respawns tick box is unchecked.
In the scripts section, press Add. Select _sgaAutosortContainer.
Press properties. There are three different entries here:
- BypassGlobalCheck : Setting this to TRUE turns this container into a Sorting Chest
- BypassPlayerCheck : Setting this to TRUE turns this container into a Master Sorting Chest if BypassGlobalCheck is also TRUE. You generally only want one of these.
- master : Must be set to the Master Activator. We will return to this later.

Repeat this step until you have entries for:
- 1 Storage Container per sorting category. Again, you do not need to create a unique entry for every category, merging categories are possible.
- 1 Sorting Chest (Optional, but required for Crafting auto loot and pullbar functionality)

Place the containers at desired locations around your house.

Creating Formlists:
Navigate to Miscellaneous->FormList in the ObjectWindow. Right click and select New. A new window will pop up. Drag and drop entries from the ObjectWindow into the Formlist window in order to add them to the list.
You need to create three different lists:
- One list for Ores and Dwarven scraps, i.e things that can be melted.
- One list for Cooked Food. This needs to be handpicked. Easiest way to do this is to go to Magic->Potions and then type "Food" in the filterbox.
- One list of special smithing items such as Dragon Bones and Dragon Scales.

You can find an example of how this looks in the test esp in the image section above.


Creating the Master Activator
Navigate to WorldObjects->Activators. Right click and select new.
In the ID-field, type in AutosortMaster. Press OK. Doubble-click it again. This time, the script section is not grayed out. Press Add and select _sgaAutosortMaster.
Press Properties. There's an example of how this looks in the test file in the image section.
- Assigning ObjectReferences: This can be tricky if you haven't done it before. Open your cell in the render window. Navigate to the chest you want to assign. Go back to the Script properties window, then press the "Select Reference in render window" button. Your cursor is now transformed into a crosshair. Double click your chest and you are done.

Merging chests
You can use the same chest multiple times. For example, you can set the ChestLightArmor and the ChestHeavyArmor to the same chest. In the Dawnspire, I chose to send shields and weapons to the same chest. In the test file, I send gold and jewelry to the same chest.

After you've assigned all the properties correctly, you need to place the activator somewhere in the world. Start of by assuring markers are turned on. In the toolbar, navigate to View. Halfway through the list you'll see "Markers". If it has a checked tickbox next to it, markers are on. Continue by selecting an object in your cell, then press the "Create Trigger"-button that looks like a "T" in a box. You'll find this in the toolbar in the main window.
A new window pops up. Select the AutosortMaster. Whatever object you've selected should be surounded by a red box. Move this box anywhere in your cell. Go back to the Object Window, WorldObjects->Containers. You now need to assign the AutosortMaster to the master-property in all your containers' script. That's it. You now have a working auto sorting system.

Implementing Crafting autoloot
In the Object Window, navigate to Magic->spells->abilities. Right-click and select new. In the ID-field, type in something like _autoLootCraftingSpell.
- Set the type to ability.
- Set casting type to Constant effect.
- Set delivery Type to self. Press OK.

Navigate to Magic->MagicEffects. Right-click and select new. In the ID field, type something like _autoLootCraftingEffect.
- Set archetype to Script.
- Set Casting Type to Constant Effect
- Set Delivery to Self
- Tick the No Area and No Magnitude tickboxes. Press OK.

Double-click you magic effect again. In the script section, press Add. Select _sgaCraftingSpell
- If you haven't already, place a Sorting Chest somewhere in you cell and turn it into a Master Sorting Chest. Instructions above.
- Press Properties to edit the script Properties.
- Set masterChest to your Master Sorting Chest.
- Set isCraftingSPell to _autoLootCraftingSpell. Press OK

Go back to your spell. In the effects field, right-click and select New. Select _autoLootCraftingEffect from the list. Press OK

Now you need to locally add the _sgaCraftingAutoLoot-script to all the crafting stations you want to link to the auto-loot system. Double-click your crafting bench in the render window. Find the Scripts tab. Add a new script and select _sgaCraftingAutoLoot. Right-click it and select Edit Properties.
- Fill the Containers-array with all chests you want to loot when activating the bench. Note that the auto loot will not re-sort Weapons, Armor, Books and Scrolls.
- Create a new Global Variable like we did before with the initial value 1. Set the AllowAutoLoot-property to this Global.
- Set the _sga_isCraftingSpell to the _autoLootCraftingSpell.

Repeat this for every crafting station you want to link to the system. It is not recommended that you edit the vanilla crafting stations as this might create mod conflicts. You can however create your own, custom crafting stations and add the script to the base entry.

Creating a Sorting Chest with a pullbar
In the Object Window, navigate to WorldObjects->Activators. There are two activators I suggest you choose between; GenPullbar01 and ImpButton01. Whichever you choose, right-click and select Duplicate. Doubleclick your new button/pullbar.
- In the ID-field, type in something like _autoSortButton / _autoSortPullbar.
- In the name field, type in something like "Auto Sort Pullbar/button". Press OK, the double-click the activator again.

Add the _sgaAutosortLever-script to your activator. Select edit properties like we did before.
- Set master to the AutosortMaster-activator.
- If you haven't already, place a Sorting Chest somewhere in you cell and turn it into a Master Sorting Chest. Instructions above.
- Set the mainChest to a Master Sorting Chest. Press OK.

Place your button/pullbar somewhere in your cell. Next to it, place a Sorting Chest. This must not be a Master Sorting Chest. Double-click your button/pullbar. In the Rinked Ref, right-click and select new. Pick the nearby sorting chest from the render window.

That's it. You now have a working Lever-chest. Remember that the button/pullbar doesn't resort items automatically. Using the button once drags in items, using it again sorts items. It is easy to forget the second activation, so I recommend you keep the Lever Sorting Chest-count low.

============================================

End of tutorial.

============================================

Got questions? Place them in the comments.

============================================

Why am I releasing this?
The auto-sorting and auto-loot makes crafting and storing very easy. However, my warrior cannot live in a mage tower nor can my archer. I hope that other mod-authors find this useful and are willing to implement it and share their creations.