Hello visitor! A note about the contents of this wiki: Barotrauma is a game with several years' worth history as a free-download open source game, and this wiki has been written primarily based on this legacy version. As such, not all content is relevant to the Steam release. So please wait patiently as the contents are updated, and feel free to contribute new information once the Steam version of Barotrauma is released!
Guide:Creating a Content Package
|This article is outdated.
You can help the Barotrauma Wiki by updating it.
- This guide is designed for use with Windows operating systems. Information on other operating systems will vary.
Creating a Content Package from scratch may seem like a difficult task, but once you understand the basics it becomes easy. This tutorial is here to help new users create their first Content Package.
In this example, we will be creating a melee weapon.
Beginning[edit | edit source]
Before we can start creating content, we need to define the Content Package. Find a folder called Content Packages in the Data folder in your Barotrauma directory (it should look like this: \Barotrauma 0.10.4.0\Data\ContentPackages) and copy & paste the file called "Vanilla 0.8". Once you have your new copy, name it "Unarmed", then right click on it and click "Edit".
Immediately, you'll see a lot of lines of code, all defining file paths. This is how the game knows where to find content. For now, we'll just be looking at the second line. It should look like this:
<contentpackage name="Vanilla 0.8" path="Data/ContentPackages/Vanilla 0.8">
Now let's change it to look like this:
<contentpackage name="Unarmed" path="Data/ContentPackages/Unarmed">
Once you're done, save the file, but don't close out of it - we'll need to change it later.
Content[edit | edit source]
Setting up the Folder[edit | edit source]
After we've defined the Content Package, we need to create a content folder for it. This is actually rather easy - navigate to \Barotrauma 0.10.4.0\Mods and create a new folder there, named "Unarmed". This will henceforth be referred to as the Mod Folder.
Creating our Weapon[edit | edit source]
In order to create our weapon, we'll be learning from existing code. Navigate to \Barotrauma 0.10.4.0\Content\Items\Weapons and find two files: weapons.xml and weapons.png. Copy and paste them both into the Mod Folder.
Once they're in place, right-click on weapons.xml and click "Edit". Much like our Content Package definition, you'll be met with many lines of code - scroll down until get to the bottom. Once there, copy and paste the following code just above the line that says </Items>:
<Item name="Unarmed" category="Equipment" Tags="smallitem,weapon" pickdistance="150" price="5" description="Pow! If you don't have a Harpoon Gun on you, why not just use your fists?"> <Deconstruct time="0"> </Deconstruct> <Sprite texture="weapons.png" sourcerect="21,0,77,22" depth="0.55"/> <Body width="30" height="30" density="30"/> <MeleeWeapon slots="Any,RightHand,LeftHand" aimpos="50,0" handle1="-5,0" holdangle="10" reload="0.3"> <Attack damage="20" stun="1" damagetype="Blunt" sound="Content/Items/Weapons/smack.ogg"/> </MeleeWeapon> </Item>
Then save the file and exit.
Defining our Weapon[edit | edit source]
Before it can be found in-game, you need to define the weapon. Head on over to the Content Package definition we created in the beginning of the tutorial. You'll need to find a line just over halfway through the code that looks like this:
<Item file="Content/Items/Weapons/weapons.xml" />
Change it to look like this:
<Item file="Mods/Unarmed/weapons.xml" />
Then save the file one last time.
Playing[edit | edit source]
After you've completed the previous steps, open up the Barotrauma Launcher and press the "Content package" button. Select "Unarmed" from the dropdown menu that opens up. Then, press the big grey 'START' button. If all goes well, the game feels like playing nice and you followed the guide, it should launch with no problems.
FAQ[edit | edit source]
- Q: I can't find \Barotrauma 0.10.4.0!
- A: The version number (ideally 0.10.4.0) is probably different on your computer, and shouldn't be too hard to find.
- Q: Barotrauma crashed while playing the Content Package!
- A: This happens regularly. Barotrauma is an unpolished game, and is very prone to bugs - crashes with Content Packages are to be expected.
- Q: Where can I find the content I implemented?
- A: Items can be found in the pre-level Shop (if you gave them a Price value) or can be placed in the Submarine Editor.
- Q: What about creatures?
- A: Creatures are, obviously, a different matter entirely. You'll have to create a new Random Events file and some other things. The guide will likely be updated in the future to reflect creatures.
- Q: The unarmed weapon is invisible!
- A: That is indeed the nature of unarmed weaponry. If you want to give it a sprite, you are free to do so yourself. This guide does not currently cover spriting, but will likely be updated to do so in the future.
- Q: How do I use the unarmed weapon?
- A: Once it is in either of your hand slots, right click to ready it and then left click to throw a punch.