antstubell Posted August 15, 2021 Posted August 15, 2021 So I am attempting a scene where player uses scales. Two scales. The idea is to place the correct weight on/in each scale and thus get a result. I'm approaching this using a container linked from a triggerbox activator. The script needs to check the weight of two containers/scales as player puts/takes objects in/out. Not both containers need to have the same weight to succeed. If the target weight is say 100 then as long as the combined weight is 100 it doesn't matter if one has a weight of 10 and the other 90.Help appreciated.
HeyYou Posted August 15, 2021 Posted August 15, 2021 Probably have to cycle thru the number of items in the container, get their weight individually, and add 'em up.
anjenthedog Posted August 15, 2021 Posted August 15, 2021 in meta (I don't code in skyrim) (and ignoring the _Two+_ scales part because that can be done by indexing the "Total" bins and using their individual outcomes as the comparison basis) let T = total weight of items in bin On item add, T = T + w, where w is the selected item weight If you use qty, then w would become a function w(i) = Q x W, where i is the item, W is the unit item weight, and Q is the qty of that item. So the simple version would just be to substitute the second form inside whatever the code is that accomplishes that "On Item Add" magic On Item Add, T = T + (Q x W) At least I think that approach will do the job quickly and in a live manner. You could put some conditional that branches between adding and subtracting too. On Item_Add_Subtract, is add_operation? T = T + (Q x W) else if delete_operation? T = T - (Q x W) end
IsharaMeradin Posted August 15, 2021 Posted August 15, 2021 Using SKSE: GetTotalItemWeight Not using SKSE:Not possible, the weight field of an object is not exposed to papyrus.
antstubell Posted August 17, 2021 Author Posted August 17, 2021 Not using SKSE because in over 7 years of modding it's never worked for me. I will abandon this idea.
Recommended Posts