Here's the problem. Let's say I have two of the exact same weapons, like 2 Daedric Daggers. If the first one breaks, the second one is invisible to the script, apparently because GetItems, GetInventoryObject, and all other such commands only look for unique objects in the inventory.
Is there any way to have my script point to that second instance of the Daedric Dagger, perhaps through using GetItemCount or something of that nature? Thanks in advance - I've been trying to figure this out for a while.
A section of the script:
Spoiler
Variables definition--
probevalue = http://forums.bethsoft.com/index.php?/topic/1104247-getitems-getinventoryobject-etc/gold value of the best selection in inventory. This is continuously updated as the player's weapon inventory is walked through.
allowedweapon = stores whether a given weapon is allowed, given other requirements (for example, if the player is using a shield then disallow 2-handed weapons). Simple 1 or 0.
Obj = ObjectID of the currently equipped weapon
Probe = Object ID of the weapon under consideration
Final = ObjectID of the final selection for weapon to equip
let clothing := player.GetItems 33 ;20 = armor, 22 = clothes, 33 = weapon
let final := 0
let probevalue := -1
ForEach item <- clothing
let probe := item["Value"]
let tempa := GetWeaponType probe
let ObjTtlHP := GetObjectHealth probe
let ObjCurHP := 0 ;needed in case this is a broken weapon and is unequipped quickly
Player.Equipitem2NS probe
let ObjCurHP := Player.GetEquippedCurrentHealth WeaponSlot
Player.UnequipitemNS probe
let Percentage := ObjCurHP / ObjTtlHP
if eval (allowedweapon[tempa]) > 0 && Percentage >= 0.01 ;don't try to equip a damaged weapon!
let tempa := allowedweapon[tempa]
If probevalue <= (GetFullGoldValue probe) * tempa ;find highest value weapon of right type
let probevalue := (GetFullGoldValue probe) * tempa
let final := probe
endif
endif
loop
if final > 0
if player.IsWeaponOut == 1
set rdyWpn to GetControl 8
Tapkey rdyWpn ;this sheathes the weapon temporarily
let alert := 1
else
let alert := 0
Endif
player.UnequipitemNS Obj
player.EquipItem2NS final
Variables definition--
probevalue = http://forums.bethsoft.com/index.php?/topic/1104247-getitems-getinventoryobject-etc/gold value of the best selection in inventory. This is continuously updated as the player's weapon inventory is walked through.
allowedweapon = stores whether a given weapon is allowed, given other requirements (for example, if the player is using a shield then disallow 2-handed weapons). Simple 1 or 0.
Obj = ObjectID of the currently equipped weapon
Probe = Object ID of the weapon under consideration
Final = ObjectID of the final selection for weapon to equip
let clothing := player.GetItems 33 ;20 = armor, 22 = clothes, 33 = weapon
let final := 0
let probevalue := -1
ForEach item <- clothing
let probe := item["Value"]
let tempa := GetWeaponType probe
let ObjTtlHP := GetObjectHealth probe
let ObjCurHP := 0 ;needed in case this is a broken weapon and is unequipped quickly
Player.Equipitem2NS probe
let ObjCurHP := Player.GetEquippedCurrentHealth WeaponSlot
Player.UnequipitemNS probe
let Percentage := ObjCurHP / ObjTtlHP
if eval (allowedweapon[tempa]) > 0 && Percentage >= 0.01 ;don't try to equip a damaged weapon!
let tempa := allowedweapon[tempa]
If probevalue <= (GetFullGoldValue probe) * tempa ;find highest value weapon of right type
let probevalue := (GetFullGoldValue probe) * tempa
let final := probe
endif
endif
loop
if final > 0
if player.IsWeaponOut == 1
set rdyWpn to GetControl 8
Tapkey rdyWpn ;this sheathes the weapon temporarily
let alert := 1
else
let alert := 0
Endif
player.UnequipitemNS Obj
player.EquipItem2NS final