v50 Steam/Premium information for editors
  • v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
  • Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.

Editing 40d:Modding guide

Jump to navigation Jump to search

Warning: You are not logged in.
Your IP address will be recorded in this page's edit history.

You are editing a page for an older version of Dwarf Fortress ("Main" is the current version, not "40d"). Please make sure you intend to do this. If you are here by mistake, see the current page instead.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
{{av}}{{Quality|Masterwork}}
+
This is intended to be an easy guide for general newbies on how to both edit and add civilizations, creatures, objects, and so on in Dwarf Fortress, both [[Adventure_Mode|adventurer]] and [[Dwarf_Fortress_Mode|fortress]] modes, without breaking anything too much. Generally breaking stuff is fine! Just always back up your work + the originals, and be patient at having to [[World_Generation|generate new worlds]] over and over.  
 
 
This is intended to be an easy guide for general newbies on how to both edit and add civilizations, creatures, objects, and so on in Dwarf Fortress, both [[Adventure_Mode|adventurer]] and [[Dwarf Fortress Mode|fortress]] modes, without breaking anything too much. Generally breaking stuff is fine! Just always back up your work & the originals, and be patient at having to [[World generation|generate new worlds]] over and over.  
 
  
 
This guide was edited for version 0.27.176.39c and may not be accurate for later versions, particularly the examples.
 
This guide was edited for version 0.27.176.39c and may not be accurate for later versions, particularly the examples.
 
'''See also:''' [[:Category:Modding]]
 
  
 
= Modding Guide =
 
= Modding Guide =
Line 11: Line 7:
 
== Basics of DF modding ==
 
== Basics of DF modding ==
  
All of the data you can edit are stored in the \raw\ folder wherever you saved your DF executable. The raw folder contains two subfolders: graphics (where you insert [[Tilesets|graphic packs]] to make custom tiles), and objects, which contains all the data for generally everything in the game that is not hardcoded. Quite a lot is not hardcoded, so you can edit a wide variety of things in the game.  
+
All of the data you can edit are stored in the \raw\ folder wherever you saved your DF executable. The raw folder contains two subfolders: graphics (where you insert [[Object_Tilesets|graphic packs]] to make custom tiles), and objects, which contains all the data for generally everything in the game that is not hardcoded. Quite a lot is not hardcoded, so you can edit a wide variety of things in the game.  
  
 
Editing the [[Raw file|raw text files]] is easy and simple. When you go into the \raw\objects folder you will see a wide variety of text files. When you are modding your game, you can either change existing files or add your own. I personally find it easier just to edit the existing ones in a new \DF\ game folder. When you are changing a token you can simply change the values - these are the numbers/strings after the : in a token entry. For example, [CREATURE:DWARF] is a token in the entity text file, which determines what creatures are used for dwarven civilizations. Simply open the text file, edit what you want, save and close, and generate a new world after you're done editing what you want.
 
Editing the [[Raw file|raw text files]] is easy and simple. When you go into the \raw\objects folder you will see a wide variety of text files. When you are modding your game, you can either change existing files or add your own. I personally find it easier just to edit the existing ones in a new \DF\ game folder. When you are changing a token you can simply change the values - these are the numbers/strings after the : in a token entry. For example, [CREATURE:DWARF] is a token in the entity text file, which determines what creatures are used for dwarven civilizations. Simply open the text file, edit what you want, save and close, and generate a new world after you're done editing what you want.
Line 18: Line 14:
  
 
Every text file uses what are called "tokens", also called "flags". They are essentially attributes that you can add or remove or edit for any particular object in the game, that change the way the object works or acts. Most of the actual effects are hardcoded: for example, giving a creature such as a moose the [EVIL] creature token will make it only appear in evil maps, or giving it [BONECARN] will make it chow down on bones.
 
Every text file uses what are called "tokens", also called "flags". They are essentially attributes that you can add or remove or edit for any particular object in the game, that change the way the object works or acts. Most of the actual effects are hardcoded: for example, giving a creature such as a moose the [EVIL] creature token will make it only appear in evil maps, or giving it [BONECARN] will make it chow down on bones.
 +
 +
 +
  
 
A few key things to remember when modding the text files:
 
A few key things to remember when modding the text files:
  
 
* Always back up the default text files you plan on editing. This way, if your game crashes (due to say, a typo that you can't find) you can simply copy-paste it back in for a 'vanilla' DF.
 
* Always back up the default text files you plan on editing. This way, if your game crashes (due to say, a typo that you can't find) you can simply copy-paste it back in for a 'vanilla' DF.
* You do not need to delete old saves; simply create a new world using your modded files and things should run fine. Just don't try to play a "non-modded" world with modded files! Should you desire to go back to your old sites, make sure you revert to the raw files used for the creation of that world.  
+
* You do not need to delete old saves; simply create a new world using your modded files and things should run just fine. Just don't try to play a "non-modded" world with modded files! Should you desire to go back to your old sites, just make sure you revert to the raw files used for the creation of that world.  
 
* In general it's better to make whole new text files for new stuff you're adding rather than editing the existing ones by tagging them onto the bottom. This allows you to keep track of them easier and keeps them all in one place so there's less messing about with tons of files.
 
* In general it's better to make whole new text files for new stuff you're adding rather than editing the existing ones by tagging them onto the bottom. This allows you to keep track of them easier and keeps them all in one place so there's less messing about with tons of files.
 
* The absolute easiest way to add an entirely new creature/entity/etc is to simply copy-paste an existing one and rename it, then edit the various tokens appropriately.
 
* The absolute easiest way to add an entirely new creature/entity/etc is to simply copy-paste an existing one and rename it, then edit the various tokens appropriately.
  
 
In addition, if you ''rename'' the any of the \raw\ files themselves (such as 'creature_insects.txt' to 'creature_bugs.txt'), you must find the same filename in the \data\objects\ folder and delete it. This is required because once the world is generated it creates the new files and saves them for use next time the world is needed; without deleting the file you will get duplication errors. This is not necessary if you just don't change any of the filenames.
 
In addition, if you ''rename'' the any of the \raw\ files themselves (such as 'creature_insects.txt' to 'creature_bugs.txt'), you must find the same filename in the \data\objects\ folder and delete it. This is required because once the world is generated it creates the new files and saves them for use next time the world is needed; without deleting the file you will get duplication errors. This is not necessary if you just don't change any of the filenames.
 
It [http://www.bay12games.com/forum/index.php?topic=47445.msg956417#msg956417 has been reported] that the name of the raw files is important as to their contents, such as entity_foo.txt should contain an entity and creature_foo.txt should contain creature(s).
 
  
 
== Modding the civilizations ==
 
== Modding the civilizations ==
Line 37: Line 34:
 
     [CREATURE:CREATURETYPE]
 
     [CREATURE:CREATURETYPE]
 
     [TRANSLATION:LANGUAGETYPE]
 
     [TRANSLATION:LANGUAGETYPE]
     [BIOME_SUPPORT:BIOMETOKEN:FREQUENCY]
+
     [BIOME_SUPPORT:BIOMETOKEN:FREQENCY]
 
     ...[OTHER TAGS]...
 
     ...[OTHER TAGS]...
  
At the top of the file you'll see 'entity_default' all by itself.  This word (or "string") must appear at the top of the file and it must match the file name (without extension). All game files require those markers at the top. It may be useful for those with programming experience to think of this as equivalent to a class name.  In languages such as Java, the name of the file and the name of the class are identical so the compiler can recognize and process code from text files into binary data for the actual executable program.
+
At the top of the file you'll see an 'entity_default' all by itself, that must be at the top of the file only. All game files require those markers at the top. If you're creating a new civilization in its own text file, be sure to add entity_default, and [OBJECT:ENTITY] at the top of the file.
 
 
Next, if you're creating a new civilization in its own text file, be sure to add entity_default, and [OBJECT:ENTITY] at the top of the file.
 
  
 
Now what do these tokens mean, exactly? For one, where the tags are located don't generally matter quite a lot. You can add them in any order as long as they're underneath the "[ENTITY:]" token, which is the 'header' of the civilization and lets the game know that everything underneath deals with that civ. The entity token can be anything as long as it's not the same as another one.
 
Now what do these tokens mean, exactly? For one, where the tags are located don't generally matter quite a lot. You can add them in any order as long as they're underneath the "[ENTITY:]" token, which is the 'header' of the civilization and lets the game know that everything underneath deals with that civ. The entity token can be anything as long as it's not the same as another one.
Line 52: Line 47:
 
'[BIOME_SUPPORT:]' defines biomes that civs will appear in. The 'FREQUENCY' value determines the likelyhood of them appearing there: generally 1 for not very often, up to 3 for very often (ie. dwarves in mountains).
 
'[BIOME_SUPPORT:]' defines biomes that civs will appear in. The 'FREQUENCY' value determines the likelyhood of them appearing there: generally 1 for not very often, up to 3 for very often (ie. dwarves in mountains).
  
You can find many details about the rest of the civilization tokens [[Entity token|here]]. The important ones are the CIV_CONTROLLABLE token, which lets you control the civ in dwarf fortress mode and the INDIV_CONTROLLABLE and ADVENTURE_TIER tokens which lets you play the civ in adventure mode via the PLAY NOW! command. Remember that ADVENTURE_TIER must be in order, so if you are adding a new playable race you must set its tier 1 higher (4).
+
You can find many details about the rest of the civilization tokens [[Entity_Tokens|here]]. The important ones are the CIV_CONTROLLABLE token, which lets you control the civ in dwarf fortress mode and the INDIV_CONTROLLABLE and ADVENTURE_TIER tokens which lets you play the civ in adventure mode via the PLAY NOW! command. Remember that ADVENTURE_TIER must be in order, so if you are adding a new playable race you must put it above dwarves and set its tier 1 higher (4).
  
 
If you have more than one civ with the [CIV_CONTROLLABLE] token, groups belonging to that civ will appear in the group selection section on the embark screen, although it is not immediately obvious what species each group may be. While this can be determined from legends mode, experimentation suggests that the topmost species in the 'neighbors' section of the embark screen is the same as the currently selected species: If your group is dwarven, dwarves will be topmost, whilst (say) elves will be topmost if your chosen group is elven. By default, the game seems to choose a group (and therefore a species if there is more than one) at random.  
 
If you have more than one civ with the [CIV_CONTROLLABLE] token, groups belonging to that civ will appear in the group selection section on the embark screen, although it is not immediately obvious what species each group may be. While this can be determined from legends mode, experimentation suggests that the topmost species in the 'neighbors' section of the embark screen is the same as the currently selected species: If your group is dwarven, dwarves will be topmost, whilst (say) elves will be topmost if your chosen group is elven. By default, the game seems to choose a group (and therefore a species if there is more than one) at random.  
Line 80: Line 75:
 
Creature modding is great fun. Essentially you can change nearly any aspect of a creature or completely make your own from scratch. You can either add a new creature to the bottom of an existing creature_thing.txt file or make your own file; just be sure to add the name of the file (without the txt) to the top of it. For example, I tend to use a 'creature_newbies.txt' file myself.
 
Creature modding is great fun. Essentially you can change nearly any aspect of a creature or completely make your own from scratch. You can either add a new creature to the bottom of an existing creature_thing.txt file or make your own file; just be sure to add the name of the file (without the txt) to the top of it. For example, I tend to use a 'creature_newbies.txt' file myself.
  
Modding creatures is exactly similar to modding civs: just a matter of editing, adding, or removing tokens, enclosed in square brackets underneath the creature's [CREATURE:] header. The creature entries contain all the information about each specific creature in the game, from animals to dwarves to goblins to even caravan wagons. Much of the data of a creature is quite self-explanatory; you can find a list of every creature token [[Creature token|here]].
+
Modding creatures is exactly similar to modding civs: just a matter of editing, adding, or removing tokens, enclosed in square brackets underneath the creature's [CREATURE:] header. The creature entries contain all the information about each specific creature in the game, from animals to dwarves to goblins to even caravan wagons. Much of the data of a creature is quite self-explanatory; you can find a list of every creature token [[Creature_Tokens|here]].
  
 
There're some tokens which use temperature values. Dwarf Fortress has it's own temperature scale for this. [[Temperature scale|DF temperature scale]].
 
There're some tokens which use temperature values. Dwarf Fortress has it's own temperature scale for this. [[Temperature scale|DF temperature scale]].
Line 88: Line 83:
 
You'll notice many of the creature entries have tokens that other ones don't have. If a token is not present it's considered "default", though sometimes the default can be hard to figure out. All of the creatures referenced in the entity files are present in creature_standard.txt and require certain other tokens that non-entity creatures do not need, such as [INTELLIGENT] and [CANOPENDOORS].
 
You'll notice many of the creature entries have tokens that other ones don't have. If a token is not present it's considered "default", though sometimes the default can be hard to figure out. All of the creatures referenced in the entity files are present in creature_standard.txt and require certain other tokens that non-entity creatures do not need, such as [INTELLIGENT] and [CANOPENDOORS].
  
For example, if you wanted to allow your dwarves to eat bones from the refuse stockpile (ew), you would open up creature_standard.txt, add [BONECARN] somewhere in the CREATURE_DWARF: entry at the top, and then save and close it, then generate a new world. Bon appetit! *Notice that this has the unfortunate side effect of making them unable to eat plants.*
+
For example, if you wanted to allow your dwarves to eat bones from the refuse stockpile (ew), you would open up creature_standard.txt, add [BONECARN] somewhere in the CREATURE_DWARF: entry at the top, and then save and close it, then generate a new world. Bon appetit!
 
 
[[User:Deon#How_to|How to add a new creature.]]
 
 
 
If you make a totally new creature, feel free to add it [[Modification:New creatures|here]] along with any additional information.
 
  
 +
[http://www.dwarffortresswiki.net/index.php/User:Deon#How_to How to add a new creature.]
  
 
== Modding items ==
 
== Modding items ==
Line 416: Line 408:
 
  [INTELLIGENT]
 
  [INTELLIGENT]
 
  [TRANCES]
 
  [TRANCES]
  [EVIL]
+
  [EVIL][BONECARN]
 
  [CANOPENDOORS]
 
  [CANOPENDOORS]
 
  [PREFSTRING:beards]
 
  [PREFSTRING:beards]
Line 460: Line 452:
  
  
This is largely a copy of the regular dwarves, but with several differences: [LIKES_FIGHTING] will give them happy thoughts when they have fought something, [NOCTURNAL] means they like nights rather than days, and [EVIL] means on the adventurer map their fortresses will tend to end up on evil tiles rather than good ones. Otherwise, they are exactly the same as regular dwarves. To make them extra evil, add [BONECARN] somewhere in there and they can eat bones (they'll actually haul them from your refuse pit to the dining table, yum), but will sometimes (though rarely) choke to death on them{{verify}}. Bear in mind that [BONECARN] implies [CARNIVORE], so they won't eat vegetables making the game much harder. Also, they do not require booze to stay happy (though will happily drink it anyway if they have to).
+
This is largely a copy of the regular dwarves, but with several differences: [LIKES_FIGHTING] will give them happy thoughts when they have fought something, [NOCTURNAL] means they like nights rather than days, and [EVIL] means on the adventurer map their fortresses will tend to end up on evil tiles rather than good ones. Otherwise, they are exactly the same as regular dwarves. To make them extra evil, add [BONECARN] somewhere in there and they can eat bones (they'll actually haul them from your refuse pit to the dining table, yum), but will sometimes (though rarely) choke to death on them. Also, they do not require booze to stay happy (though will happily drink it anyway if they have to).  
  
There! That's all we need to do in order to add our civilization. Just create a new world and they'll be there: however, when you go to adventurer mode, all (or none) of your dwarf entries might be replaced with dark dwarves, so it's really a matter of luck. When you start a new fortress, there will be a 50-50 chance of playing either as dwarves or dark dwarves. The easiest way to tell if a civ is a dark dwarven is if the name is rather unpleasant. 'The Fortress of Rapes' for example would probably not be a standard dwarven one. Remove [CIV_CONTROLLABLE] from the standard dwarves if you only want to play as dark.
+
There! That's all we need to do in order to add our civilization. Just create a new world and they'll be there: however, when you go to adventurer mode, all (or none) of your dwarf entries might be replaced with dark dwarves, so it's really a matter of luck. When you start a new fortress, there will be a 50-50 chance of playing either as dwarves or dark dwarves. The easiest way to tell if a civ is a dark dwarven is if the name is rather unpleasant. 'The Fortress of Rapes' for example would probably not be a standard dwarven one.
  
 
== Example two: "Arachnid" playable creature ==
 
== Example two: "Arachnid" playable creature ==
Line 619: Line 611:
 
Written by Teldin.
 
Written by Teldin.
  
= Modding utilities =
+
= Modbase =
 
 
== Modbase ==
 
  
 
Modbase is a great tool made by Sean Mirrsen which allows you to freely swap mods and tweak game settings.
 
Modbase is a great tool made by Sean Mirrsen which allows you to freely swap mods and tweak game settings.
Line 627: Line 617:
 
For version 0.38c.
 
For version 0.38c.
  
== DF Raw Editor ==
 
  
DF Raw Editor is a brand new tool created to help edit the raw files.
 
It is available [http://www.bay12games.com/forum/index.php?topic=40413.0 here].
 
For version 0.40d
 
  
{{Category|Modding}}
+
[[Category:Modding]]
 
[[Category:Guides]]
 
[[Category:Guides]]

Please note that all contributions to Dwarf Fortress Wiki are considered to be released under the GFDL & MIT (see Dwarf Fortress Wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:

Cancel Editing help (opens in new window)