Clearing ownership of items

Post » Wed Jun 20, 2012 9:48 am

I have been trying most of the day to clear the ownership of items in the players or containers inventory.
Nothing works, even though the function says it 'does'.

My latest attempt was to use 'removeAllItems'. Even though the WIKI says it will remove ownership information, it does not.
RemoveAllItems(ObjectReference akTransferTo = None, bool abKeepOwnership = false, bool abRemoveQuestItems = false)
http://www.creationkit.com/RemoveAllItems_-_ObjectReference

Does anyone have a way to clear the ownership of items?


I remove all the players items to a chest, and then move them back. That works fine, but the items still say they are 'stolen'.

 Scriptname LevelersOwnershipScript extends ObjectReference {Clear ownership from inventory}objectReference property objSelf auto hiddenObjectReference Property LevelersContheftREF  Auto Message Property LevelersAutoSortMSG  Auto event onCellAttach()  objSelf = self as objectReference  playAnimation("Open")endEventEvent OnActivate(ObjectReference akActionRef)  If akActionRef == Game.GetPlayer()    PlayAnimation("Trigger01")    Game.GetPlayer().RemoveAllItems(LevelersContheftREF, false, true)    Utility.Wait(0.2)    LevelersContheftREF.RemoveAllItems(Game.GetPlayer(), false, true)    LevelersAutoSortMSG.Show()  endifendEvent
User avatar
Tamara Primo
 
Posts: 3483
Joined: Fri Jul 28, 2006 7:15 am

Post » Wed Jun 20, 2012 12:56 pm

Use http://www.creationkit.com/SetActorOwner_-_ObjectReference, pass none if you don't want any owner, or pass a specific one.
User avatar
KiiSsez jdgaf Benzler
 
Posts: 3546
Joined: Fri Mar 16, 2007 7:10 am

Post » Wed Jun 20, 2012 2:24 pm

SetActorOwner only works on individual items. Not container entries. This command was my first attempt at clearing ownership of inventory.
I tried setting the container to the player but it did not change the contents of the container.

I suspect I will need to loop through inventory of something, changing each item. But I am not sure how to do that. Any pointers?
User avatar
CSar L
 
Posts: 3404
Joined: Fri Nov 09, 2007 9:36 pm

Post » Wed Jun 20, 2012 7:46 am

Try changing

Game.GetPlayer().RemoveAllItems(LevelersContheftREF, false, true) 

to

Game.GetPlayer().RemoveAllItems(LevelersContheftREF, true, true) 


I can't tell you why this works (and it might not even work in your case). The logic for determining ownership of things is hopelessly screwed though (cf the companion loot bug). What it says it does in the Wiki is not what it does.
User avatar
Rob
 
Posts: 3448
Joined: Fri Jul 13, 2007 12:26 am

Post » Wed Jun 20, 2012 1:43 pm

I had tried both false and true, but I will try it again. You never know what might happen?!! :lmao:

EDIT:
Yeah, same result whether its true or false, it does not clear ownership.
User avatar
jason worrell
 
Posts: 3345
Joined: Sat May 19, 2007 12:26 am

Post » Wed Jun 20, 2012 1:50 am

I came up with a 'work around' for cleaning the items in a formlist of their ownership. It has its drawbacks as it will only work on 'unchanged' items. Because I 'remove' the item, and then 'add' the form to the chest. So in essence, its a 'new' item, not the item that was in your inventory.
But in this case, its okay. I only want this to work on vanilla items.

 Scriptname LevelersCleanItemScript extends ObjectReference {Clean formlist of ownership}FormList Property ItemsToTransfer AutoObjectReference Property ThisContainer AutoobjectReference property objSelf auto hiddenMessage Property LevelersAutoSortCleanMSG  Auto Form ThisItemFormint FormIndexint TotalItemsint ThisItemQtyevent onCellAttach() objSelf = self as objectReference playAnimation("Open")endEventEvent OnActivate(ObjectReference akActionRef) if akActionRef == Game.GetPlayer()  PlayAnimationAndWait("Trigger01","done")  TotalItems = ItemsToTransfer.GetSize()  FormIndex = 0  while FormIndex < TotalItems   ThisItemForm = ItemsToTransfer.GetAt(FormIndex)   ThisItemQty = Game.GetPlayer().GetItemCount(ThisItemForm)   if ThisItemQty > 0	Game.GetPlayer().RemoveItem(ThisItemForm, ThisItemQty, true)	ThisContainer.AddItem(ThisItemForm, ThisItemQty)   endif   FormIndex = FormIndex + 1  endwhile  LevelersAutoSortCleanMSG.Show() endifEndEvent
User avatar
Franko AlVarado
 
Posts: 3473
Joined: Sun Nov 18, 2007 7:49 pm


Return to V - Skyrim