Jump to content

"Store all Junk" Container


warsinger

Recommended Posts

I cannot for the life of me figure out what exactly enables the "Store All Junk" option when the player opens a settlement workbench. Theoretically it simply opens a container inventory; I've used a script to open a settlement workbench inventory but the option is absent. What exactly causes this option to pop up? Can it be added to a different container?

 

EDIT: Also, can this be somehow modified to affect different item categories like weapons or aid items?

Edited by warsinger
Link to comment
Share on other sites

Try this:

1) Open the ck and make a copy of the settlement workbench

2)Rename it and if you want change the model with a vanilla or a custom model

3)In the page of the new item there are also the script of that item, simple "put out" the settlement script

 

This are the basics, if there is something that its not clear, simple ask

Link to comment
Share on other sites

  • 3 years later...

I know this post is long dead and buried, but I'm working on some custom containers and would love for them to have a store all option, so did anyone figure out how to enable a store all function?

I understand that a list of the items and a script to pull those items from the player is necessary, but I can't quite figure out how to enable an additional function like store all when transferring with a container. Can anyone help shed some light on this for me?

Link to comment
Share on other sites

I made a pseudo-copy of the function a few years ago for this mod: https://www.nexusmods.com/fallout4/mods/28945
It was a pain. Here's the Papyrus bit:

 

Function StoreJunk()
	ObjectReference storage = StorageContainer.GetReference()
	if (storage != None)
		ObjectReference tempContainer = storage.PlaceAtMe(ILS_TempContainer, 1, false, false, true)
		int iterations = Math.Ceiling(PlayerRef.GetItemCount(ILS_ComponentList) / 65535)
		int i = 0 
		while (i < iterations)
			PlayerRef.RemoveItem(ILS_ComponentList, 65535, true, tempContainer)
			i += 1
		endwhile
		tempContainer.RemoveItem(ILS_QuestItemBlacklist, -1, true, PlayerRef)
		i = 0
		while (i < iterations)
			tempContainer.RemoveItem(ILS_ComponentList, 65535, true, storage)
			i += 1
		endwhile
		tempContainer.Delete()
	endif
EndFunction

 

Annoyingly, there are a number of quest items registered with components, and there isn't any way to differentiate quest items (i.e. things that couldn't normally be removed from your inventory) from any other scrap, so the best I could come up with was to manually maintain a FormList of those and just transfer them back to the player if they get taken.

I never managed to get the "real" button to work. I believe the way it works is that activating a container directly from the "special" TRANSFER UI button—provided by containers with WorkshopKeyword (defined by the Workshop Default Object in the CK), or a workbech/crafting station linked to one such container via WorkshopItemKeyword (defined by the WorkshopItem DFOB etc)—sets some state that watches for the extra button press event or whatever, and somehow links the UI button up to that; and also passes some extra data into the ContainerMenu Scaleform object that sets uiMode to 6 (CM_WORKBENCH), which enables the "native" button in the UI: https://i.imgur.com/7jlly14.png
And you can change this so it will show up in other containers, but that only changes the UI. it doesn't actually make the button work. https://i.imgur.com/f6tR5qS.jpg

I think the only way you could get this to work is by being really good at reverse engineering, and then use that to create an F4SE plugin that allows you to open containers in "workbench" mode. I don't think it's possible to "trick" it to work with other containers without completely breaking the workshop system (changing the Default Object).

Link to comment
Share on other sites

First off, thank you so much for your reply. It's very helpful.

 

So it seems like I'd need to create a separate UI, similar to the CM_WORKBENCH UI, then set up corresponding keywords, buttons and item lists, just adjusting them for whatever items I want. Does that sound correct to you? Might not be too difficult to create a copy of everything for the working workbench and alter what's necessary to change it from junk to something else, then applying it to my own static. I'l have to play with it, but just knowing where to start now really helps a lot.

 

I may try your work around as I don't really have experience with UI. Or at least if I can't figure it out by mucking about with copies of the existing workshop/workbench assets. Thanks again man.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...