This shouldn't be too hard. You'd want to use the following functions:
http://cs.elderscrolls.com/constwiki/index.php/SetGoldValue
http://cs.elderscrolls.com/constwiki/index.php/GetObjectHealth (OBSE only)
You'd do it by getting the health of the object, using that as a multiplier, and make it so that you set the value of the item proportionate to the health of it.
If you need any more help, just ask.