Game.GetPlayer().RemoveAllItems(HoldingContainer, True, True

Post » Wed Jun 20, 2012 1:44 pm

This removes all the items from my player's inventory except Gold and Unusual Gems.

Can anyone tell me why or what else I need to script?
According to the Wiki, there should be zilch and that's what I want.

Is there anything else that wouldn't get moved if it was in the player's inventory?
User avatar
Len swann
 
Posts: 3466
Joined: Mon Jun 18, 2007 5:02 pm

Post » Wed Jun 20, 2012 3:11 pm

My guess is that http://www.creationkit.com/RemoveAllInventoryEventFilters_-_ObjectReference would undo instances where http://www.creationkit.com/AddInventoryEventFilter_-_ObjectReference has been used, probably by Skyrim.ESM.

Edit: That's probably not it
User avatar
Chica Cheve
 
Posts: 3411
Joined: Sun Aug 27, 2006 10:42 pm

Post » Wed Jun 20, 2012 12:56 pm

My guess is that http://www.creationkit.com/RemoveAllInventoryEventFilters_-_ObjectReference would undo instances where http://www.creationkit.com/AddInventoryEventFilter_-_ObjectReference has been used, probably by Skyrim.ESM.

That makes sense.
Do you know if there is a way to get what filters may be in place so I can re-establish them after I remove them?


Edit: Didn't work, Gold and Unusual Gems still there.
User avatar
Kit Marsden
 
Posts: 3467
Joined: Thu Jul 19, 2007 2:19 pm

Post » Wed Jun 20, 2012 5:18 pm

There are only 14 Beth scripts that use AddInventoryEventFilter(). I guess you could get a FormList together of all the filtered items, check after RemoveAllItems() which of those items are filtered (still remain), add them to a different FormList, remove the filter(s), then add a new filter for the second FormList when appropriate right before reverting it for the next time.

Spoiler
FormList Property AllBethFilteredItemsFLST AutoFormList Property CurrentlyFilteredItemsFLST AutoEvent SomeEvent()	If Criterion ; Remove ALL items		MoveEverything(Game.GetPlayer(), HoldingContainer)	ElseIf Something ; Give all items back/Revert filters and FLST		RemoveAllItems(Game.GetPlayer(), True, True)		Game.GetPlayer().AddInventoryEventFilter(CurrentlyFilteredItemsFLST)		CurrentlyFilteredItemsFLST.Revert()	EndIf	EndEventFunction MoveEverything(ObjectReference akDonor = None, ObjectReference akRecipient = None, Int aiListIndex = 0, Form akCurrentForm = None)	akDonor.RemoveAllItems(akRecipient, True, True)		If akDonor.GetItemCount(AllBethFilteredItemsFLST)		aiListIndex = AllBethFilteredItemsFLST.GetSize()		While aiListIndex			aiListIndex -= 1			akCurrentForm = AllBethFilteredItemsFLST.GetAt(aiListIndex)			If akDonor.GetItemCount(akCurrentForm)				CurrentlyFilteredItemsFLST.AddForm(akCurrentForm)				akDonor.RemoveInventoryEventFilter(akCurrentForm)				akDonor.RemoveItem(akCurrentForm, akDonor.GetItemCount(akCurrentForm), True, akRecipient)			EndIf		EndWhile	EndIfEndFunction 

Edit: Guess that's probably not it...
User avatar
Big Homie
 
Posts: 3479
Joined: Sun Sep 16, 2007 3:31 pm

Post » Wed Jun 20, 2012 7:58 pm

I'm not seeing what the inventory event filter has to do with this (unless that is part of the bug).

As I understand it, the inventory filter won't stop items being removed, but will only allow some of those items being removed to be sent to the OnItem[Added|Removed]() Events.
ie. if there was a script with an event filter on the Gems, then it has asked to only receive events when the Gem is the subject. If you could remove the filter, then all types of objects would spam the event.
User avatar
Alexis Estrada
 
Posts: 3507
Joined: Tue Aug 29, 2006 6:22 pm

Post » Thu Jun 21, 2012 3:11 am

I'm very interested in this as well, I transfer items around a lot in my mod and I've noticed that RemoveAllItems just doesn't catch everything. There is also a very very bad bug with RemoveAllItems that you haven't seemed to notice just yet.

Any modifications to the players stats (such as health or skills) that are applied via equipment do NOT get removed from the player upon using RemoveAllItems. And when giving the player his items back, equipping/unequipping the items does not restore the stat modifications to normal. (You would essentially accumulate stats over and over if you tried to do this.)

I fix this in my own mod by forcing the player to unequip everything before removing all items.
Player.UnequipAll()Utility.Wait(0.3)				; Wait for the items to be fully unequipped. This MUST be done. I do not know if it only needs 0.1 seconds or the full 0.3, but this is what I use and it works.Player.RemoveAllItems(Target, True, True)	; Move the players items to the target

I personally would love to find out how to remove these extra items, as I find them quite annoying. I also had no idea about the gold thing, I'll have to figure that out as well...
User avatar
Isaiah Burdeau
 
Posts: 3431
Joined: Mon Nov 26, 2007 9:58 am

Post » Wed Jun 20, 2012 8:29 pm

You can remove gold with removeitem. I suppose the same could be applied to any other object not removed by removeallitems. This way, performing a removeallitems followed by various removeitem commands for each not removed item type could fix the issue. Not the perfect solution but at least would work.
User avatar
Kelly Osbourne Kelly
 
Posts: 3426
Joined: Sun Nov 05, 2006 6:56 pm

Post » Thu Jun 21, 2012 1:36 am

You can remove gold with removeitem. I suppose the same could be applied to any other object not removed by removeallitems. This way, performing a removeallitems followed by various removeitem commands for each not removed item type could fix the issue. Not the perfect solution but at least would work.

I don't know if aellis has done any research on the matter, but I myself have no idea which items are not removed (other than gold). So while your solution works just find for gold, it doesn't really work for everything else, because I don't know which items exactly are not being properly removed.
User avatar
saxon
 
Posts: 3376
Joined: Wed Sep 19, 2007 2:45 am

Post » Wed Jun 20, 2012 7:17 pm

I don't know if aellis has done any research on the matter, but I myself have no idea which items are not removed (other than gold). So while your solution works just find for gold, it doesn't really work for everything else, because I don't know which items exactly are not being properly removed.
I read in a post somewhere that the game engine decides what and when items become quest items. If that's true, what would get rmoved in my game, may not get moved in yours.
Since I'm still quite new at papyrus, I've decided not to worry about it. Either it will get fixed with SKSE or not. I'm sure Bethesda won't deal with it.
Luckily, for me, a few items left in the player's inventory won't affect what I'm wanting to do and the extra code to "try" and find these orphans isn't worth the time to me.
Thanks for the tip on Unequip. I'm sure I would've had a tough time figuring that out.
User avatar
saharen beauty
 
Posts: 3456
Joined: Wed Nov 22, 2006 12:54 am

Post » Wed Jun 20, 2012 8:55 pm

There are only 14 Beth scripts that use AddInventoryEventFilter(). I guess you could get a FormList together of all the filtered items, check after RemoveAllItems() which of those items are filtered (still remain), add them to a different FormList, remove the filter(s), then add a new filter for the second FormList when appropriate right before reverting it for the next time.

Spoiler
FormList Property AllBethFilteredItemsFLST AutoFormList Property CurrentlyFilteredItemsFLST AutoEvent SomeEvent()	If Criterion ; Remove ALL items		MoveEverything(Game.GetPlayer(), HoldingContainer)	ElseIf Something ; Give all items back/Revert filters and FLST		RemoveAllItems(Game.GetPlayer(), True, True)		Game.GetPlayer().AddInventoryEventFilter(CurrentlyFilteredItemsFLST)		CurrentlyFilteredItemsFLST.Revert()	EndIf	EndEventFunction MoveEverything(ObjectReference akDonor = None, ObjectReference akRecipient = None, Int aiListIndex = 0, Form akCurrentForm = None)	akDonor.RemoveAllItems(akRecipient, True, True)		If akDonor.GetItemCount(AllBethFilteredItemsFLST)		aiListIndex = AllBethFilteredItemsFLST.GetSize()		While aiListIndex			aiListIndex -= 1			akCurrentForm = AllBethFilteredItemsFLST.GetAt(aiListIndex)			If akDonor.GetItemCount(akCurrentForm)				CurrentlyFilteredItemsFLST.AddForm(akCurrentForm)				akDonor.RemoveInventoryEventFilter(akCurrentForm)				akDonor.RemoveItem(akCurrentForm, akDonor.GetItemCount(akCurrentForm), True, akRecipient)			EndIf		EndWhile	EndIfEndFunction 

Edit: Guess that's probably not it...

How did you figure out how many times the command was used? Is there a way to search for specific command usage throughout all scripts?


I read in a post somewhere that the game engine decides what and when items become quest items. If that's true, what would get rmoved in my game, may not get moved in yours.
Since I'm still quite new at papyrus, I've decided not to worry about it. Either it will get fixed with SKSE or not. I'm sure Bethesda won't deal with it.
Luckily, for me, a few items left in the player's inventory won't affect what I'm wanting to do and the extra code to "try" and find these orphans isn't worth the time to me.
Thanks for the tip on Unequip. I'm sure I would've had a tough time figuring that out.

Indeed, and you're probably right about the time required to figure out those items. I am not insanely devoted to finding the answer, but it does affect the immersion factor for my mod, so I'd personally like to figure it out one way or another.
User avatar
Lory Da Costa
 
Posts: 3463
Joined: Fri Dec 15, 2006 12:30 pm

Post » Wed Jun 20, 2012 9:20 pm

In Oblivion there was a cell (testinghall if I recall correctly) where all items ingame where stored for testing purposes. If there is something similar in Skyrim, you could use removeallitems in all those containers and then examine them who now which items have not been removed.
User avatar
Robyn Lena
 
Posts: 3338
Joined: Mon Jan 01, 2007 6:17 am

Post » Thu Jun 21, 2012 12:58 am

In Oblivion there was a cell (testinghall if I recall correctly) where all items ingame where stored for testing purposes. If there is something similar in Skyrim
QASmoke "Smoke Test Cell" [CELL:00032AE7]
How did you figure out how many times the command was used? Is there a way to search for specific command usage throughout all scripts?
By searching the Scripts\Source folder for the function with explorer. You have to set indexing up to look for text within documents.
User avatar
emily grieve
 
Posts: 3408
Joined: Thu Jun 22, 2006 11:55 pm

Post » Wed Jun 20, 2012 8:48 pm

I read in a post somewhere that the game engine decides what and when items become quest items. If that's true, what would get rmoved in my game, may not get moved in yours. Since I'm still quite new at papyrus, I've decided not to worry about it. Either it will get fixed with SKSE or not. I'm sure Bethesda won't deal with it. Luckily, for me, a few items left in the player's inventory won't affect what I'm wanting to do and the extra code to "try" and find these orphans isn't worth the time to me. Thanks for the tip on Unequip. I'm sure I would've had a tough time figuring that out.
.
This ties in with a similar problem. The http://www.gamesas.com/topic/1365043-possible-bugaboo-abremovequestitems-parameter-ignored/ and, judging by the response when I raised the issue, there are no workarounds to date.
.
And I *so* want to be wrong about this...
User avatar
KRistina Karlsson
 
Posts: 3383
Joined: Tue Jun 20, 2006 9:22 pm

Post » Wed Jun 20, 2012 6:06 pm

There are only 14 Beth scripts that use AddInventoryEventFilter(). I guess you could get a FormList together of all the filtered items, check after RemoveAllItems() which of those items are filtered (still remain), add them to a different FormList, remove the filter(s), then add a new filter for the second FormList when appropriate right before reverting it for the next time.
Spoiler
FormList Property AllBethFilteredItemsFLST Auto FormList Property CurrentlyFilteredItemsFLST Auto Event SomeEvent() If Criterion ; Remove ALL items MoveEverything(Game.GetPlayer(), HoldingContainer) ElseIf Something ; Give all items back/Revert filters and FLST RemoveAllItems(Game.GetPlayer(), True, True) Game.GetPlayer().AddInventoryEventFilter(CurrentlyFilteredItemsFLST) CurrentlyFilteredItemsFLST.Revert() EndIf EndEvent Function MoveEverything(ObjectReference akDonor = None, ObjectReference akRecipient = None, Int aiListIndex = 0, Form akCurrentForm = None) akDonor.RemoveAllItems(akRecipient, True, True) If akDonor.GetItemCount(AllBethFilteredItemsFLST) aiListIndex = AllBethFilteredItemsFLST.GetSize() While aiListIndex aiListIndex -= 1 akCurrentForm = AllBethFilteredItemsFLST.GetAt(aiListIndex) If akDonor.GetItemCount(akCurrentForm) CurrentlyFilteredItemsFLST.AddForm(akCurrentForm) akDonor.RemoveInventoryEventFilter(akCurrentForm) akDonor.RemoveItem(akCurrentForm, akDonor.GetItemCount(akCurrentForm), True, akRecipient) EndIf EndWhile EndIf EndFunction 
Edit: Guess that's probably not it...
.
What do we connect to:

FormList Property AllBethFilteredItemsFLST Auto
FormList Property CurrentlyFilteredItemsFLST Auto


In the properties window???
.
Thanks in Advance...
User avatar
luis dejesus
 
Posts: 3451
Joined: Sun Aug 19, 2007 7:40 am

Post » Wed Jun 20, 2012 9:48 pm

See http://www.creationkit.com/Talk:RemoveAllItems_-_ObjectReference for an update on this issue.
User avatar
Helen Quill
 
Posts: 3334
Joined: Fri Oct 13, 2006 1:12 pm

Post » Wed Jun 20, 2012 8:32 pm

See also http://www.gamesas.com/topic/1372021-wheres-the-script-that-controls-serving-jail-time/page__fromsearch__1 for an outline of how to make SendPlayerToJail() work correctly. I'll add more to the wiki when time permits.
User avatar
Nicole Coucopoulos
 
Posts: 3484
Joined: Fri Feb 23, 2007 4:09 am


Return to V - Skyrim