Can not count item count for dropped items... need advice

Post » Tue Nov 20, 2012 11:59 am

Ok, I need some input..

I'm dropping say, 72 iron arrows into a cell.

I use a ring that has a script that will pick up items..

the script uses a ObjectReference Property ObjectRef Auto, to find the item..

then if I use ObjectRef.GetItemCount(ObjectRef) or ObjectRef.GetItemCount(ObjectRef.GetBaseObject()) which is actually the 72 iron arrows I dropped, it returns 0 items..

then if I use ObjectRef.GetNumItems(), it also returns the 72 arrows has 0 arrows inside..

so if I use the script to activate the object reference, it picks up 1 iron arrow, just the object reference itself.

If i use the player to activate the object reference it picks up 72 arrows..

Can someone help me? I need to get the script to recognize the object reference has 72 arrows....
User avatar
natalie mccormick
 
Posts: 3415
Joined: Fri Aug 18, 2006 8:36 am

Post » Tue Nov 20, 2012 5:58 pm

GetItemCount is a member of ObjectReference and a CELL form is not an ObjectReference, so that's why it's returning 0.

Try SKSE's http://www.creationkit.com/GetNumRefs_-_Cell/http://www.creationkit.com/GetNthRef_-_Cell (both members of Cell).

Spoiler
Actor Property PlayerREF AutoEvent SomeEvent()	TakeAllOfFormTypeFromCell(42, PlayerREF)EndEventFunction TakeAllOfFormTypeFromCell(Int aiFormType, Actor akRecipient) Global	Cell kCell = akRecipient.GetParentCell()	Int iIndex = kCell.GetNumRefs(aiFormType)	While iIndex > 0		iIndex -= 1		kCell.GetNthRef(iIndex, aiFormType).Activate(akRecipient)	EndWhileEndFunction
User avatar
Siidney
 
Posts: 3378
Joined: Fri Mar 23, 2007 11:54 pm

Post » Tue Nov 20, 2012 7:45 am

I will be testing that method and let you know the results..

In the meantime, ran into another issue.

I'm using a NPC dummy to use as a do not sort container.. Anything the NPC has, the generic item sorter will not sort into containers, the bonus being, if the dummy NPC has 5 of 1 item, the sorter will leave 5 of that item unsorted..

Ran into a problem with the NPC equipping any generic weapon, but not armor (strange, right?). So I resolved by sticking a dummy weapon on it.

The new issue, is the game can not tell an item is tempered or not. It does not recognize the difference between a Steel Sword from a Legendary Steel sword.

Is there a fix for this? I was thinking of comparing the base damage and comparing it to the base object..

Also, if I have a stack of say 5 Steel Sword, and the player has equipped one of them, is there a way to test which of the 5 is equipped, and just sort the remaining 4?
User avatar
Anna Krzyzanowska
 
Posts: 3330
Joined: Thu Aug 03, 2006 3:08 am

Post » Tue Nov 20, 2012 7:46 am

Ok, attempted to pick up a bundle of arrows from the cell as you recommended Justin.

Results are negative. I dropped 100 arrows in a bundle on the ground, activated the script. The bundle of 100 arrows got picked it alright, checked player inventory, and it only showed 1 arrow.

Back to my original problem.. GetItemCount has to work somehow.. GetNumItems will only show 1 item, but it returns 0. 100 arrows is 1 item. not 100 items.. I'm still wondering how to test for more than 1 item in a stack..
User avatar
SamanthaLove
 
Posts: 3565
Joined: Mon Dec 11, 2006 3:54 am


Return to V - Skyrim