Counting item in a pile

Post » Tue Jun 19, 2012 4:18 am

I made a script to destroy item whit a specific weapon to gather components. So I made a scripted dagger that is destroyed when "onhit" by a mace. Everything seems to be fine until they're stacked in a pile.
If I have a pile of 9 daggers, the pile is destroyed but it seems it's recognized as only 1 object. I couldn't find any function that counts items stacked in a pile, but tried with .getitemcount, and it didn't work.
Any ideas ?

Here's the script :
Spoiler

Scriptname DestructItem extends ObjectReferenceformlist property destructool autoObjectReference property Target autoInt property MatNumb autoint property ItemCount autoMiscObject Property WeapMat  AutoobjectReference property objSelf auto hiddenEvent OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)if destructool.hasform(akSource)  if akAggressor==game.getplayer()   objSelf= self as ObjectReference   ;debug.messagebox(objSelf)   ;debug.messagebox(objSelf.getactorowner())   ;debug.messagebox(objself.getfactionowner())   if objself.GetActorOwner()==none	if objself.GetFactionowner()==none	 ;ItemCount=objself.getitemcount(objself.getbaseobject())	 ;debug.messagebox(itemcount)	 game.getplayer().additem(WeapMat, (MatNumb*ItemCount))	 objself.delete()	else	 debug.notification("You can only destroy your items.")	endif   else	debug.notification("You can only destroy your items.")   endif  endifendifendevent
User avatar
Andrew Perry
 
Posts: 3505
Joined: Sat Jul 07, 2007 5:40 am

Post » Tue Jun 19, 2012 1:42 pm

Think this is an general problem, if you drop an stack on floor and ask an follower to pick up they only take one item and destroy the rest.
User avatar
Tha King o Geekz
 
Posts: 3556
Joined: Mon May 07, 2007 9:14 pm


Return to V - Skyrim