Confiscating player inventory, including equipped items

Post » Wed Sep 30, 2015 4:17 am

Hi everyone,

I was wondering if there is a simple way to script the stripping of the player's entire inventory into a container?

I've looked up how the guards do it when they throw a player into prison in the quest "DialogueCrimeGuards". They use the http://www.creationkit.com/SendPlayerToJail_-_Faction function:

akSpeaker.GetCrimeFaction().SendPlayerToJail(abRemoveInventory=True, abRealJail=True)

I know that I could use this function if I was to http://www.creationkit.com/Creating_a_Custom_Crime_Faction. But that seems a little long winded for my purposes. Additionally my intended use has the context of the player being taken hostage, rather than being arrested.

If you have a simpler solution, let me know!

Thanks,

Allan

User avatar
Leonie Connor
 
Posts: 3434
Joined: Mon Mar 12, 2007 4:18 pm

Post » Tue Sep 29, 2015 8:13 pm

The best solution would probably be 'RemoveAllItems', but it seems that the function doesn't work 100% correctly according to the Wiki; apparently it can break ItemOwnership and won't remove QuestItems... Hence, why Beth, apparently uses the Jail option, instead.

I suppose you could cycle through all the Player's Items, but... That seems like it would be ridiculously long-winded, too :/ (And I can't even remember for sure if you can do that in Skyrim... I'm like 95% sure it's possible, but... :/ )

User avatar
Lew.p
 
Posts: 3430
Joined: Thu Jun 07, 2007 5:31 pm

Post » Wed Sep 30, 2015 1:33 am

Thanks CDM, I can't believe I didn't come across this function when searching.

If the function prototype is:

Function RemoveAllItems(ObjectReference akTransferTo = None, bool abKeepOwnership = false, bool abRemoveQuestItems = false) native

...and I'm not too bothered with quest items, this should work for me right?:

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

The breaking of item ownership would result in the items being 'Stolen' items when the player goes to retrieve them from the chest they've been placed into?

User avatar
Wayne W
 
Posts: 3482
Joined: Sun Jun 17, 2007 5:49 am


Return to V - Skyrim