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
Edited by baronesbc, 28 November 2013 - 01:12 PM.