Remove X Number of Random Items From Inventory

Post » Sat Nov 17, 2012 4:02 am

Like the title says, how do I remove x number of random items from the player's inventory?
User avatar
maya papps
 
Posts: 3468
Joined: Mon Aug 07, 2006 3:44 pm

Post » Sat Nov 17, 2012 1:47 am

Use SKSE to loop over the forms in the inventory and put them in a formlist.

randomly pick a slot in the formlist.

use the form in that slot to remove the item from the player's inventory

repeat a random number of times
User avatar
Lori Joe
 
Posts: 3539
Joined: Tue Jun 20, 2006 6:10 am

Post » Sat Nov 17, 2012 8:07 am

Like the title says, how do I remove x number of random items from the player's inventory?

I agree with DocClox on SKSE use, not on the method.

Try to make the player reference an object reference and use http://www.creationkit.com/GetNumItems_-_ObjectReference SKSE function, make a random number based on the index gained and use http://www.creationkit.com/ObjectReference_Script to point at the item and GetItemCount...and then a random number between 1 and the number of items to define how many items remove.
User avatar
Cathrine Jack
 
Posts: 3329
Joined: Sat Dec 02, 2006 1:29 am

Post » Sat Nov 17, 2012 4:24 am

Agreed. That's much better.
User avatar
Pat RiMsey
 
Posts: 3306
Joined: Fri Oct 19, 2007 1:22 am

Post » Sat Nov 17, 2012 3:11 am

Thanks everybody. The help is greatly appreciated. However, I have one, uhm, probably silly question, but how do I compile the Papyrus script with SKSE functions/methods? I always get a compile error in CK... :confused:
User avatar
Ross
 
Posts: 3384
Joined: Thu Aug 10, 2006 7:22 pm

Post » Sat Nov 17, 2012 6:23 am

Have you downloaded and installed SKSE?

There are a pile of amended scripts that need to be copied into your data/scripts folder. It should happen as part of the normal install process.
User avatar
A Boy called Marilyn
 
Posts: 3391
Joined: Sat May 26, 2007 7:17 am


Return to V - Skyrim