Jump to content

Tutorial for creating a chest, box, etc. with specific items inside, or adding items in bulk?


teresatiger

Recommended Posts

Hi, I'd love to know if there is a really in-depth step-by-step tutorial for how to create some sort of container, put it in a particular location (namely the opening prison and/or the room with the mara statue for Live Another Life), and place a bunch of items into it, whether vanilla, mod-added or otherwise.

 

Basically, I'd like a sort of quick-access container when starting a game, which will allow me to add all of my favorite clothing items and weapons without having to use the addmenuitem mod to go and manually add them to my inventory one by one.

 

Alternatively, if there is a way to set up a spell or item to either spawn such a container wherever you are in the world, or simply auto-add all of the desired items to my inventory upon casting/using, I would love to know that as well.

 

Does anyone know where I can find a tutorial for beginners on how to do this sort of thing?

 

Thanks so much!

Link to comment
Share on other sites

Not exactly beginner but is the best I can come up with off the top of my head...

 

Add chest to LAL start area with stuff pre-loaded:

 

Open the Creation Kit

Find the player house chest (the one used in all the stock homes)

Duplicate it.

Drag and drop all stock items you want to appear in that chest directly to the base form's inventory section

Save your plugin

Exit the Creation Kit

 

If using SSE: Apply SSE CreationKit Fixes as it will allow you to use ESP files as master files without any trickery or follow SLE instructions.

If using SLE: Run Wrye Bash (WB), right click on LAL plugin and choose "ESMIFY", Exit WB, Open the Creation Kit, Load both the LAL plugin and yours with yours marked as active. Place your container in the LAL starting cell added to the Abandoned Prison, Save the plugin and exit the Creation Kit. Run WB, right click on the LAL plugin and choose "ESPIFY", exit WB, fix load order as needed in your mod manager.

 

Run TES5Edit / SSEEdit

Let every mod you intend to play with be active

Open your plugin's record tree and find your container

Right click in the inventory section and add new

Double click to get a drop down and scroll the list for whatever object you want to add.

Repeat for every mod object you want in the container.

When done exit TES5Edit / SSEEdit and let it save your plugin.

 

Your plugin should now have multiple master files and most likely need to be at the very bottom of your load order (at least below LAL).

 

Do not open your plugin in the Creation Kit again without doing the "esmify" trick for every parent master plugin or you will loose those changes. Unless of course you are using the SSE CK and have the SSE CK fixes linked above installed.

 

 

Use spell to access a container with pre-loaded stuff:

 

Open the Creation Kit

Find the player house chest (the one used in all the stock homes)

Duplicate it.

Create a new interior cell
Drag and drop your container
Create a new magic effect of the script type
Create a new spell that calls the magic effect
Add a script to the magic effect
Scriptname RemoteOpenContainer Extends ActiveMagicEffect
 
ObjectReference  Property  TheContainer  = None Auto
 
Event OnEffectStart(Actor akTarget, Actor akCaster)
  TheContainer.Activate(Game.GetPlayer())
EndEvent
Assign the instance of the container as found in your new cell to the TheContainer property (or re-write it to use the same EditorID name as your container and fill by pressing the Auto-fill button)
Save the plugin and exit the Creation Kit

Run TES5Edit / SSEEdit

Let every mod you intend to play with be active

Open your plugin's record tree and find your container

Right click in the inventory section and add new

Double click to get a drop down and scroll the list for whatever object you want to add.

Repeat for every mod object you want in the container.

When done exit TES5Edit / SSEEdit and let it save your plugin.

 

Your plugin should now have multiple master files and most likely need to be at the very bottom of your load order (at least below the last mod in the parent list).

 

Do not open your plugin in the Creation Kit again without doing the "esmify" trick for every parent master plugin (as outlined in the "Add chest to LAL start area with stuff pre-loaded" section) or you will loose those changes. Unless of course you are using the SSE CK and have the SSE CK fixes installed (linked in the "Add chest to LAL start area with stuff pre-loaded" section).

 

 

Add all desired items directly to inventory:

 

Easiest would be to create a batch file to run through the console.

Use Notepad to create a plain TXT file.

Give it a short descriptive name

Example: myItems.txt

Edit the file use the following syntax and change as needed

player.additem FormID Quantity

 

player - tells the game who to work with

additem - tells the game what is being done

FormID - is the ID# of the desired item must include correct load order value in the first two characters

Quantity - is how many of the FormID to add

Example: player.additem 0933D8CB 1

Adds one Coral - Red to the player. LegacyoftheDragonborn.esm is at hex load order position 09 in my current load order and the item xx33D8CB corresponds to DBM_SeaCoralRed or Coral - Red in-game.

 

You can obtain the current FormID of an object by loading your entire active mod list in TES5Edit / SSEEdit and looking up the object under the appropriate mod.

 

To actually run this, open the console, type bat myitems.txt and press enter. Afterwards all the items should start being added to the player inventory.

 

 

All that said, it is possible to script something that will add all the desired items to a container or to the player without needing to have all the various mods as parent masters and so that one or more mods could be removed for a new game without having to re-do anything. We can delve this route if you wish but I did not want to go into it now until you've gotten a feel for the other routes first.

Edited by IsharaMeradin
Link to comment
Share on other sites

Thank you! A summonable chest would be the most fun but I think the last option for a bulk console command would be easiest, and also the easiest to edit/update, so I may go with that. Unless I can learn how to edit a player home to have such a chest and set a fast travel marker for the location and put my custom followers there too lol. I will go through all three of the options and see what I can manage and what makes the most sense. Thank you so much for taking the time to write all that out!

 

And if anyone knows of some really in-depth tutorials for someone who's barely opened CK, I would welcome any links too! There's no such thing as too many examples when you have no idea what you're doing :-)

Link to comment
Share on other sites

Well, I was a little wrong. The batch file needs to have a TXT extension. It is ran in the console with the bat command. The file should be located in the Data folder. See the following for further instructions and example usage: http://en.uesp.net/wiki/Skyrim:Console#Using_Batch_Files_with_the_bat_Command

 

I'll update the previous post just so there is no confusion with anyone coming along later...

Link to comment
Share on other sites

Hey, just thought I'd put in my 2 cents. Using a batch file will work, but only if your load order is exactly the same between saves. If you change your load order by adding or removing mods, the form IDs can change and then adding items with the batch file won't work, (I recently had a problem with this.) Since you're wanting to add items from different mods at the start of the game, I think using a script with GetFormFromFile would be the way to go, because that's not dependent on your load order. Since I was also wanting a simple way to do this, I wrote this script, which will find and print the form id's and mod names for all of the items currently in your inventory to a user log. User logs are in documents\My Games\Skyrim\Logs\Script\User.

 

I put the script on a custom spell. Note it does require SKSE but I figured this wouldn't be a problem because you have AddItemMenu.

 

 

Scriptname TM_PrintPlayerItemIds extends ActiveMagicEffect 

Actor Property PlayerRef Auto

String[] Property HexDigits Auto
Int[] Property NegativeDecDigits Auto
    
Event OnEffectStart(Actor akTarget, Actor akCaster)
    ;Debug.Notification("Start Printing")
    HexDigits = New String[16]
    HexDigits[0] = "0"
    HexDigits[1] = "1"
    HexDigits[2] = "2"
    HexDigits[3] = "3"
    HexDigits[4] = "4"
    HexDigits[5] = "5"
    HexDigits[6] = "6"
    HexDigits[7] = "7"
    HexDigits[8] = "8"
    HexDigits[9] = "9"
    HexDigits[10] = "a"
    HexDigits[11] = "b"
    HexDigits[12] = "c"
    HexDigits[13] = "d"
    HexDigits[14] = "e"
    HexDigits[15] = "f"
    
    NegativeDecDigits = New Int[16]
    NegativeDecDigits[0] = -15
    NegativeDecDigits[1] = -14
    NegativeDecDigits[2] = -13
    NegativeDecDigits[3] = -12
    NegativeDecDigits[4] = -11
    NegativeDecDigits[5] = -10
    NegativeDecDigits[6] = -9
    NegativeDecDigits[7] = -8
    NegativeDecDigits[8] = -7
    NegativeDecDigits[9] = -6
    NegativeDecDigits[10] = -5
    NegativeDecDigits[11] = -4
    NegativeDecDigits[12] = -3
    NegativeDecDigits[13] = -2
    NegativeDecDigits[14] = -1
    NegativeDecDigits[15] = 0

    Debug.OpenUserLog("PlayerItemIDs")
    Int M = PlayerRef.GetNumItems()
    While M > 0
        M -= 1 
        Form Item = PlayerRef.GetNthForm(M)
        Int DecId = Item.GetFormId()
        String DecIdS = DecId as String
        String HexId = ConvertIDToHex(DecId)
        String hexIdB = StringUtil.Substring(HexId, 0, 2)
        String hexIdC = ("0x" + StringUtil.Substring(HexId, 2, -1))
        Int LO_Index = Convert2DigitHexToDecimal(hexIdB)
        
        ;If M == 2 || M == 1 || M == 0
        ;    Debug.MessageBox(Item.GetName() + " LO_Index = " + LO_Index)
        ;    Utility.Wait(0.1)
        ;    ;PlayerRef.AddItem(Game.GetFormFromFile((hexIdC as hexidecimal), ModName), 1)
        ;Endif 
        
        String ModName = "'" + Game.GetModName(LO_Index) + "'"
        Debug.TraceUser("PlayerItemIDs", ("PlayerRef.AddItem(" + "Game.GetFormFromFile(" + hexIdC + ", " + ModName + "), 1) ;" + Item.GetName()))   
        
    EndWhile
    
    Debug.CloseUserLog("PlayerItemIDs")
    Debug.MessageBox("Done Printing")
EndEvent

Int Function Convert2DigitHexToDecimal(String Hex) 
    Return (HexDigits.Find(StringUtil.GetNthChar(Hex, 0)) * 16) + hexDigits.Find(StringUtil.GetNthChar(Hex, 1))
EndFunction

String function ConvertIDToHex(Int m)
;---------------------------------------------------------------
; convert integer (i10) into hexstring with count of 8 numbers
; sample: 842 -> "0000034A"

; 842  = 8*10² + 4*10 + 2*1        ; base 10
; 34Ah = 3*16² + 4*16 + A*1        ; base 16

    If m >= 0

        string s

        int v = 0x10000000            ; init divisor
            While (v > 0)
                int j = m / v
                s += HexDigits[j]
                
                m = m % v            ; new remainder as result of modulo


                If (v > 1)
                    v = v / 16       ; new divisor
                Else
                    v = 0            ; 1 / 16 = ?    safety first
                Endif
            Endwhile
            
        Return (s)
    Else
        m += 1
        string s
        
        int v = 0x10000000            ; init divisor
            While (v > 0)
                int j = m / v
                
                s += HexDigits[(NegativeDecDigits.Find(j))]

                m = m % v            ; new remainder as result of modulo

                If (v > 1)
                    v = v / 16       ; new divisor
                Else
                    v = 0            ; 1 / 16 = ?    safety first
                Endif
            Endwhile
            
        return (s)
    Endif 
EndFunction

 

The printed log this script creates will look something like this:

 

 

 

[12/21/2020 - 11:21:08PM] PlayerItemIDs log opened (PC)
[12/21/2020 - 11:21:08PM] PlayerRef.AddItem(Game.GetFormFromFile(0x033069, 'Triple Triad Skyrim.esp'), 1) ;Triple Triad Info
[12/21/2020 - 11:21:08PM] PlayerRef.AddItem(Game.GetFormFromFile(0x013D99, 'Recorder Follower Base.esp'), 1) ;Summon Recorder
[12/21/2020 - 11:21:08PM] PlayerRef.AddItem(Game.GetFormFromFile(0x027490, 'Dragonborn.esm'), 1) ;Glowing Spider
[12/21/2020 - 11:21:08PM] PlayerRef.AddItem(Game.GetFormFromFile(0x064B2F, 'Skyrim.esm'), 1) ;Green Apple
[12/21/2020 - 11:21:08PM] PlayerRef.AddItem(Game.GetFormFromFile(0x03EADE, 'Skyrim.esm'), 1) ;Potion of Healing
[12/21/2020 - 11:21:08PM] PlayerRef.AddItem(Game.GetFormFromFile(0x013989, 'Skyrim.esm'), 1) ;Steel Sword
[12/21/2020 - 11:21:08PM] PlayerRef.AddItem(Game.GetFormFromFile(0x0F6F23, 'Skyrim.esm'), 1) ;Steel Imperial Gauntlets
[12/21/2020 - 11:21:08PM] PlayerRef.AddItem(Game.GetFormFromFile(0x0F6F24, 'Skyrim.esm'), 1) ;Steel Horned Helmet
[12/21/2020 - 11:21:08PM] PlayerRef.AddItem(Game.GetFormFromFile(0x0F6F22, 'Skyrim.esm'), 1) ;Steel Armor
[12/21/2020 - 11:21:08PM] PlayerRef.AddItem(Game.GetFormFromFile(0x0F6F21, 'Skyrim.esm'), 1) ;Steel Shin Boots
[12/21/2020 - 11:21:08PM] PlayerRef.AddItem(Game.GetFormFromFile(0x005149, 'Triple Triad Skyrim.esp'), 1) ;TT Alduin
[12/21/2020 - 11:21:08PM] PlayerRef.AddItem(Game.GetFormFromFile(0x1A4BF0, 'Triple Triad Skyrim.esp'), 1) ;Gunblade
[12/21/2020 - 11:21:08PM] PlayerRef.AddItem(Game.GetFormFromFile(0x1A4BFE, 'Triple Triad Skyrim.esp'), 1) ;Gunblade Bullet
[12/21/2020 - 11:21:08PM] PlayerRef.AddItem(Game.GetFormFromFile(0x0A7894, 'Triple Triad Skyrim.esp'), 1) ;Triple Triad Cards
[12/21/2020 - 11:21:09PM] PlayerRef.AddItem(Game.GetFormFromFile(0x0D00B5, 'Triple Triad Skyrim.esp'), 1) ;Triple Triad Card Pack
[12/21/2020 - 11:21:09PM] PlayerRef.AddItem(Game.GetFormFromFile(0x003A49, 'Triple Triad Skyrim.esp'), 1) ;TT Albino Spider
[12/21/2020 - 11:21:09PM] PlayerRef.AddItem(Game.GetFormFromFile(0x003A4c, 'Triple Triad Skyrim.esp'), 1) ;TT Bear
[12/21/2020 - 11:21:09PM] PlayerRef.AddItem(Game.GetFormFromFile(0x00515c, 'Triple Triad Skyrim.esp'), 1) ;TT Felsaad Tern
[12/21/2020 - 11:21:09PM] PlayerRef.AddItem(Game.GetFormFromFile(0x0D00B3, 'Triple Triad Skyrim.esp'), 1) ;Triple Triad Board
[12/21/2020 - 11:21:09PM] PlayerRef.AddItem(Game.GetFormFromFile(0x00000F, 'Skyrim.esm'), 1) ;gold
[12/21/2020 - 11:21:09PM] Log closed

You'll have to edit the log to put it in a new script. Use a text editor like Notepad++ and use the replace all function to replace all of the dates with nothing, and replace all of the ' symbols with " (I'm not sure how to put quotes " in a string in papyrus), so that it looks like

PlayerItemIDs log opened (PC)
PlayerRef.AddItem(Game.GetFormFromFile(0x033069, "Triple Triad Skyrim.esp"), 1) ;Triple Triad Info
PlayerRef.AddItem(Game.GetFormFromFile(0x013D99, "Recorder Follower Base.esp"), 1) ;Summon Recorder
PlayerRef.AddItem(Game.GetFormFromFile(0x027490, "Dragonborn.esm"), 1) ;Glowing Spider
PlayerRef.AddItem(Game.GetFormFromFile(0x064B2F, "Skyrim.esm"), 1) ;Green Apple
PlayerRef.AddItem(Game.GetFormFromFile(0x03EADE, "Skyrim.esm"), 1) ;Potion of Healing
PlayerRef.AddItem(Game.GetFormFromFile(0x013989, "Skyrim.esm"), 1) ;Steel Sword
PlayerRef.AddItem(Game.GetFormFromFile(0x0F6F23, "Skyrim.esm"), 1) ;Steel Imperial Gauntlets
PlayerRef.AddItem(Game.GetFormFromFile(0x0F6F24, "Skyrim.esm"), 1) ;Steel Horned Helmet
PlayerRef.AddItem(Game.GetFormFromFile(0x0F6F22, "Skyrim.esm"), 1) ;Steel Armor
PlayerRef.AddItem(Game.GetFormFromFile(0x0F6F21, "Skyrim.esm"), 1) ;Steel Shin Boots
PlayerRef.AddItem(Game.GetFormFromFile(0x005149, "Triple Triad Skyrim.esp"), 1) ;TT Alduin
PlayerRef.AddItem(Game.GetFormFromFile(0x1A4BF0, "Triple Triad Skyrim.esp"), 1) ;Gunblade
PlayerRef.AddItem(Game.GetFormFromFile(0x1A4BFE, "Triple Triad Skyrim.esp"), 1) ;Gunblade Bullet
PlayerRef.AddItem(Game.GetFormFromFile(0x0A7894, "Triple Triad Skyrim.esp"), 1) ;Triple Triad Cards
PlayerRef.AddItem(Game.GetFormFromFile(0x0D00B5, "Triple Triad Skyrim.esp"), 1) ;Triple Triad Card Pack
PlayerRef.AddItem(Game.GetFormFromFile(0x003A49, "Triple Triad Skyrim.esp"), 1) ;TT Albino Spider
PlayerRef.AddItem(Game.GetFormFromFile(0x003A4c, "Triple Triad Skyrim.esp"), 1) ;TT Bear
PlayerRef.AddItem(Game.GetFormFromFile(0x00515c, "Triple Triad Skyrim.esp"), 1) ;TT Felsaad Tern
PlayerRef.AddItem(Game.GetFormFromFile(0x0D00B3, "Triple Triad Skyrim.esp"), 1) ;Triple Triad Board
PlayerRef.AddItem(Game.GetFormFromFile(0x00000F, "Skyrim.esm"), 1) ;gold
Log closed

Then you can easily create a script that adds all of those items to your inventory at the start of the game. Make a new script that extends quest, looks something like this:

Scriptname AddItemsInitScript extends Quest 


Actor Property PlayerRef Auto 


Event OnInit()
    Utility.Wait(1)
    PlayerRef.AddItem(Game.GetFormFromFile(0x033069, "Triple Triad Skyrim.esp"), 1) ;Triple Triad Info
    PlayerRef.AddItem(Game.GetFormFromFile(0x013D99, "Recorder Follower Base.esp"), 1) ;Summon Recorder
    PlayerRef.AddItem(Game.GetFormFromFile(0x027490, "Dragonborn.esm"), 1) ;Glowing Spider
    PlayerRef.AddItem(Game.GetFormFromFile(0x064B2F, "Skyrim.esm"), 1) ;Green Apple
    PlayerRef.AddItem(Game.GetFormFromFile(0x03EADE, "Skyrim.esm"), 1) ;Potion of Healing
    PlayerRef.AddItem(Game.GetFormFromFile(0x013989, "Skyrim.esm"), 1) ;Steel Sword
    PlayerRef.AddItem(Game.GetFormFromFile(0x0F6F23, "Skyrim.esm"), 1) ;Steel Imperial Gauntlets
    PlayerRef.AddItem(Game.GetFormFromFile(0x0F6F24, "Skyrim.esm"), 1) ;Steel Horned Helmet
    PlayerRef.AddItem(Game.GetFormFromFile(0x0F6F22, "Skyrim.esm"), 1) ;Steel Armor
    PlayerRef.AddItem(Game.GetFormFromFile(0x0F6F21, "Skyrim.esm"), 1) ;Steel Shin Boots
    PlayerRef.AddItem(Game.GetFormFromFile(0x005149, "Triple Triad Skyrim.esp"), 1) ;TT Alduin
    PlayerRef.AddItem(Game.GetFormFromFile(0x1A4BF0, "Triple Triad Skyrim.esp"), 1) ;Gunblade
    PlayerRef.AddItem(Game.GetFormFromFile(0x1A4BFE, "Triple Triad Skyrim.esp"), 1) ;Gunblade Bullet
    PlayerRef.AddItem(Game.GetFormFromFile(0x0A7894, "Triple Triad Skyrim.esp"), 1) ;Triple Triad Cards
    PlayerRef.AddItem(Game.GetFormFromFile(0x0D00B5, "Triple Triad Skyrim.esp"), 1) ;Triple Triad Card Pack
    PlayerRef.AddItem(Game.GetFormFromFile(0x003A49, "Triple Triad Skyrim.esp"), 1) ;TT Albino Spider
    PlayerRef.AddItem(Game.GetFormFromFile(0x003A4c, "Triple Triad Skyrim.esp"), 1) ;TT Bear
    PlayerRef.AddItem(Game.GetFormFromFile(0x00515c, "Triple Triad Skyrim.esp"), 1) ;TT Felsaad Tern
    PlayerRef.AddItem(Game.GetFormFromFile(0x0D00B3, "Triple Triad Skyrim.esp"), 1) ;Triple Triad Board
    PlayerRef.AddItem(Game.GetFormFromFile(0x00000F, "Skyrim.esm"), 1) ;gold
    Utility.Wait(1) 
    Self.Stop() ;stops this quest.
EndEvent

Put the script on a new quest that's start game enabled.
Note that in order for this to work, you have to enable logging. Here's an explanation of how: https://www.nexusmods.com/skyrim/articles/368/
Edited by dylbill
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...