Jump to content
ℹ️ Intermittent Download History issues ×

Linked Containers (repost)


Recommended Posts

Hi.



First off, deepest apologise if this is already answered, but google and this forums search have not proved fruitful so far.



I also posted this here as I realise that my original post was put in the wrong place... arghpfar and sorry!!!!



This is probably incredibly noob'ish and simple, but could anyone answer the following...?



I am trying to make a container system for my player home which works like this; in one small room of its own (in its own cell) there are a series of containers. I would like each of these to be linked to a corresponding container in another cell. So you could pop home, dump a load of stuff into separate containers (weapons, armour, food, etc.) then head out, and later come back and sort through them in the areas you'd be storing the stuff (Food -> Kitchen, Weapons/Armour -> Armoury...) The home has three cells in total.



I believe the theory should be to have separate 'master' containers (I placed a number of containers outside the walls of the small room), then place a corresponding 'activator' which has a container mesh applied to it in each of the locations you want to be able to access this 'master' container, link the corresponding containers together and use a script to open the 'master' inventory when you activate a container/activator.



However I am clearly failing with the script I found lurking on the web (multiple variants attempted) and possibly the fact that I am not entirely sure how I even set an object as persistent (the 'master' container) in order for it to remain in memory when I move to another cell.



If anyone could give me a walk through of what I should be doing, with the correct script syntax (of which I am utterly hopeless, despite my best efforts to learn it, I blame it on my advanced years...) I would be utterly utterly grateful, and would be able to hopefully upload my player home, which I think is actually really rather good and extremely detailed.



Thanks for your time with this, I really really have tried to find an answer out there and have tried to troubleshoot this myself, but its obviously failing somewhere and as I'm not sure of how to even do it I can't tell whats wrong! Cheers!!


Link to comment
Share on other sites

Totally not my area of expertise, I do nothing with playerhomes or worldspace edits, but afaik "script persistence" is gained thru having a script active that holds the object in question in persistent memory, usually with a script property, although variables can work, too, or by an alias attached to your container. If your MasterBoxes have unique aliases, they already have persistence. If not, add them. You're basically duplicating how the workshop container works, check out it's scripts for more help. Suggest adding container filters so you CAN'T put Food in your Weapons box, that's help a LOT with sorting stuff, checkout dlc05WeaponRackScript for an example of the filter setup, they ONLY accept weapons. And don't forget that it ain't exactly stealing to use someone else's methods in YOUR work, >50% of scripting is copy/Paste. If worried, give plentiful credit to whomever you got the method from (or just ask in a PM, most modders are super-easygoing and love helping each other out) and you should be gtg.

Link to comment
Share on other sites

I'm not sure I fully understand what it is you're trying to accomplish, so forgive me if this doesn't address your goal.

 

But it sounds as if you want some sort of "cloud based" storage system. I've been able to accomplish something along those lines by linking workbenches in my player homes to a regular, standard container object that acts as a âmasterâ. This is done without doing any scripting, just keywords. And no settlement workshop workbench is involved. The workbenches are linked to the âmasterâ container using WorkshopItemKeywork and WorkshopLinkContainer. Each linked object then has a shared inventory. If you aren't linking workbenches, then WorkshopItemKeyword may not be necessary. I've done this across cells (interior and exterior) and works well. Not sure if it's what youâre after, but maybe it will help.

 

To echo what JesterDoobie said about looking at what others have done to figure this stuff out, there is a mod out there that may do something similar to what it sounds like you want, at least in part. It's called Quantum Box, or something along those lines. You might be able to glean some info from examining how that was put together. I any event, hope some of this helps.

Link to comment
Share on other sites

Totally not my area of expertise, I do nothing with playerhomes or worldspace edits, but afaik "script persistence" is gained thru having a script active that holds the object in question in persistent memory, usually with a script property, although variables can work, too, or by an alias attached to your container. If your MasterBoxes have unique aliases, they already have persistence. If not, add them. You're basically duplicating how the workshop container works, check out it's scripts for more help. Suggest adding container filters so you CAN'T put Food in your Weapons box, that's help a LOT with sorting stuff, checkout dlc05WeaponRackScript for an example of the filter setup, they ONLY accept weapons. And don't forget that it ain't exactly stealing to use someone else's methods in YOUR work, >50% of scripting is copy/Paste. If worried, give plentiful credit to whomever you got the method from (or just ask in a PM, most modders are super-easygoing and love helping each other out) and you should be gtg.

 

I'm not sure I fully understand what it is you're trying to accomplish, so forgive me if this doesn't address your goal.

 

But it sounds as if you want some sort of "cloud based" storage system. I've been able to accomplish something along those lines by linking workbenches in my player homes to a regular, standard container object that acts as a âmasterâ. This is done without doing any scripting, just keywords. And no settlement workshop workbench is involved. The workbenches are linked to the âmasterâ container using WorkshopItemKeywork and WorkshopLinkContainer. Each linked object then has a shared inventory. If you aren't linking workbenches, then WorkshopItemKeyword may not be necessary. I've done this across cells (interior and exterior) and works well. Not sure if it's what youâre after, but maybe it will help.

 

To echo what JesterDoobie said about looking at what others have done to figure this stuff out, there is a mod out there that may do something similar to what it sounds like you want, at least in part. It's called Quantum Box, or something along those lines. You might be able to glean some info from examining how that was put together. I any event, hope some of this helps.

 

Thanks for the reply's!

 

That's an excellent idea for the filters, I'll certainly add that into them once I've got the basic functionality working. And since you both thought incredibly logically to try and engineer through the work bench scripts I'll definitely give that a shot! And yeah RedRocketTV you pretty much got the idea spot on! It's encouraging to know you've had success with a very similar sounding concept, so I'll give your implementation a shot, thanks for the Quantum Box suggestion, again I'll see if I can glean anything from that. I suppose a lot of my own limitation comes from my very basic understanding of scripting, but hey, hopefully I'll learn something along the way!

 

I'll report back with my findings in case it is of use to others in the future.

 

Thanks again for the help!

Edited by NorthernNick
Link to comment
Share on other sites

No trouble. Glad to be of help. Again to echo what JesterDoobie said, the inventory filters are a good idea, but are also pretty much required if you're using Event OnItemAdded...which you undoubtedly will to pull this off. You need to add an OnActivate event, then define an AddInventoryEventFilter for the items you want to tell the script what items you want it to pay attention to...otherwise it just ignores them. Took me a night of cursing to discover that.

 

I've been able to get a sorting system set up in my "learning testbed" player home using AddInventoryEventFilter referencing Form Lists for each category I want sorted, with the actual items defined in the Form List. Then I have another form list for anything I don't want want the "master sorting" container to accept and it kicks it back to the player. Of course, after sorting components, junk, food and drink, chems, ammo, weapons, armor and clothing there isn't much in the game left to reject.

 

Just wanted to mention that you'll likely need to use the AddInventoryEventFilter to get this working if you're using Event OnItemAdded. Good luck!

Link to comment
Share on other sites

Hey Folks,

 

Thanks for the suggestions, still completely stumped however.

 

Tried going through the workbench/workshop scripts but couldn't find anything that might suggest how to create these linked containers.

 

Here's what I've tried, and this is just to get the containers linked, not even to implement some sort of sorting process yet...but it just doesn't even compile, and like I said, I am utterly useless with scripting...

Scriptname MyModLinkConts extends ObjectReference

Function OnActivate(ObjectReference akActionRef)
	If (akActionRef == Game.GetPlayer() as ObjectReference)
		linkedRef = getLinkedRef()
        linkedRef.OpenInventory(True)
	EndIf
EndFunction

So this script I applied to the activator I've setup to look like an institute container, and is linked to an actual container.

 

Totally lost, any suggestions? Was wondering if I'd be better to try and set-up an NPC with the 'Ghost' , 'Invulnerable' options etc. instead of the container I actually want the stuff held in.

 

I also tried looking at a mod called Quantum Box as it seamed to require something of the same functionality to but look.

 

Anyone able to please help? Would really love to get this working.

 

Then I've only got a few other things I need to try and work trhough which I'm trying now, but this linked container thing is kind of a stumbling block to everything really.

 

Thanks!

Edited by NorthernNick
Link to comment
Share on other sites

There is a default script for linking an activator with a chest called: DefaultActivateLinkedRefOnActivate. I used it to link multiple activators spread around the map to the same container so they all act as that one base container. (doesn't share the quick loot menu)
To use this script you make an activator for example using the model from the conatiner you want and add the script to it then you link your container to the activator.

For the sorting you should definitely be using formlists like RedRockeTV suggested. Here is an example of how I would try to do this( haven't been able to test this but it should work).
Place this script on your master container:

FormList Property ItemsToSort Auto    ; formlist of all the items you want to sort
FormList Property food Auto    ;formlist of all items that need to be sorted to the foodcontainer
FormList Property Armors Auto    ;Formlist of all the items that need to be stored in the ArmorContainer
ObjectReference Property FoodContainer Auto        ;container to store all the food items in
ObjectReference Property ArmorContainer Auto    ; container to store all the armors in

Event OnInit()
    AddInventoryEventFilter(ItemsToSort)
EndEvent

Event OnItemAdded(Form akBaseItem, Int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContianer)
    If (food.Find(akBaseItem) > 0)
        FoodContainer.AddItem(akBaseItem, aiItemCount)    ;if used for moddified weapons or armor this will probably remove all modifications
;        akItemReference.MoveTo(WeaponContainer)    ;haven't tested this but it might work to keep installed modifications, if you do test it with this remove the additem and removeitem lines
        Self.RemoveItem(akBaseItem, aiItemCount)
    ElseIf(Armors.Find(akBaseItem) > 0)
        ArmorContainer.AddItem(AkBaseItem, aiItemCount)
;        akItemReference.MoveTo(ArmorContainer)    
        Self.RemoveItem(akBaseItem, aiItemCount)
; continue this structure until you have sorted everything
    EndIf

EndEvent

Again I haven't tested this in game but the script should compile.

Link to comment
Share on other sites

Hey NorthernNick. Hope I didn't lead you down the garden path...I've only been able to get the "cloud" storage to work linking workbenches. Hadn't tried it with normal containers until just now and nope...can't get it to work with just liked refs and keywords the way the workbenches "just work." So it must be something in the workbench scripting. But I do have a functional sorting script that works just peachy between normal containers...as well as linked activators as LoneRaptor mentioned (just started using that method...opens up lots of options).

 

Anyway, give his script a try and if it doesn't fit your needs I'd be happy to post mine.

Link to comment
Share on other sites

There is a default script for linking an activator with a chest called: DefaultActivateLinkedRefOnActivate. I used it to link multiple activators spread around the map to the same container so they all act as that one base container. (doesn't share the quick loot menu)

To use this script you make an activator for example using the model from the conatiner you want and add the script to it then you link your container to the activator.

For the sorting you should definitely be using formlists like RedRockeTV suggested. Here is an example of how I would try to do this( haven't been able to test this but it should work).

Place this script on your master container:

FormList Property ItemsToSort Auto    ; formlist of all the items you want to sort
FormList Property food Auto    ;formlist of all items that need to be sorted to the foodcontainer
FormList Property Armors Auto    ;Formlist of all the items that need to be stored in the ArmorContainer
ObjectReference Property FoodContainer Auto        ;container to store all the food items in
ObjectReference Property ArmorContainer Auto    ; container to store all the armors in

Event OnInit()
    AddInventoryEventFilter(ItemsToSort)
EndEvent

Event OnItemAdded(Form akBaseItem, Int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContianer)
    If (food.Find(akBaseItem) > 0)
        FoodContainer.AddItem(akBaseItem, aiItemCount)    ;if used for moddified weapons or armor this will probably remove all modifications
;        akItemReference.MoveTo(WeaponContainer)    ;haven't tested this but it might work to keep installed modifications, if you do test it with this remove the additem and removeitem lines
        Self.RemoveItem(akBaseItem, aiItemCount)
    ElseIf(Armors.Find(akBaseItem) > 0)
        ArmorContainer.AddItem(AkBaseItem, aiItemCount)
;        akItemReference.MoveTo(ArmorContainer)    
        Self.RemoveItem(akBaseItem, aiItemCount)
; continue this structure until you have sorted everything
    EndIf

EndEvent

Again I haven't tested this in game but the script should compile.

 

Mate, your a complete star!!! Can't believe I didn't spot that script during the man MANY hours of trying to get this working but it works an absolute treat now, and having a look at it through Notepad++ has been a huge help in starting to get my head around scripting. Cheers fella, dude, I really can't thank you enough for the DefaultActivateLinkedRefOnActivate and the sorting scrpit, i've been plugging away at this for a while now! Thanks a million!

 

Hey NorthernNick. Hope I didn't lead you down the garden path...I've only been able to get the "cloud" storage to work linking workbenches. Hadn't tried it with normal containers until just now and nope...can't get it to work with just liked refs and keywords the way the workbenches "just work." So it must be something in the workbench scripting. But I do have a functional sorting script that works just peachy between normal containers...as well as linked activators as LoneRaptor mentioned (just started using that method...opens up lots of options).

 

Anyway, give his script a try and if it doesn't fit your needs I'd be happy to post mine.

 

Hey Rocket, didn't lead me down the path at all mate! I'm really gratefull for you help and advice and if it's OK a look at your sorting script would be hugely appreciated. Hopefully with Raptors staring example and yours I can get everything working how I'm imagining it do do so.

 

Feeling a lot more hopeful now, might be able to upload the home soon'ish; quite happy with it, it's quite big but I've tried really hard to add a lot of details, and now just working on the functionality of the place.

 

Once I've got my head around the sorting stuff I've got a bit of a plan so as a certain terminal will look in the food container, ammo container, junk container etc. and then for every 10 Abraxo Cleaner, It'll remove them, dump them in another invisible container and stick 1 physical Abraxo on a shelf in the storage room, then when you take that abraxo off the shelf it#ll return 10 to your inventory or maybe straight to the workbench. Hope to be able to do this for most items. Going to also try and implement it so as it appropriately sifts things straight into the workbench for folks who unlike me don't like to keep things separate and organised... got a touch of the OCD!

 

Thanks again, really appreciate the time folks have taken to help me out! Sorry if my writings not so clear, very dyslexic so its quite a challenge to get whats in my head out 'on paper' so to speak :)

Link to comment
Share on other sites

OK, here 'tis! I've left my all my properties as they are, so you'll have to substitute your own. I've only included the sorting fragments for two item categories (ballistic weapons and energy weapons) but you can use them as a template to set up whatever and however many categories you need (ie: food, chems, drink, armor, et al). Those respective form lists will flag what items get sorted into what category since they are properties for the AddInventoryEventFilter events.

 

The SortAccepted form list references all the items I want the script to sort. This might not actually be needed since all of these items are in their respective category form lists but since this is the first time I've done this and it works, I see no harm to leave it in...just might be redundant.

 

SortRejected will kick back any items in that form list back to the player and display a message. This form list has anything not filtered through any of the previous form lists. In the event you leave something out of any form list or don't address it in an AddInventoryEventFilter, it just stays in the sorting container and will need to be sorted manually. In my testing the only thing that happened to are DLC related items that I've forgotten to add to my form lists.

 

In any event, feel free to fold, spindle and mutilate as you see fit. This is my first time attempting this and I was thrilled when it actually worked. Hope it helps!

Scriptname ItemSort extends ObjectReference

;PROPERTIES

ObjectReference Property BallisticWeapStorage Auto
ObjectReference Property EnergyWeapStorage Auto


FormList Property EnergySort Auto
FormList Property BallisticSort Auto

;EVENTS

Event OnActivate(ObjectReference akActionRef)
	AddInventoryEventFilter(SortAccepted)
	AddInventoryEventFilter(EnergySort)
	AddInventoryEventFilter(BallisticSort)
	AddInventoryEventFilter(SortRejected)
EndEvent


Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
		
	;ballistic weapons sort
	ElseIf BallisticSort.HasForm(akBaseItem)
		RemoveItem(akBaseItem, aiItemCount, True, BallisticWeapStorage)
		debug.MessageBox("Item stored in Ballistic Weapons Storage.")
	
	;energy weapons sort
	ElseIf EnergySort.HasForm(akBaseItem)
		RemoveItem(akBaseItem, aiItemCount, True, EnergyWeapStorage)
		debug.MessageBox("Item stored in Energy Weapons Storage.")

		;This is the message to show when an item is not recognized by the container 
		;or if it's an item you don't want the player to place inside.
		ElseIf SortRejected.HasForm(akBaseItem)
		RemoveItem(akBaseItem, aiItemCount, True, akSourceContainer)
		Debug.MessageBox("You can not store that item.")

EndIf		

EndEvent
Link to comment
Share on other sites

  • Recently Browsing   0 members

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