Runzu87 Posted April 1, 2016 Share Posted April 1, 2016 So I'm a new user to modding Skyrim and I only started playing seriously Skyrim this year for the first time! A lot of the custom houses available don't really have all the features I desire (too big, too ornate, no/too small herb garden :( ) so I decided to have a hand at making my own. So far so good. One of the most elusive things I can't seem to find is the script/a script to link a container to a crafting station, namely the Alchemy station. I'm big into growing ingredients and mixing potions. I simply want to see the script for myself and use it for my own personal game. I want something that I can store the ingredients in, access the Alchemy station and the ingredients will pop into my inventory while crafting then return to the container when I'm done. I don't want to add another mod to my game. I'm not after spending a million hours learning scripting and trying to put two and two together. I'd rather spend more time playing the game. I would just like a little help to get the result I'm after. I know a lot here are veterans here and I would appreciate any help with this. I just want a little satchel to put my stuff in and to craft from it. Link to comment Share on other sites More sharing options...
cdcooley Posted April 2, 2016 Share Posted April 2, 2016 As long as you're OK with all of the ingredients you were carrying to be sucked into the container when you're done with the alchemy station it's fairly easy to do what you want. ScriptName CraftingAutoStorageScript extends ObjectReference {Attach this to some crafting station that will be linked to a nearby container.} ObjectReference Property StorageContainer Auto {Fill this with some container near the crafting station.} FormList Property CraftingSuppliesList Auto {Fill this with the list holding the crafting supply items that should be stored in the container.} Event OnInit() BlockActivation() EndEvent Event OnLoad() BlockActivation() EndEvent Event OnActivate(ObjectReference akActionRef) if akActionRef == Game.GetPlayer() Actor PlayerRef = akActionRef as Actor StorageContainer.RemoveAllItems(PlayerRef) Activate(PlayerRef, true) while PlayerRef.GetSitState() != 3 Utility.Wait(0.5) endwhile ; player is using the station at this point while PlayerRef.GetSitState() == 3 Utility.Wait(0.5) endwhile PlayerRef.RemoveItem(CraftingSuppliesList, 50000, true, StorageContainer) else ; let other actors appear to use the station but don't give them the items Activate(akActionRef, true) endif EndEvent Creating an ingredients list is easy, just create a formlist and leave that window open then expand the ingredients section in the Object Window, click on the first ingredient then scroll to the bottom of the list and hold shift while clicking the last one, and then drag the selected ingredients over into the formlist window. There's an SKSE version of this same idea which can transfer every ingredient (even those added by mods without having to manually get them into a formlist) but it transfers the ingredients more slowly. Since you're making the mod for personal use it would be easier to just make sure the formlist has all of the ingredients from the mods you use. Link to comment Share on other sites More sharing options...
Runzu87 Posted April 2, 2016 Author Share Posted April 2, 2016 As long as you're OK with all of the ingredients you were carrying to be sucked into the container when you're done with the alchemy station it's fairly easy to do what you want. -snip- Creating an ingredients list is easy, just create a formlist and leave that window open then expand the ingredients section in the Object Window, click on the first ingredient then scroll to the bottom of the list and hold shift while clicking the last one, and then drag the selected ingredients over into the formlist window. There's an SKSE version of this same idea which can transfer every ingredient (even those added by mods without having to manually get them into a formlist) but it transfers the ingredients more slowly. Since you're making the mod for personal use it would be easier to just make sure the formlist has all of the ingredients from the mods you use. I would be completely fine with that. Thank you so much. I think I can figure out the rest now on my own. Now I can finally make my dream home! :D Link to comment Share on other sites More sharing options...
gedocs1217 Posted December 19, 2016 Share Posted December 19, 2016 (edited) This was really helpful cdcooley, Kudos!Actually if am not necroing much, do you guys know how to link multiple containers to crafting stations? I managed to do so, by adding other object refernces to the script, but items are transfered to one specific container, while the others get empty. Edited December 19, 2016 by gedocs1217 Link to comment Share on other sites More sharing options...
IsharaMeradin Posted December 19, 2016 Share Posted December 19, 2016 Taking ingredients from multiple containers is easy. Returning ingredients to multiple containers is much much harder. I'm not going to say impossible, but the logistics in trying to remember which objects came from which container plus determining how many to put back is a nightmare to keep track of. One method is to have a formlist which lists the items to transfer for workstation usage. Then each container you pull from has its own formlist which tracks what was stored. After workstation usage you transfer back to each container its own formlist. The left over ingredients will sort out in the order you have listed on the script with the most going to the first, etc. Should an item be listed on multiple container formlists, it will sort to the first one and never any of the later ones. Another method should you be dealing with one container per ingredient is to use matching index arrays or formlists where you pull from a whole bunch of containers and return them afterwards. I have a demonstration mod which does just that. http://www.nexusmods.com/skyrim/mods/25890 Link to comment Share on other sites More sharing options...
gedocs1217 Posted December 19, 2016 Share Posted December 19, 2016 Thanks for pointing me out! Thought it would be a more complicated method and I even wanted to live with the sorting's "sidefect". However I'm going to try your source code, and see if I can make it happen. Link to comment Share on other sites More sharing options...
Recommended Posts