Skill Level: Intermediate
This tutorial relies on knowledge gained in previous tutorials, and requires understanding the basics of navigating the Creation Kit.
In the last tutorial, we created a more complex multi-part object using the CampPlaceableObjectEx script. Now we will use that knowledge to create a tent.
A Tent, in Campfire terminology, is any placeable object that:
- Is an activator,
- Could be thought of as a portable shelter for the player,
- Has a place to sit and sleep
That, loosely, is a “tent” in Campfire terms. The object you create does not literally have to look like a tent.
Tents are more sophisticated than simple Placeable Objects. Several “services” are provided for you by the script without any extra work:
- It automatically uses the tent message prompt, allowing the player to sit, sleep, and toggle a lantern on and off,
- The sit and sleep furniture markers are placed for you automatically,
- Lanterns automatically work, just supply a position reference for them (you don’t even need to set up a light object like in the last tutorial, this is done for you as well)
- You can place markers around your shelter that will allow the player to remove their weapons and armor and place them around the shelter when they sit or sleep. This behavior is handled by Campfire.
- And more, including supplying “snowy” versions of the exterior of the shelter if you have them, which will get toggled on at the appropriate times.
Now that we know what a “tent” is, let’s create one. We’re going to build a wooden lean-to shack for the player to rest in.
Shack Me
Begin by creating a new inventory item and placement indicator, as shown in Tutorial 1. Duplicate the default “ForModdersCOPYME” objects to speed up this process. We will name ours _Tutorial_ShelterMiscItem and _Tutorial_Indicator_Shelter. Go ahead and create a ConstructibleObject for the MiscItem as well, so we can craft it later.
Next, we need to create the bedroll that the player will interact with in-game. This object will also control the placement of all the objects, just like chair with CampPlaceableObjectEx did. For the sake of argument, this bedroll activator “is” the tent to Campfire.
To do this, duplicate _Camp_Tent_SmallFur1BR_ACT. We can use this as a base to build from. We’ll rename ours _Tutorial_WoodenShelter.
This object already has the script we want, CampTent, but all of the properties are pointing at things we don’t want. Remove the CampTent script and re-add it so we can start fresh.
Frostfall Compatibility
You’ll notice the keyword isCampfireCrimeToPlaceInTowns attached to the object, like our chair had. It also has isCampfireTentWarm. This is a special keyword that will be used by Frostfall 3.0 to determine if this shelter is “warm” or not (like fur tents are today). There is also a isCampfireTentWaterproof, like leather tents behave currently.
Use isCampfireTentWarm and isCampfireTentWaterproof to ensure compatibility with Frostfall 3.0. You can use either, both, or none, depending on the properties you want your shelter to have.
Position References
In the Cell View window, open the _Camp_ModTentCell. This is another blank cell you can use specifically for tents, to keep things tidy.
Inside the cell, drag in a Bedroll01 furniture object.
Next, drag in a StockadeLeanTo01 to act as our shelter. Position it something like shown below.
Finally, we will place some specific clutter items that will give us some features unique to tents.
- Drop in a CandleLanternWithCandle01. You don’t have to worry about dropping in a light source; the tent will do that for you.
- Drop in an IronSword weapon somewhere near the bed roll. This will be where the player’s main-hand (1-handed) weapon will be displayed.
- Drop in an ArmorIronHelmet somewhere near the bed roll. This will be where the player’s helmet will be displayed when the player is “in” the tent (sitting or sleeping).
When you’re finished you should have something similar to the below.
That’s all of the objects you need to stage for this tent. Take this time to name all of your references. We will use the following names:
- _Tutorial_PosRef_ShelterBedroll
- _Tutorial_PosRef_ShelterHelmet
- _Tutorial_PosRef_ShelterLantern
- _Tutorial_PosRef_ShelterLeanTo
- _Tutorial_PosRef_ShelterMainWeapon
Hooking Up Properties
Open your inventory item for the shelter and open the properties of CampPlaceableMiscItem. Configure yours as shown below.
We need to add the keyword isCampfireTentItem to the MiscItem as well. This lets the backpack system know that it should display a bed roll on the backpacks included in Campfire when we have this item in our inventory.
Open the placement indicator and open the properties of CampPlacementIndicator. Configure as shown.
Time to configure the properties on our tent. Open the placeable object shelter activator we created and open the properties of CampTent. It should now (hopefully) be fairly intuitive what needs to be filled out. Configure yours as shown below.
I Think We Broke It
Save your plug-in and give it a try in-game.
So we place our Wooden Shelter and… oh. That’s not good.
What went wrong?
This is a bit of a technical discussion, but this might be helpful info if you run into this problem in your own projects. By default, Campfire will try to use the “shelter” object first as the thing to place everything else around. It is the “origin” around which everything else “orbits”.
Look closely at the lean-to model in the Creation Kit:
See that cross? That indicates where the “center” of this model is. Campfire will try to place the “center” object’s model with the center at ground-level, and in this case the results are bad.
Thankfully, we can fix this. Open the CampTent properties of our shelter activator and select PositionRef_CenterObjectOverride. Set this to the position reference of the bedroll instead. This should fix the problem; objects will now be placed around it, instead.
Save your plug-in and test it in-game once again.
Much better! It works!
Try sitting and sleeping in your tent, and interacting with the lantern. That should all work as well. Our main weapon and helmet are also displayed.
In Conclusion…
Congratulations! You have completed the Campfire Dev Kit tutorial series. In this tutorial, we:
- Learned how to create a new basic “tent”
- Learned that Campfire does a lot for us automatically with tents,
- Learned how to create and hook up markers for the player’s equipment to be displayed around a shelter,
- Learned how to ensure compatibility with Frostfall 3.0 using the isCampfireTentWarm and isCampfireTentWaterproof keywords
- Learned how to debug a problem by using a center object override property.
Further Improvements:
- Open the _Camp_CampfireTentCell and see how full-fledged Campfire tents look with all markers and properties hooked up, for full functionality,
- Review the CampUtil and script documentation,
- Try using CampTentEx to set up a host of extra features, like bed rolls for your followers (which they will automatically use when you sit or sleep in your bed roll; Campfire does that for you, as well)
Head on to the next tutorial to learn how to create a portable supply chest for your campsite.