Jump to content

Photo

Limited containers capacity weight

limited capacity weight chest containers carryweight carry limit boxs barrels

  • Please log in to reply
21 replies to this topic

#21
baronesbc

baronesbc

    Regular

  • Members
  • PipPip
  • 53 posts

 

Alright, so I made a manager quest for Limited Container Capacity, made the player ref, and added this script:

Scriptname LCC_ManagerScript extends ReferenceAlias

Float Property Max = 500.00 Auto

;Event OnInit()
;	Debug.Notification("LCC running")
;EndEvent

Event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)
;	Debug.Notification("Item removed from player")
	If ( akDestContainer )
;		Debug.Notification("akDestContainer is valid")
		Int NumItems = akDestContainer.GetNumItems()
;		Debug.Notification("NumItems: "+NumItems)
		Int i = 0
		Float TotalWeight = 0
		While ( i < NumItems )
			If ( akDestContainer.GetNthForm(i) )
					TotalWeight = TotalWeight + ( akDestContainer.GetNthForm(i).GetWeight() * akDestContainer.GetItemCount(akDestContainer.GetNthForm(i)) )
					i += 1
			EndIf
		EndWhile
		Debug.Notification("Container Weight: "+TotalWeight)
		If ( TotalWeight > Max )
			akDestContainer.RemoveItem( akBaseItem, aiItemCount, true, Game.GetPlayer() )
			Debug.Notification("This item won't fit in this container")
;		Else
;			Debug.Notification("The item fits")
		EndIf
	EndIf
EndEvent

It originally didn't work because I was dumb and had it extending ObjectReference. But after I changed that, I noticed everything was working fine except that the item wasn't being returned to the player. It wasn't being removed, either. It was just staying there even though it knew it didn't fit. So I changed it to akBaseItem and it worked perfectly. I even clicked 3 in rapid succession that wouldn't fit and even though all three made it in before the script got through the first, it managed to return all three in turn. So, that's promising.

 

But I'm worried that returning the base item is going to strip any player enchanted/upgraded items of their enhancements. Thoughts?

 

Actually, I realized I had an upgraded piece of armor. So I filled the container and then put in the armor, and it was returned in its upgraded state. However, I don't have anything I've enchanted, so I can't test that easily. Here's the file if one of you would be awesome enough to test it if you can easily.

 

EDIT: In the file, I forgot to compile the script. The only thing I'd changed is commenting out the unnecessary notifications.

 

EDIT2: I reread this and realized it was practically unintelligible because I made so many typing mistakes. They're fixed now. I should really proof-read my posts...

 

Thanks! I tried to use this mod, but when i trade whit my follower appears a bug: the items that i transfer to backpack of my follower are replicated...

moreover i want to know if possible to apply it at this mod: 

Dragonkiller Cart Reloaded 

http://skyrim.nexusm...?id=25493&pUp=1


Edited by baronesbc, 28 November 2013 - 01:12 PM.


#22
brenden2911

brenden2911

    Stranger

  • Members
  • Pip
  • 3 posts

Hi all, I was wondering if was possible to create a mod that add a limit capacity weight for boxes barrels or other containers, I never could stand the unrealistic idea to add items inside the containers to infinity... Unfortunately I could not find a mod like this anywhere, (if this already exists please post me) so if this idea would be developed by some modder I'd love to ... Thank you and sorry my bad English by google translate :) 


Theoretically, why would you even need to monitor every container in the world? World containers reset, so people really only are going to store their stuff in containers in the player home. Just put weight caps on that instead only.





Also tagged with one or more of these keywords: limited, capacity, weight, chest, containers, carryweight, carry, limit, boxs, barrels

IPB skins by Skinbox
Page loaded in: 1.208 seconds