Tutorial 4: Supplies Chest (Placeable Containers)


Download the finished result of following this tutorial, for reference. Try creating the plug-in yourself first!

Download
Skill Level: Intermediate

This tutorial relies on knowledge gained in previous tutorials, and requires understanding the basics of navigating the Creation Kit.

In this tutorial, we will create a safe storage chest that the player can place wherever they like.

Creating placeable containers in Campfire is almost identical to creating regular placeable objects (like the chair in previous tutorials). The difference is that we will create a container reference that our placeable “container” will point to. We will put that container reference in a far-off cell (_Camp_ModPlaceableObjectCell). That way, the player can pick up and place the container without risk of losing items, and the player can place many containers which will all access the same centralized storage.

Getting Started

To start, open the Creation Kit with both Campfire and the Campfire Dev Kit installed. Select File, Data… and select Campfire.esm. This will make our plug-in require Campfire as a master. Select OK.

You may need to enable multiple master support in the Creation Kit if this is your first time using it. With the Creation Kit closed, in SkyrimEditor.ini (located in your Steam\steamapps\common\skyrim directory), under [General] , set  bAllowMultipleMasterLoads=1 and save the file. Add this line if it is not present.

The Inventory Item

Next, we will create the first of our 3 required objects, the inventory item.

Begin by selecting the MiscItem category in the Object Window. To create our inventory item, we’re going to use a default item that Campfire includes for modders to easily use.

Right-click _Camp_MiscItem_DefaultForModdersCOPYME, and select Duplicate. Then, select the miscitem you just created and press F2 to rename it. If asked if you would like to create a new form, select No, and confirm that you are sure.

The _Camp_MiscItem_DefaultForModdersCOPYME form comes with a default 3D mesh (a generic large sack) and the correct script attached for Campfire inventory items, CampPlaceableMiscItem.

If you are an advanced modder, feel free to create your own Misc Item form yourself, attach your own mesh, and attach the CampPlaceableMiscItem script yourself.

Double click your new Misc Item and name it AA_PlaceableChestMISC as shown below, and set some weight and value numbers. Don’t worry about the attached script; we’ll come back to it.


The Placement Indicator

Next, we will create the placement indicator. Select the Activators category of the Object Window. We will again use a form that Campfire gives us for free: _Camp_Indicator_DefaultForModdersCOPYME. Like before, duplicate this form, rename it, and double-click it. We’re going to name ours AA_PlaceableChestIndicator. See that your placement indicator looks similar to the one shown below.

Again, don’t worry about the attached script for now.

The _Camp_Indicator_DefaultForModdersCOPYME form comes with a default 3D mesh (a generic large sack) and the correct script attached for Campfire placement indicators, CampPlacementIndicator.

The Placeable Object

Now we will create the object that will actually be placed into the world. Create a new Activator object and set the ID to AA_PlaceableChest.

Now that we have our chest, we need to set a few things.

  • Set the Name to Supplies Chest.
  • Set the Activate Text Override to “Open”, which is more appropriate for a container.
  • Assign the upperchest01.nif mesh to the Activator. (This is a base game Skyrim mesh located in meshes/clutter/upperclass. Decompressing the Skyrim – Meshes.bsa archive is beyond the scope of this tutorial. See here for more info.)
  • For fun, we want our chest to be illegal to place in towns, cities, inns, and so on. To do this, we simply add a keyword. Right-click the Keywords box, select Add, and select isCampfireCrimeToPlaceInTowns. Click OK to add this keyword to the chest.
  • Lastly, attach the CampPlaceableContainer script to the form.

When you’re finished, your chest should look something like what’s shown below.


The Container Reference

We need to create a new container reference that will act as the “real” container that all placed containers of this type will point to. In the Object Window, navigate to Containers and duplicate BarrelEmpty01. Rename the copy as AA_PlaceableChestContainer.

IMPORTANT! Open the new container and uncheck the “Respawns” flag. If you fail to do this, the storage will not be safe, and the player will lose their items!

Drag and drop this new container into the _Camp_ModPlaceableObjectCell. Name the reference AA_PlaceableChestContainerRef.

Tying it All Together

We’re almost finished. We’ve created our 4 required objects, and now we will tie them together and set some parameters using the scripts attached to them.

Go back to the Misc Item category in the Object Window once again, and double-click the inventory item you created. Click the CampPlaceableMiscItem script attached to it, and select Properties.

There are a number of parameters that can be set here; you can mouse over them to read what they control. For this tutorial, we’re only interested in two properties:

  • Required_placement_indicator: Set this to the placement indicator form you created earlier.
  • Required_this_item: Set this to the inventory item itself.

Your properties window should look like the following.

After that, click OK and OK again on the Misc Item form to close it.

Next, select the Activators category in the Object Window and open your placement indicator. Select the attached CampPlacementIndicator script and click Properties.

Let’s set the following values:

  • indicator_distance: Set this to 150.0. This is the distance the indicator will float in front of the player.
  • Required_activator_to_place: Set this to the chest placeable object. We named ours AA_PlaceableChest.

Your properties window should look like the following.

Lastly, open your chest placeable object. Select the attached CampPlaceableContainer script and select Properties.

We need to set the Required_LinkedContainerRef property to the container reference we created earlier. We should also set the Setting_StartUpRotation property to 180, so the chest isn’t facing away from us when we place it. Configure as shown below.


Crafting

The final thing we need to do is make our chest acquirable by the player in-game. There are several ways to do this, but in this tutorial we will make our chest craftable when using a Forge with 10 firewood and 2 iron ingots.

Select the ConstructibleObject category of the Object Window and create a new ConstructibleObject like the one shown below.

Use the CraftingSmithingForge workbench keyword. Add the firewood and iron ingots to the Required Item List as shown below.


Placing the Chest

We can now Save the plug-in and try our creation in-game!

As expected, our chest appears in the Forge crafting system.

When we “Use” our chest in our inventory, the indicator appears and we can place it. Success!

When “Use” is selected, the chest’s inventory appears.

In this tutorial, you learned:

  • How to use CampPlaceableContainer to create a new placeable container item

Further Improvements:

  • Change the placement indicator to look like a chest by changing the indicator’s mesh. You’ll have to set the indicator’s z_angle_adjustment property to have the front of the chest face the player when placing it.
  • Just like CampTentEx and CampPlaceableObjectEx, there is a CampPlaceableContainerEx, which allows you to use position references to place more complex container objects consisting of several parts.

Good luck, and happy modding!

To release your creations as your own Campfire-powered mod, please review the License page for important details.

Have fun,

 – Chesko