TheWanderer001 Posted May 3, 2021 Share Posted May 3, 2021 (edited) I'm trying to dynamically set the weight of a misc item in the players inventory. Basic what I have as the (not)working bit is... there is obviously a lot more code around it :wink: float fWeightfWeight = 50.0TWMiscRef.SetWeight( fWeight ) This does not work though...can it be done or am I not interpreting what the function is suppose to do correctly ??? Thanks for any help :smile: P.S.I have also tried using a formlist to access and setwieght to the base item... that didn't work either :sad: Edited May 3, 2021 by TheWanderer001 Link to comment Share on other sites More sharing options...
IsharaMeradin Posted May 3, 2021 Share Posted May 3, 2021 You need to set the weight on the base object rather than the reference. The weight change will affect all instances of the object. Here is a working example that I use to change the weight of an object in the inventory that opens a container which is intended to represent additional and / or more specific categories: Function SetRepItemWeight(GlobalVariable GV, ObjectReference TheCont, Form RepItem) If GV.GetValue() == 0.0 Float CurrentWeight = 0.0 CurrentWeight = TheCont.GetTotalItemWeight() RepItem.SetWeight(CurrentWeight) EndIf EndFunctionThis is an SKSE required function. GV is a global variable used to indicate whether or not this container category is weightless. TheCont is the pre-placed container that is used to hold the items in the "category". TheRepItem is the base form of the inventory held object which represents the container category.Your use will obviously be different but you can use the example to see where you may have gone wrong. It should also be noted that the weight won't immediately reflect in the inventory if the weight change is taking place while in the inventory. Inventory will need to be closed and reopened for it to be noticeable. Link to comment Share on other sites More sharing options...
TheWanderer001 Posted May 3, 2021 Author Share Posted May 3, 2021 Great thanks :) Hopefully I'll be able to figure out how to get the right form to set the weight on. Link to comment Share on other sites More sharing options...
TheWanderer001 Posted May 4, 2021 Author Share Posted May 4, 2021 Ha... it appears I was already using the correct form.But seems it didn't work because the item already had a weight... setting it's weight to 0 first solved the problem. Link to comment Share on other sites More sharing options...
Recommended Posts