Jump to content

Script Issue for my First PlayerHome Mod


Recommended Posts

Perhaps it might help you looking at some typical code segments.

Here's one for looping through an inventory (you might use that on your akActionRef param to find the least valuable gem):

		int i = r.getNumItems()
		while i
			i -= 1
			Form item = r.getNthForm( i)
			if isLootable( item)
				return True
			endif
		endwhile
		return False

Here testing if x is a less valuable gem than y:

; Note that this ignore the charge level
; Comparing the charge is trickier; you need to test the references, 
; and you need to move them out of the inventory to do that.
function bool isLessValuable( Form x, Form y)
	return !y || (x.getType() == 52 && x.getGoldValue() < y.getGoldValue())
endfunction

It would be easier to help you if you shared your sample code in text rather than pixels.

Edited by xkkmEl
Link to comment
Share on other sites

  • Recently Browsing   0 members

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