Jump to content

A way to check weight of objects in a container.


antstubell

Recommended Posts

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • Recently Browsing   0 members

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