BadPrenup Posted July 17, 2009 Share Posted July 17, 2009 I am trying to cycle through the players inventory, as shown here:Walking Through Inventory And I can't get it to work. Here is my script: scn ILLaunderQuestScript float fquestdelaytime short InvPos ref pInvObj ref pCont short pMerc short Value Begin GameMode set fquestdelaytime to .01 If player.getAV Mercantile <= 100; set pmerc to 1; if player.getAV mercantile <= 75; set pmerc to .75; If player.getAV mercantile <= 50; set pmerc to .5; If player.getAV mercantile <= 25;These change variable based on Player's mercantile set pmerc to .25; EndIf; EndIf; EndIf; EndIf; set pCont to Player;Sets the inventory ref to the player set InvPos to pCont.GetNumItems;sets the position of the checker to the last item spot in the inventory Label if InvPos set InvPos to (InvPos - 1) set pInvObj to (pCont.GetInventoryObject InvPos) If pInvObj.GetOwner player == 0 set Value to (pInvObj.GetGoldValue*pMerc) pInvObj.ClearOwnership pInvObj.SetGoldValue Value EndIf Goto;goes to label endif StopQuest ILLaunderQuest End I used a simple debug message to isolate the problem, it lies in the line: If pInvObj.GetOwner player == 0For some reason right there is where it stops running. I have no idea why, pInvObj is already specified, GetOwner player == 0 should just check ifthe player is the owner of the item or not. I'm stuck, any help? Link to comment Share on other sites More sharing options...
Pronam Posted July 17, 2009 Share Posted July 17, 2009 The owner-swap for stolen items I guess...I don't know if it got lost in the copy, but where is the block-number after 'if InvPos' ?You could always check if != 1 will work at the ownership. Link to comment Share on other sites More sharing options...
QQuix Posted July 17, 2009 Share Posted July 17, 2009 When walking the inventory you are dealing with Base Objects, so you may get/set the kind of data you see when you double click an object in the CS Object Window (e.g, Value, Weight, Name)If you change anything here, you change all the References to that object. Ownership is stored in each Reference (as each may have a different owner) and the Reference record does not exists while an item is in an inventory, so it is not easily accessible (if at all). I cant help you here as I have not played with ownership, but I have seen modders asking about this and they may have found a workaround. Search the forums. RefStuff (an OBSE pluggin) has some functions to handle items in inventory.The OBSE ream is also doing some research to add these kind of functions in future versions. Link to comment Share on other sites More sharing options...
Recommended Posts