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.

Difference between revisions of "Modding"

From Dwarf Fortress Wiki
Jump to navigation Jump to search
m (hypergrammarian edit)
 
(121 intermediate revisions by 38 users not shown)
Line 1: Line 1:
{{Quality|Exceptional|14:13, 7 November 2013 (UTC)}}
+
{{migrated article}}
 +
{{Quality|Fine}}
 
{{av}}
 
{{av}}
This is intended to be a guide to inform those new to DF modding on what elements of the game can be modified, and how. After reading through this guide, a user should be capable of editing creatures, entities, materials ''et al'', and creating their own.
+
{{For/see|a list of Dwarf Fortress mods|[[List of mods]]}}
 +
{{Modding}}
 +
'''Modding''', or creating [[mod]]s, refers to modifying the behavior of the base game (vanilla). ''Dwarf Fortress'' is remarkably moddable.
 +
 
 +
== Resource Overview==
 +
[[File:modding_icon.png|120px|right]]This section serves as a portal to all modding-related pages on the wiki.
 +
 
 +
; Using Mods:
 +
* [[Mod#Installing Mods|Installing mods]]
 +
* [[Mod#Enabling Mods|Enabling mods in-game]]
 +
 
 +
; Guides and references:
 +
* [[Modding guide|DF RAWs modding guide]]
 +
* [https://docs.dfhack.org/en/latest/docs/guides/modding-guide.html#dfhack-modding-guide DFHack modding guide]
 +
* [[Modding pitfalls]] for troubleshooting
 +
 
 +
* [[Mod#Mod Format|Mod Format]] and [[Game folders and files]]
 +
* [[Mod#Publish on Steam Workshop|Publish on Steam Workshop]]
 +
* [[Memory hacking]], [[Main:Offset Finding Methods|Offset Finding Methods]]
 +
* [[Character table]]
 +
 
 +
; Where to get help?
 +
* This [http://www.bay12forums.com/smf/index.php?board=13.0 forum] is the official DF subforum dedicated to discussions about modding.
 +
* [https://discord.com/channels/329272032778780672/629902895138996264 Kitfox modding discord]
 +
* [https://docs.dfhack.org/en/stable/docs/Introduction.html#getting-help DFhack questions]
 +
 
 +
; Modding tools
 +
There are several [[Utilities#Modding_tools|utilities]] that assist in modding efforts. There is [http://www.bay12forums.com/smf/index.php?topic=28829.0 a list of them] on the [[Bay 12 Forums]].
 +
* Text Editors are used in all areas of modding. Use a good text editor to edit files and search into multiple files (like the free [https://notepad-plus-plus.org/ Notepad++] for example) or more advanced editors capable of highlighting and formatting the displayed text (like [[Utilities#DF_RAW_Language_server|DF RAW Language server]])
 +
* Image Editor will be needed for doing custom graphics. [https://www.getpaint.net/ Paint.NET], Photoshop and GIMP are the most used, but whatever supports the .png format will work.
 +
 
 +
=== Documentation===
 +
; [[Raw file]]s
 +
 
 +
These object files, stored in <code>/data/vanilla/*/objects/</code>, define various specifics of game items, materials, and creatures, and can be changed using mods to alter how the game behaves. These are text based and can be edited with any text editor, however, editing the vanilla raw files is now discouraged.
 +
 
 +
See [[Token|Token reference]] - It's always good to refer to tokens on the wiki. Even experienced modders have to look up tokens! A list of articles about tokens can be found here.
 +
 
 +
; [[Graphics|Graphics Files]]:
 +
 
 +
The `/data/art/` subfolder of Dwarf Fortress is used to store user-customizable graphics sets.
 +
 
 +
; [[Reaction]]s:
 +
 
 +
; [[Language token|Language]] and [[Speech file]]:
 +
 
 +
; [[Audio|Sound and Music files]]:
 +
 
 +
All sound and music files used by ''Dwarf Fortress'' are stored in the [https://en.wikipedia.org/wiki/Ogg .ogg] format within the <code>/data/sound/</code> subfolders. You can replace the existing ogg files with different ones. That has to be performed manually and isn't actually supported by the game. You can also change some of the definitions of when certain musical cues are played, using available [[music token]]s and [[sound token]]s in the raw files. However, you can't add new music or sounds other than replacing what's already there.
 +
 
 +
=== Best practice ===
 +
The current best practice is to not modify the original raw files, since most modifications can be made via mods. Mods can add new objects, add tokens to existing objects, and cut objects entirely. You should prefer SELECT over CUT, and prefer CUT over not loading vanilla raws.
 +
 
 +
== Guide ==
 +
This is intended to be a guide to inform those new to ''Dwarf Fortress'' modding on what elements of the game can be modified, and how. After reading through this guide, a user should be capable of editing creatures, entities, materials ''et al'', and creating their own.
  
 
Generally, breaking stuff is fine - nothing that can be changed will affect the DF executable, and new additions can be easily removed.
 
Generally, breaking stuff is fine - nothing that can be changed will affect the DF executable, and new additions can be easily removed.
Line 7: Line 62:
 
This guide is based on [[40d:Modding guide|Teldin's guide]], originally created for version 0.27.176.39c. Per wiki tradition, it has been updated through all the major releases since then; hopefully it reflects current knowledge.
 
This guide is based on [[40d:Modding guide|Teldin's guide]], originally created for version 0.27.176.39c. Per wiki tradition, it has been updated through all the major releases since then; hopefully it reflects current knowledge.
  
'''See also:''' [[:Category:DF2014:Modding]]
+
=== Token reference ===
 
+
It's always good to refer to tokens on the wiki. Even experienced modders have to look up tokens! A list of articles about tokens can be found [[Token|here]].
= Modding Guide =
 
  
== Token Reference ==
+
=== Basics of DF modding ===
 +
To make a mod, one must put a folder into the <code>/mods/</code> folder. The vast majority of modifications to the game can be done via this method. This folder should contain a file named "info.txt" and two subfolders: "graphics" (where you insert [[Graphics set repository|graphics sets]]), and "objects", which contains all the data for, generally, everything in the game that is not hardcoded.
  
It's always good to refer to tokens on the wiki. Even experienced modders have to look up tokens! A list of articles about tokens can be found [http://dwarffortresswiki.org/index.php/Token here.]
+
The [[info.txt]] is formatted like so:
  
== Basics of DF modding ==
+
{{code|
 +
[ID:my_first_mod]
 +
[NUMERIC_VERSION:1]
 +
[DISPLAYED_VERSION:1.0.0]
 +
[EARLIEST_COMPATIBLE_NUMERIC_VERSION:1]
 +
[EARLIEST_COMPATIBLE_DISPLAYED_VERSION:1.0.0]
 +
[AUTHOR:Your Name Here]
 +
[NAME:My First Mod]
 +
[DESCRIPTION:A cool mod I made!]
 +
}}
  
All the base data that can be edited by prospective modders can be found in the \raw\ folder. This folder contains two subfolders: "graphics" (where you insert [[Graphics set repository|graphics sets]]), and "objects", which contains all the data for generally everything in the game that is not hardcoded.
+
A mod should have all of these. There are a [[mod info token|few more tokens]], but the above are the important ones.
  
Within the \raw\objects folder are a large number of text files - these are the [[raw file|raw files]], and editing them is quite easy - you can also create your own if you wish. For now, take a look at one of the existing files. For example if you open creature_standard.txt it should look something like this:
+
Most of the game's vanilla content is in the same format as mods. Many text files can be found in the subfolders of the <code>/data/vanilla</code> folder - these are the [[raw file|raw files]], and using them as a basis for modification is quite easy. For now, we will take a look at one of the existing files. For example, if you open <code>/data/vanilla/vanilla_creatures/creature_standard.txt</code>, it should look something like this:
  
 +
{{code|
 
  creature_standard
 
  creature_standard
 
   
 
   
Line 32: Line 97:
 
     [CREATURE_SOLDIER_TILE:2]
 
     [CREATURE_SOLDIER_TILE:2]
 
  ...
 
  ...
 +
}}
 +
 +
As you can see, each file comprises a header string stating the file name, a second header stating the type of object data it contains, followed by the contents of the file itself. These are all necessary elements of the file, and without them, the file will be ignored by the game.
 +
 +
'''In other words, to be recognized by the game, a raw file must have all of the following:'''
  
As you can see, each file comprises a header string stating the file name, a second header stating the type of object data it contains, followed by the contents of the file itself. These are all necessary elements of the file, and without them, the file won't be parsed correctly by the game. You may have also noticed the file naming scheme - this is also important; files containing creatures have names starting with "creature_", entity file names must begin with "entity_", etc..
+
# A filename that refers to the type of objects contained therein. '''Creature files must start with creature_, entity files must start with entity_, and so on.'''
 +
# The filename on the first line of the file.
 +
# [OBJECT:type], where "type" is replaced with the relevant object type.
  
Below the headers, there begins a list of entries. Each entry is made up of its own header (in this case, "[CREATURE:DWARF]"), again stating the type of object, and then the object's unique identifier - if an identifier isn't unique, the game will mess up and you'll get some serious, and potentially very trippy, errors. Below that, we have the body of the entry, which determines the entry's specific properties.
+
Below the headers, there begins a list of entries. Each entry is made up of its own header (in this case, "[CREATURE:DWARF]"), again stating the type of object, and then the object's unique identifier - if an identifier isn't unique, the game will mess up and you'll get some serious, and potentially very trippy, errors. ([[Duplicated raws|For example...]])  Below that, we have the body of the entry, which determines the entry's specific properties.
  
 
The body of an entry is made up of a series of "tokens", which are essentially flags that can be added or removed to affect the entry's attributes. Most of these effects are hardcoded: for example, it's possible to make a creature only eat meat with the [CARNIVOROUS] token, but it's impossible to create your own token detailing a specific diet for the creature.
 
The body of an entry is made up of a series of "tokens", which are essentially flags that can be added or removed to affect the entry's attributes. Most of these effects are hardcoded: for example, it's possible to make a creature only eat meat with the [CARNIVOROUS] token, but it's impossible to create your own token detailing a specific diet for the creature.
Line 41: Line 113:
 
Before we continue, a few key things to remember when modding the raw files:
 
Before we continue, a few key things to remember when modding the raw files:
  
* Try to avoid modifying the existing raw files when adding objects. It makes removing mods far easier.
+
* Try to avoid modifying the existing raw files when possible. You should make a mod instead!
* When adding files, all you need to include to ensure proper references are maintained is the token identifier's.  The game will load up all *.txt in the raw folder, and searches through them by tokens.  For example: You can add a new pair of leather boots and not even have to add it to the item_shoes.txt file, but rather make your own file, say item_shoes_new.txt and ensure you have the token listed, ex. [ITEM_SHOES:ITEM_SHOES_BOOTS_NEW], that's how the game will look for the item.
+
* When adding files, token identifiers are all you need to include to ensure proper references are maintained.  The game searches through all loaded raw files by tokens.  For example, you can add a new pair of leather boots and not even have to add it to a file named item_shoes.txt, but rather your own file, say item_shoes_new.txt and ensure you have the token listed, ex. [ITEM_SHOES:ITEM_SHOES_BOOTS_NEW].
* If you want to edit an already-existing creature, always back up the files you plan on editing to a different location. Since v0.31.22, the game no longer loads backup files, but duplicate entries are still a very bad thing.
+
 
* When a new world is generated, all the raw files get copied into a \raw\ folder within the applicable save folder. If you want to change something within a world that's already been generated, you'll have to edit those files, not the ones in ~DF\raw\objects.
+
* When a new world is generated, the mods included are "baked in" and cannot be modified except to be updated--for this, the game checks that the mod used by the save is of a compatible NUMERIC_VERSION.
* There's nothing stopping you from just copying an existing creature/entity/whatever, changing the identifier, and modifying it. This can save you a lot of time, especially when it comes to entities... which are coincidentally what we'll be talking about next.
+
* There's nothing stopping you from just copying an existing creature/entity/whatever, changing the identifier, and modifying it. This can save you a lot of time, especially when it comes to entities.
 +
 
 +
=== Modifying the vanilla objects ===
  
== Modding civilizations (entities) ==
+
You should not modify the vanilla raws where they originally are if you can help it. Instead, patch them using the patching functions provided with ''Dwarf Fortress'' since v50.01.
  
Entities - the objects that determine how civilizations work - are stored in entity_default.txt (though, like all other files, you may add more). They follow the same format as any other raw file:
+
There are two patching functions: SELECT and CUT. When SELECT is used, it lets you make changes to an object without needing the entire entry to be present in your mod file. When CUT is used, it forces the game to not use that object, even though it is still found in the vanilla raws (or in any other mods earlier in the load order). Both of these functions take the form of tokens. These functions are not universally applicable to any token found in any entry, just the following list of objects:
  
 +
CREATURE, ENTITY, INTERACTION, ITEM, WORD, TRANSLATION, SYMBOL, INORGANIC, PLANT, MUSIC, REACTION, SOUND
 +
 +
The syntax required for these functions is: '''['''<function>'''_'''<object>''':'''<specific object being affected>''']'''. For instance, [CUT_PLANT:MUSHROOM_HELMET_PLUMP] cuts the plump helmet object in the vanilla file plant_standard.txt, so the game will not use that object at all. However, [SELECT_ITEM_HELM:ITEM_HELM_HELM] does not select the helm object from the vanilla file item_helm.txt, even though that's how the object appears in that file, because there is no [SELECT_ITEM_HELM] token. Instead, the helm would be selected with [SELECT_ITEM:ITEM_HELM_HELM].
 +
 +
For example, if you wanted to mod beards onto dwarven women while also removing elephants from the game:
 +
 +
{{code|
 +
creature_mypatch
 +
 +
[OBJECT:CREATURE]
 +
 +
[SELECT_CREATURE:DWARF] starts editing DWARF from the end of the entry
 +
    [SELECT_CASTE:FEMALE]
 +
        [BODY_DETAIL_PLAN:FACIAL_HAIR_TISSUE_LAYERS]
 +
 +
[CUT_CREATURE:ELEPHANT] removes the ELEPHANT creature
 +
}}
 +
 +
Or, say, add your own reaction and building to dwarves:
 +
 +
{{code|
 +
entity_mypatch
 +
 +
[OBJECT:ENTITY]
 +
 +
[SELECT_ENTITY:MOUNTAIN]
 +
    [PERMITTED_REACTION:MY_REACTION]
 +
    [PERMITTED_BUILDING:MY_BUILDING]
 +
}}
 +
 +
And in any of these, one can add the token [LOG_CURRENT_ENTRY] somewhere under one of the objects of the file, which logs the full contents of the object in question to logs\current_entry.txt. This can be useful to make sure that the patch is doing what you think it is. For instance if [LOG_CURRENT_ENTRY] were added on the next line after [CREATURE:DWARF] in your mod file, then the dwarf object would be the object detailed in the log entry.
 +
 +
...Speaking of, let's move on to modifying and adding entities.
 +
 +
=== Modding civilizations (entities) ===
 +
 +
Entities - the objects that determine how civilizations work - are stored in <code>vanilla_entities/entity_default.txt</code> (though, like all other files, you may add more). They follow the same format as any other raw file:
 +
 +
{{code|
 
  entity_default
 
  entity_default
 
   
 
   
Line 58: Line 171:
 
     [CREATURE:CREATURETYPE]
 
     [CREATURE:CREATURETYPE]
 
     [TRANSLATION:LANGUAGETYPE]
 
     [TRANSLATION:LANGUAGETYPE]
     [BIOME_SUPPORT:BIOMETOKEN:FREQENCY]
+
     [BIOME_SUPPORT:BIOMETOKEN:FREQUENCY]
 
     ...[OTHER TAGS]...
 
     ...[OTHER TAGS]...
 +
}}
  
 
Most of the time, it doesn't matter which order these tokens are in or where they're placed so long as they're below the "ENTITY:" identifier, but there are some important exceptions in the case of other files, especially creatures, which can contain a lot of "nested" tokens.
 
Most of the time, it doesn't matter which order these tokens are in or where they're placed so long as they're below the "ENTITY:" identifier, but there are some important exceptions in the case of other files, especially creatures, which can contain a lot of "nested" tokens.
  
"[CREATURE:]" links the civilization with a specific creature defined in a creature file. This is the creature that'll be making up the entity's population, and will therefore be the creature you'll be playing as in fortress or adventure mode if the entity is a playable one. For example, if you wanted to do something silly, you could switch the "CREATURE:DWARF" entry in entity_default.txt with "CREATURE:ELF" and you would be marching elves around in fortress mode, although they would still use dwarven technology and language and names and so forth.
+
"[CREATURE:]" links the civilization with a specific creature defined in a creature file. This is the creature that'll be making up the entity's population, and, therefore, the creature you'll be playing as in fortress or adventure mode if the entity is a playable one. For example, if you wanted to do something silly, you could switch the "CREATURE:DWARF" entry in entity_default.txt with "CREATURE:ELF" and you would be marching elves around in fortress mode, although they would still use dwarven technology, language and names and so forth. Oh, and before you get any funny ideas - it ''is'' possible to define more than one creature for a civ, but that won't work in quite the way you probably expect; it will pick only one of the defined creatures at random to use for the civ. Later on, in the creature section, you'll learn about castes, which will provide a much more viable alternative, so try to bear with us until then.
 
 
Oh, and before you get any funny ideas - it ''is'' possible to define more than one creature for a civ, but that won't work in quite the way you probably expect; later on, in the creature section, you'll learn about castes, which will provide a much more viable alternative, so try to bear with us until then.
 
  
 
"[TRANSLATION:]" defines the language file that the entity will be using, which will determine what their untranslated words are for things. This doesn't determine which words they use for naming things, only the way those words are spelled. The default language files are HUMAN, DWARF, ELF, and GOBLIN.
 
"[TRANSLATION:]" defines the language file that the entity will be using, which will determine what their untranslated words are for things. This doesn't determine which words they use for naming things, only the way those words are spelled. The default language files are HUMAN, DWARF, ELF, and GOBLIN.
  
"[BIOME_SUPPORT:]" defines the biomes that civs will attempt to settle in. The "FREQUENCY" value determines the likelihood of them building there, but also raises an important point: Most of the values you'll be setting for things are relative to each other. If one were to type:
+
"[BIOME_SUPPORT:]" defines the biomes that civs will attempt to settle in. The "FREQUENCY" value determines the likelihood of them building there, but also raises an important point: most of the values you'll be setting for things are relative to each other. If one were to type:
  
 +
{{code|
 
  [BIOME_SUPPORT:ANY_FOREST:1]
 
  [BIOME_SUPPORT:ANY_FOREST:1]
 
  [BIOME_SUPPORT:SAVANNA:2]
 
  [BIOME_SUPPORT:SAVANNA:2]
 +
}}
  
 
This would have very much the same effect as:
 
This would have very much the same effect as:
  
 +
{{code|
 
  [BIOME_SUPPORT:ANY_FOREST:5]
 
  [BIOME_SUPPORT:ANY_FOREST:5]
 
  [BIOME_SUPPORT:SAVANNA:10]
 
  [BIOME_SUPPORT:SAVANNA:10]
 +
}}
  
 
This holds true for a lot of values throughout the files, excluding when it simply doesn't make sense, such as in materials.
 
This holds true for a lot of values throughout the files, excluding when it simply doesn't make sense, such as in materials.
  
You can find many details about the rest of the civilization tokens [[entity token|here]]. Besides those mentioned, some fundamental ones are the CIV_CONTROLLABLE token, which lets you control the civ in fortress mode, the INDIV_CONTROLLABLE token, which allows you to play the civ in adventure mode as an outsider, and the ADVENTURE_TIER token, which allows you to play a civ native (non-outsider) in adventure mode. Other tokens that you should pay attention to are START_BIOME and the ones regarding sites, but in general, you can just run through the aforementioned list and add or remove what you want.
+
You can find many details about the rest of the civilization tokens [[entity token|here]].  
  
If you have more than one civ with the CIV_CONTROLLABLE token, all the available civs from those entities will appear in the group selection section on the embark screen. It may not be immediately obvious from which species each civ may be - while this can be determined from legends mode, the topmost species in the "neighbors" display in the embark screen is always 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 civ (and therefore a species if there is more than one) at random.
+
Besides those mentioned, some fundamental ones are the <code>[SITE_CONTROLLABLE]</code> token, which lets you control the civ in fortress mode, the <code>[OUTSIDER_CONTROLLABLE]</code> token, which allows you to play in adventure mode as an outsider, and the <code>[ALL_MAIN_POPS_CONTROLLABLE]</code> token, which allows you to play a civ native (non-outsider) in adventure mode. Other tokens that you should pay attention to are START_BIOME and the ones regarding sites, but in general, you can just run through the aforementioned list and add or remove what you want.
  
You can also attempt to discern the civ yourself by the names it uses - this is the realm of "symbols", collections of words centered around a specific concept. The civ will use the words comprising whatever symbols are applicable to it for various things. This association might be a little obfuscating at first, so I'll run through it. Let's refer to the DWARF entity:
+
If you have more than one civ with the <code>[SITE_CONTROLLABLE]</code> token, all the available civs from those entities will appear in the group selection section on the embark screen. It may not be immediately obvious from which species each civ may be - while this can be determined from legends mode, the topmost species in the "neighbors" display in the embark screen is always 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 civ (and therefore a species if there is more than one) at random.
  
 +
You can also attempt to discern the civ yourself by the names it uses - this is the realm of "symbols", collections of words centered around a specific concept. The civ will use the words comprising whatever symbols are applicable to it for various things. This association might be a little confusing at first, so, let's refer to the DWARF entity:
 +
 +
{{code|
 
  [SELECT_SYMBOL:WAR:NAME_WAR]
 
  [SELECT_SYMBOL:WAR:NAME_WAR]
 
  [SUBSELECT_SYMBOL:WAR:VIOLENT]
 
  [SUBSELECT_SYMBOL:WAR:VIOLENT]
Line 93: Line 212:
 
  [SELECT_SYMBOL:SIEGE:NAME_SIEGE]
 
  [SELECT_SYMBOL:SIEGE:NAME_SIEGE]
 
  [SUBSELECT_SYMBOL:SIEGE:VIOLENT]
 
  [SUBSELECT_SYMBOL:SIEGE:VIOLENT]
 +
}}
  
Here we can see that dwarves will generally name their wars first after words in the "NAME_WAR" symbol group, and then after words in the "VIOLENT" symbol group. This might, for example, result in a war being named "The War of Carnage". The symbols used for the other types of conflict are arrayed in a similar fashion. It would be trivial to replace the instances of VIOLENT with, say, PEACE and end up with a battle called "The Clash of Calm" or something.
+
Here, we can see that dwarves will generally name their wars first after words in the "NAME_WAR" symbol group, and then, after words in the "VIOLENT" symbol group. This might, for example, result in a war being named "The War of Carnage". The symbols used for the other types of conflict are arrayed in a similar fashion. It would be trivial to replace the instances of VIOLENT with, say, PEACE and end up with a battle called "The Clash of Calm" or something.
  
 +
{{code|
 
  [SELECT_SYMBOL:ROAD:NAME_ROAD]
 
  [SELECT_SYMBOL:ROAD:NAME_ROAD]
 
  [SELECT_SYMBOL:TUNNEL:NAME_TUNNEL]
 
  [SELECT_SYMBOL:TUNNEL:NAME_TUNNEL]
 
  [SELECT_SYMBOL:BRIDGE:NAME_BRIDGE]
 
  [SELECT_SYMBOL:BRIDGE:NAME_BRIDGE]
 
  [SELECT_SYMBOL:WALL:NAME_WALL]
 
  [SELECT_SYMBOL:WALL:NAME_WALL]
 +
}}
  
The above applies here. Dwarves are fond of naming their roads and tunnels after roads and tunnels.
+
The above applies here. Dwarves are fond of naming their roads and tunnels after... roads and tunnels.
  
 +
{{code|
 
  [SELECT_SYMBOL:REMAINING:ARTIFICE]
 
  [SELECT_SYMBOL:REMAINING:ARTIFICE]
 
  [SELECT_SYMBOL:REMAINING:EARTH]
 
  [SELECT_SYMBOL:REMAINING:EARTH]
Line 113: Line 236:
 
  [CULL_SYMBOL:ALL:UGLY]
 
  [CULL_SYMBOL:ALL:UGLY]
 
  [CULL_SYMBOL:ALL:NEGATOR]
 
  [CULL_SYMBOL:ALL:NEGATOR]
 +
}}
 +
 +
This section deals with everything else. The things that haven't already been dealt with (hence the "REMAINING") - such as site names, kingdom names, the names of individuals, and such - will have names from the ARTIFICE and EARTH symbol groups. After that, the dwarf entity is told to cull all inappropriate symbols - this applies to everything (hence the "ALL") so if the game happens to choose a symbol associated with, say, EVIL for one of the battles, it'll scrap that name and try again. This sort of thing adds a lot of flavour to DF's entities and can account for a lot of a civ's perceived personality.
 +
 +
Another basic thing to note: any entity token that's dealing with weapons, armor, clothing, etc., will state the items that the civ can build natively, not necessarily the ones they can wear or use. For example, you could create a species with no clothes specified, but then rob a clothes shop in adventurer mode and wear everything you want, or give them weapons that are too large to wield and they could sell them, but not use them.
  
This section deals with everything else. The things that haven't already been dealt with (hence the "REMAINING") - such as site names, kingdom names, the names of individuals, and such - will have names from the ARTIFICE and EARTH symbol groups. After that the dwarf entity is told to cull all innapropriate symbols - this applies to everything (hence the "ALL") so if the game happens to choose a symbol associated with, say, EVIL for one of the battles, it'll scrap that name and try again. This sort of thing adds a lot of flavour to DF's entities and can account for a lot of a civ's perceived personality.
+
An easy method of creating a civilization is just to copy-paste a similar one to the bottom of the entity_default.txt file and edit things to your liking. Remember to always change the civ's "ENTITY:" identifier! This can be anything, so long as it's not already existing.
  
Another basic thing to note:  Any entity token that's dealing with weapons, armor, clothing, etc., will state the items that the civ can build natively, not necessarily the ones they can wear or use. For example, you could create a species with no clothes specified, but then rob a clothes shop in adventurer mode and wear everything you want, or give them weapons that are too large to wield and they could sell them, but not use them.
+
At the end of some of the default entries you'll find a list of positions, both ones that'll directly affect you in fort mode (such as nobles) and ones that'll primarily affect worldgen and adventure mode. A list of the tokens applicable to positions can be found [[position token|here]]; they don't require a great deal of explanation, but that can be found in [[Advanced Entity Position Mechanics]]
  
An easy method of creating a civilization is just to copy-paste a similar one to the bottom of the entity_default.txt file and edit things to your liking. Remember to always change the civ's "ENTITY:" identifier! This can be anything so long as it's not already existing.
+
==== Trade ====
 +
The following [[entity token]]s affect the appearance of [[trading]] [[caravan]]s:
  
At the end of some of the default entries you'll find a list of positions, both ones that'll directly affect you in fort mode (such as nobles) and ones that'll primarily affect worldgen and adventure mode. A list of the tokens applicable to positions can be found [[position token|here]]; they don't require a great deal of explanation.
+
* [[Entity token#ACTIVE_SEASON|[ACTIVE_SEASON]]] - Defines the seasons when an entity may visit your fortress.
 +
* [[Entity token#PROGRESS_TRIGGER_POPULATION|[PROGRESS_TRIGGER_*]]] - Defines the triggers which control when an entity will become interested in your fortress.
 +
* [[Entity token#COMMON_DOMESTIC_PACK|[COMMON_DOMESTIC_PACK]]] - Allows the civilization to use domestic pack animals. If an entity lacks pack animals (or ability to pull wagons), it will be unable to send caravans (showing as {{DFtext|No Trade|6:1}} at the [[embark]] screen), unless it has domesticated any suitable animal species or is forced to use a non-suitable creature by the [ANIMAL] definition [ALWAYS_WAGON_PULLER] on creature, caste or class.
 +
* [[Entity token#COMMON_DOMESTIC_PULL|[COMMON_DOMESTIC_PULL]]] - Allows the civilization to use domestic animals to pull [[wagon]]s, assuming their [[Ethic#KILL_PLANT|KILL_PLANT ethic]] permits them to use wagons in the first place.
 +
* [[Entity token#MERCHANT_BODYGUARDS|[MERCHANT_BODYGUARDS]]] - Caravan will be guarded by [[soldier]]s.
  
== Modding the creatures ==
+
=== Modding creatures ===
  
Creature modding is great fun. You can change nearly any aspect of a creature or make your own completely from scratch.
+
Creature modding is great fun – you can change nearly any aspect of a creature, or make your own completely from scratch.
  
 
Modding creatures is very similar to modding civs: it's just a matter of editing, adding, or removing tokens, enclosed in square brackets underneath the creature's [CREATURE:] header. The creature entries contain all of the information about each and every non-random creature in the game, from animals to dwarves to goblins to even caravan wagons. A lot of the creature tokens are fairly self-explanatory; you can find a list of such tokens [[creature token|here]]. But before you start creating your own creatures, you'll want to learn how the tissues system works.
 
Modding creatures is very similar to modding civs: it's just a matter of editing, adding, or removing tokens, enclosed in square brackets underneath the creature's [CREATURE:] header. The creature entries contain all of the information about each and every non-random creature in the game, from animals to dwarves to goblins to even caravan wagons. A lot of the creature tokens are fairly self-explanatory; you can find a list of such tokens [[creature token|here]]. But before you start creating your own creatures, you'll want to learn how the tissues system works.
  
=== Creature materials and tissues ===
+
==== Creature materials and tissues ====
  
In the most basic sense, a creature is a series of bodyparts. These parts are defined in their own file, and we'll talk about them later. As a specific aspect of how creatures work which throws off a lot of prospective modders is the relationship between bodyparts, tissues, and materials. We're going to show you part of the creature entry for a bronze colossus (bear with us):
+
In the most basic sense, a creature is a series of body parts. These parts are defined in their own file, and we'll talk about them later, as a specific aspect of how creatures work, which throws off a lot of prospective modders, is the relationship between body parts, tissues, and materials. We're going to show you part of the creature entry for a bronze colossus (bear with us):
  
 +
{{code|
 
  ...
 
  ...
 
  [BODY:HUMANOID:2EYES:2EARS:NOSE:HUMANOID_JOINTS:5FINGERS:5TOES]
 
  [BODY:HUMANOID:2EYES:2EARS:NOSE:HUMANOID_JOINTS:5FINGERS:5TOES]
Line 146: Line 280:
 
  [TISSUE_LAYER:BY_CATEGORY:ALL:BRONZE]
 
  [TISSUE_LAYER:BY_CATEGORY:ALL:BRONZE]
 
  ...
 
  ...
 +
}}
  
At the top, we can see the "BODY:" token, followed by a list of bodyparts. As you've probably guessed, these parts make up the physical form of the colossus. But the colossus has to be made out of something - it has to have tissues. And those tissues also have to be made out of something - in this case, bronze.
+
At the top, we can see the "BODY:" token, followed by a list of body parts. As you've probably guessed, these parts make up the physical form of the colossus. But the colossus has to be made out of something - it has to have tissues, and those tissues also have to be made out of something - in this case, bronze.
  
 
Below the BODY token you'll see a TISSUE token, followed by an identifier, much like the others we've seen. The TISSUE block is determining how the tissue works, and which purposes it'll serve. As the colossus is just going to be made out of this one tissue, this tissue needs to act like bone, muscle, and everything else combined, hence the MUSCULAR, FUNCTIONAL and STRUCTURAL tokens. The tissue also references a material - INORGANIC:BRONZE - the properties of which are declared in the inorganic materials file, and the tissue is subsequently made out of this material. With us so far?
 
Below the BODY token you'll see a TISSUE token, followed by an identifier, much like the others we've seen. The TISSUE block is determining how the tissue works, and which purposes it'll serve. As the colossus is just going to be made out of this one tissue, this tissue needs to act like bone, muscle, and everything else combined, hence the MUSCULAR, FUNCTIONAL and STRUCTURAL tokens. The tissue also references a material - INORGANIC:BRONZE - the properties of which are declared in the inorganic materials file, and the tissue is subsequently made out of this material. With us so far?
  
Below the tissue definition is the TISSUE_LAYER line. TISSUE_LAYER allows you to control where each tissue is applied. Its first argument defines if it's to search by bodypart category (BY_CATEGORY), bodypart type (BY_TYPE), or look for a specific part (BY_TOKEN). That's followed by the parts argument itself, which is in this case ALL (so the game's looking for parts in all categories, which is to say, every bodypart). This is followed by the tissue to be applied, BRONZE. So the TISSUE_LAYER token is telling the game to select all bodyparts in every category and make them out of the tissue "BRONZE". The colossus is now made of bronze.
+
Below the tissue definition is the TISSUE_LAYER line. TISSUE_LAYER allows you to control where each tissue is applied. Its first argument defines if it's to search by body part category (BY_CATEGORY), body part type (BY_TYPE), or look for a specific part (BY_TOKEN). That's followed by the parts argument itself, which is in this case ALL (so the game's looking for parts in all categories, which is to say, every body part). This is followed by the tissue to be applied, BRONZE. So the TISSUE_LAYER token is telling the game to select all body parts in every category and make them out of the tissue "BRONZE". The colossus is now made of bronze.
  
By now you're probably thinking "Wow, if this was for a creature made out of however many tissues, this would be amazingly longwinded". And you're right. Luckily, there are two methods by which we can speed things up a lot.
+
By now you're probably thinking "Wow, if this was for a creature made out of however many tissues, this would be amazingly longwinded" and you're right. Luckily, there are two methods by which we can speed things up a lot.
  
 
Firstly, there are material and tissue templates. Let's say you were going to make a lot of creatures out of bronze, and you didn't want to have to copy and paste the bronze tissue all over the place. Instead, you create a tissue template. This goes, as you've probably guessed, in a tissue template file.
 
Firstly, there are material and tissue templates. Let's say you were going to make a lot of creatures out of bronze, and you didn't want to have to copy and paste the bronze tissue all over the place. Instead, you create a tissue template. This goes, as you've probably guessed, in a tissue template file.
  
 +
{{code|
 
  [TISSUE_TEMPLATE:BRONZE_TEMPLATE]
 
  [TISSUE_TEMPLATE:BRONZE_TEMPLATE]
 
     [TISSUE_NAME:bronze:bronze]
 
     [TISSUE_NAME:bronze:bronze]
Line 166: Line 302:
 
     [CONNECTS]
 
     [CONNECTS]
 
     [TISSUE_SHAPE:LAYER]
 
     [TISSUE_SHAPE:LAYER]
 +
}}
  
 
Now, instead of applying the tissue to each and every bronze creature you're making, you can just refer to the template:
 
Now, instead of applying the tissue to each and every bronze creature you're making, you can just refer to the template:
  
 +
{{code|
 
  ...
 
  ...
 
  [BODY:HUMANOID:2EYES:2EARS:NOSE:HUMANOID_JOINTS:5FINGERS:5TOES]
 
  [BODY:HUMANOID:2EYES:2EARS:NOSE:HUMANOID_JOINTS:5FINGERS:5TOES]
Line 175: Line 313:
 
  [TISSUE_LAYER:BY_CATEGORY:ALL:BRONZE]
 
  [TISSUE_LAYER:BY_CATEGORY:ALL:BRONZE]
 
  ...
 
  ...
 +
}}
  
 
Material templates work in the same way, but refer to materials instead of tissues.
 
Material templates work in the same way, but refer to materials instead of tissues.
Line 180: Line 319:
 
However, if we're looking at something like a dwarf, even with the templates, editing can get very slow indeed:
 
However, if we're looking at something like a dwarf, even with the templates, editing can get very slow indeed:
  
 +
{{code|
 
     ...
 
     ...
 
     [USE_MATERIAL_TEMPLATE:SKIN:SKIN_TEMPLATE]
 
     [USE_MATERIAL_TEMPLATE:SKIN:SKIN_TEMPLATE]
Line 203: Line 343:
 
     [USE_TISSUE_TEMPLATE:MUSCLE:MUSCLE_TEMPLATE]
 
     [USE_TISSUE_TEMPLATE:MUSCLE:MUSCLE_TEMPLATE]
 
     ...
 
     ...
 +
}}
  
This is where body detail plans come in. Detail plans, of course, have their own file, and they are designed to help automate some of the more common processes in creature creation. The first entry in b_detail_plan_default.txt does exactly what we've been trying to do above: it takes all the common materials and shoves them into one plan, which can be referenced with a single token.
+
This is where body detail plans, which have their own file, and are designed to help automate some of the more common processes in creature creation, come in. The first entry in b_detail_plan_default.txt does exactly what we've been trying to do above: it takes all the common materials and shoves them into one plan, which can be referenced with a single token.
  
 +
{{code|
 
     ...
 
     ...
 
     [BODY_DETAIL_PLAN:STANDARD_MATERIALS]
 
     [BODY_DETAIL_PLAN:STANDARD_MATERIALS]
 
     ...
 
     ...
 +
}}
  
 
Much easier. But what about the TISSUE_LAYER tokens? Will we have to type out all of those manually?
 
Much easier. But what about the TISSUE_LAYER tokens? Will we have to type out all of those manually?
Line 214: Line 357:
 
Nope, detail plans have that covered as well. It's possible to place variable arguments into a detail plan. For example:
 
Nope, detail plans have that covered as well. It's possible to place variable arguments into a detail plan. For example:
  
 +
{{code|
 
  [BODY_DETAIL_PLAN:VERTEBRATE_TISSUE_LAYERS]
 
  [BODY_DETAIL_PLAN:VERTEBRATE_TISSUE_LAYERS]
 
     [BP_LAYERS:BY_CATEGORY:BODY:ARG3:50:ARG2:5:ARG1:1]
 
     [BP_LAYERS:BY_CATEGORY:BODY:ARG3:50:ARG2:5:ARG1:1]
Line 223: Line 367:
 
     [BP_LAYERS:BY_CATEGORY:NOSE:ARG5:4:ARG1:1]
 
     [BP_LAYERS:BY_CATEGORY:NOSE:ARG5:4:ARG1:1]
 
     ...
 
     ...
 +
}}
  
 
First an argument is placed in the plan (ARG1, ARG2 etc.), followed by the thickness of the tissue that will be inserted in place of the argument. So when we reference the VERTEBRATE_TISSUE_LAYERS plan, we'll be able to do something like this:
 
First an argument is placed in the plan (ARG1, ARG2 etc.), followed by the thickness of the tissue that will be inserted in place of the argument. So when we reference the VERTEBRATE_TISSUE_LAYERS plan, we'll be able to do something like this:
  
 +
{{code|
 
     [BODY_DETAIL_PLAN:VERTEBRATE_TISSUE_LAYERS:SKIN:FAT:MUSCLE:BONE:CARTILAGE]
 
     [BODY_DETAIL_PLAN:VERTEBRATE_TISSUE_LAYERS:SKIN:FAT:MUSCLE:BONE:CARTILAGE]
 +
}}
  
ARG1 in the detail plan is replaced by SKIN, the first tissue we entered. ARG2 is replaced by FAT, ARG3 by muscle, ARG4 by bone, and ARG5 by CARTILAGE. Hence, our creature's bodypart designated as BODY is made up of SKIN with thickness 1, FAT with thickness 5, and MUSCLE with thickness 50. Its nose is made up of SKIN (thickness 1) and CARTILAGE (thickness 4).
+
ARG1 in the detail plan is replaced by SKIN, the first tissue we entered. ARG2 is replaced by FAT, ARG3 by MUSCLE, ARG4 by BONE, and ARG5 by CARTILAGE. Hence, our creature's body part designated as BODY is made up of SKIN with thickness 1, FAT with thickness 5, and MUSCLE with thickness 50. Its nose is made up of SKIN (thickness 1) and CARTILAGE (thickness 4).
  
 
Things left out of the body plans aside, our dwarf's entire body, material, tissue and tissue layer tokens have been boiled down to this:
 
Things left out of the body plans aside, our dwarf's entire body, material, tissue and tissue layer tokens have been boiled down to this:
  
 +
{{code|
 
     ...
 
     ...
 
     [BODY:HUMANOID:2EYES:2EARS:NOSE:2LUNGS:HEART:GUTS:ORGANS:HUMANOID_JOINTS:
 
     [BODY:HUMANOID:2EYES:2EARS:NOSE:2LUNGS:HEART:GUTS:ORGANS:HUMANOID_JOINTS:
Line 239: Line 387:
 
     [BODY_DETAIL_PLAN:VERTEBRATE_TISSUE_LAYERS:SKIN:FAT:MUSCLE:BONE:CARTILAGE]
 
     [BODY_DETAIL_PLAN:VERTEBRATE_TISSUE_LAYERS:SKIN:FAT:MUSCLE:BONE:CARTILAGE]
 
     ...
 
     ...
 +
}}
  
 
This can save you a lot of time and space if you're making lots of changes common to many creatures. In general, if you're making a creature that's fleshy or chitinous, there are detail plans already included in the game to help you out. You should only have to resort to declaring tissues individually (like our bronze colossus) if you're doing something really out-of-the-ordinary.
 
This can save you a lot of time and space if you're making lots of changes common to many creatures. In general, if you're making a creature that's fleshy or chitinous, there are detail plans already included in the game to help you out. You should only have to resort to declaring tissues individually (like our bronze colossus) if you're doing something really out-of-the-ordinary.
  
Another great thing about templates (and so, detail plans) is that they can be modified after being declared. Let's say we wanted our dwarves to be perpetually on fire (don't ask). We declare the body stuff normally:
+
Another great thing about templates (and so, detail plans) is that they can be modified after being declared. Let's say we wanted our dwarves to be perpetually on fire (don't ask). We leave the body stuff declared normally:
  
 +
{{code|
 
     ...
 
     ...
 
     [BODY:HUMANOID:2EYES:2EARS:NOSE:2LUNGS:HEART:GUTS:ORGANS:HUMANOID_JOINTS:
 
     [BODY:HUMANOID:2EYES:2EARS:NOSE:2LUNGS:HEART:GUTS:ORGANS:HUMANOID_JOINTS:
Line 251: Line 401:
 
     [BODY_DETAIL_PLAN:VERTEBRATE_TISSUE_LAYERS:SKIN:FAT:MUSCLE:BONE:CARTILAGE]
 
     [BODY_DETAIL_PLAN:VERTEBRATE_TISSUE_LAYERS:SKIN:FAT:MUSCLE:BONE:CARTILAGE]
 
     ...
 
     ...
 +
}}
  
We then select the appropriate material:
+
We then, in our own mod, select the appropriate material:
  
    ...
+
{{code|
    [BODY:HUMANOID:2EYES:2EARS:NOSE:2LUNGS:HEART:GUTS:ORGANS:HUMANOID_JOINTS:
+
[SELECT_CREATURE:DWARF]
    THROAT:NECK:SPINE:BRAIN:SKULL:5FINGERS:5TOES:MOUTH:FACIAL_FEATURES:TEETH:RIBCAGE]
 
    [BODY_DETAIL_PLAN:STANDARD_MATERIALS]
 
    [BODY_DETAIL_PLAN:STANDARD_TISSUES]
 
    [BODY_DETAIL_PLAN:VERTEBRATE_TISSUE_LAYERS:SKIN:FAT:MUSCLE:BONE:CARTILAGE]
 
 
     [SELECT_MATERIAL:SKIN]
 
     [SELECT_MATERIAL:SKIN]
 
         [MAT_FIXED_TEMP:10600]
 
         [MAT_FIXED_TEMP:10600]
 
     ...
 
     ...
 +
}}
  
 
We don't want them burning to death, so we'll need to stop that from happening:
 
We don't want them burning to death, so we'll need to stop that from happening:
  
    ...
+
{{code|
    [BODY:HUMANOID:2EYES:2EARS:NOSE:2LUNGS:HEART:GUTS:ORGANS:HUMANOID_JOINTS:
+
[SELECT_CREATURE:DWARF]
    THROAT:NECK:SPINE:BRAIN:SKULL:5FINGERS:5TOES:MOUTH:FACIAL_FEATURES:TEETH:RIBCAGE]
 
    [BODY_DETAIL_PLAN:STANDARD_MATERIALS]
 
    [BODY_DETAIL_PLAN:STANDARD_TISSUES]
 
    [BODY_DETAIL_PLAN:VERTEBRATE_TISSUE_LAYERS:SKIN:FAT:MUSCLE:BONE:CARTILAGE]
 
 
     [SELECT_MATERIAL:SKIN]
 
     [SELECT_MATERIAL:SKIN]
 
         [MAT_FIXED_TEMP:10600]
 
         [MAT_FIXED_TEMP:10600]
Line 277: Line 421:
 
         [HEATDAM_POINT:NONE]
 
         [HEATDAM_POINT:NONE]
 
     ...
 
     ...
 +
}}
  
 
Note that this makes use of DF's built-in temperature scale. You can read more about that [[Temperature|on this page]]. We're also referencing material tokens, which we haven't gone over yet - we'll talk about making your own materials later.
 
Note that this makes use of DF's built-in temperature scale. You can read more about that [[Temperature|on this page]]. We're also referencing material tokens, which we haven't gone over yet - we'll talk about making your own materials later.
  
=== Creature castes ===
+
==== Creature castes ====
  
 
Another potentially extremely powerful part of the creature raws is the caste system. The caste system handles both true biological castes and lesser variations, such as sexes.
 
Another potentially extremely powerful part of the creature raws is the caste system. The caste system handles both true biological castes and lesser variations, such as sexes.
Line 286: Line 431:
 
To understand the true potential of the caste system, we only need to take a look at the raws for antmen, found in creature_subterrenean.txt:
 
To understand the true potential of the caste system, we only need to take a look at the raws for antmen, found in creature_subterrenean.txt:
  
 +
{{code|
 
     ...
 
     ...
 
     [CASTE:WORKER]
 
     [CASTE:WORKER]
Line 321: Line 467:
 
             [ATTACK_VERB:punch:punches]
 
             [ATTACK_VERB:punch:punches]
 
     ...
 
     ...
 +
}}
  
 
It's evident that the process of creating and editing castes is comparable to the modifications we were making to tissues and materials earlier: A caste is declared, and modifications to the base creature are made. Declared castes can be selected and subsequently modified, again, just like tissues and materials.
 
It's evident that the process of creating and editing castes is comparable to the modifications we were making to tissues and materials earlier: A caste is declared, and modifications to the base creature are made. Declared castes can be selected and subsequently modified, again, just like tissues and materials.
  
In this case, each caste is declared, given its own name, and a POP_RATIO, which determines how commonly a birth results in that caste - for every 10000 workers born, there'll be an average of 1000 soldiers, 5 drones and one queen. You've probably also noticed that the DRONE and QUEEN castes have the MALE and FEMALE tokens respectively - these tokens determine how breeding works. A creature without both a MALE caste and a FEMALE caste will be unable to breed (no asexual creatures yet, unfortunately). As they lack FEMALE, the workers and soldiers are unable to breed with the male drones.
+
In this case, each caste is declared, given its own name, and a POP_RATIO, which determines how commonly a birth results in that caste - for every 10000 workers born, there'll be an average of 1000 soldiers, 5 drones and one queen. You've probably also noticed that the DRONE and QUEEN castes have the MALE and FEMALE tokens respectively - these tokens determine how breeding works. A creature without both a MALE caste and a FEMALE caste will be unable to breed (no asexually reproducing creatures yet, unfortunately). As they lack FEMALE, the workers and soldiers are unable to breed with the male drones.
  
After this, there are some modifications to bodyparts. In this case, the drones have wings and the FLIER token, which the other castes lack. It's entirely possible for creatures of different castes to have completely different body stuctures, even to the extent that they don't resemble each other at all. If you read the section of this guide that dealt with entities, you may remember a passing mention of multi-creature civilisations and how they don't quite work as you may think they would. The castes system is your workaround. You could create a caste that is, for all intents and purposes, a human, and another caste of the same creature that acts exactly like a giant cave spider, put the creature in a civ, and get a human-spider civ. The only flaw in this approach is that the castes will interbreed.
+
After this, there are some modifications to bodyparts. In this case, the drones have wings and the FLIER token, which the other castes lack. It's entirely possible for creatures of different castes to have completely different body structures, even to the extent that they don't resemble each other at all. If you read the section of this guide that dealt with entities, you may remember a passing mention of multi-creature civilisations and how they don't quite work as you may think they would. The castes system is your workaround. You could create a caste that is, for all intents and purposes, a human, and another caste of the same creature that acts exactly like a giant cave spider, put the creature in a civ, and get a human-spider civ. The only flaw in this approach is that the castes will interbreed.
  
 
That's the most complex components of creature creation out of the way. You should find the rest trivial by comparison.
 
That's the most complex components of creature creation out of the way. You should find the rest trivial by comparison.
  
== Modding items ==
+
=== Modding items ===
  
Items are fairly simple to deal with. By default, each item type is contained in its own file; this may help make browsing for a specific item easier, but from a purely technical point of view, it's possible to throw all items into one file. Unfortunately, item tokens don't seem to be especially well-documented (at least not as well as the other object types), but you should be able to figure out most things by way of our explanations and your assumptions.
+
Items are fairly simple to deal with. By default, each item type is contained in its own file; this may help make browsing for a specific item easier, but from a purely technical point of view, it's possible to throw all items into one file. Unfortunately, [[Item definition token|item definition tokens]] don't seem to be especially well-documented (at least not as well as the other object types), but you should be able to figure out most things by way of our explanations and your assumptions.
  
 
Let's look at the entry for, of course, the thong:
 
Let's look at the entry for, of course, the thong:
  
 +
{{code|
 
  [ITEM_PANTS:ITEM_PANTS_THONG]
 
  [ITEM_PANTS:ITEM_PANTS_THONG]
 
  [NAME:thong:thongs]
 
  [NAME:thong:thongs]
Line 346: Line 494:
 
  [LEATHER]
 
  [LEATHER]
 
  [STRUCTURAL_ELASTICITY_WOVEN_THREAD]
 
  [STRUCTURAL_ELASTICITY_WOVEN_THREAD]
 +
}}
  
 
Most of these are pretty obvious if one compares them to the other entries in the file. There's a layer for the item, determining where it's worn; a coverage value to determine how well it protects you from cold and other things; a size token to determine how much it counts for when it's under something else; a layer permit token to determine how much can be worn under it; and a material size token to determine how much raw material it takes to make it.
 
Most of these are pretty obvious if one compares them to the other entries in the file. There's a layer for the item, determining where it's worn; a coverage value to determine how well it protects you from cold and other things; a size token to determine how much it counts for when it's under something else; a layer permit token to determine how much can be worn under it; and a material size token to determine how much raw material it takes to make it.
Line 353: Line 502:
 
Weapons involve a little more detail:
 
Weapons involve a little more detail:
  
 +
{{code|
 
  [ITEM_WEAPON:ITEM_WEAPON_SWORD_2H]
 
  [ITEM_WEAPON:ITEM_WEAPON_SWORD_2H]
 
  [NAME:two-handed sword:two-handed swords]
 
  [NAME:two-handed sword:two-handed swords]
Line 361: Line 511:
 
  [MATERIAL_SIZE:5]
 
  [MATERIAL_SIZE:5]
 
  [ATTACK:EDGE:100000:8000:slash:slashes:NO_SUB:1250]
 
  [ATTACK:EDGE:100000:8000:slash:slashes:NO_SUB:1250]
 +
[ATTACK_PREPARE_AND_RECOVER:3:3]
 
  [ATTACK:EDGE:50:4000:stab:stabs:NO_SUB:1000]
 
  [ATTACK:EDGE:50:4000:stab:stabs:NO_SUB:1000]
 +
[ATTACK_PREPARE_AND_RECOVER:3:3]
 
  [ATTACK:BLUNT:100000:8000:slap:slaps:flat:1250]
 
  [ATTACK:BLUNT:100000:8000:slap:slaps:flat:1250]
 +
[ATTACK_PREPARE_AND_RECOVER:3:3]
 
  [ATTACK:BLUNT:100:1000:strike:strikes:pommel:1000]
 
  [ATTACK:BLUNT:100:1000:strike:strikes:pommel:1000]
 +
[ATTACK_PREPARE_AND_RECOVER:3:3]
 +
}}
  
 
SIZE determines how heavy the weapon is. This has a substantial effect on weapon effectiveness. SKILL determines which skill is used in using the weapon; a list of skills can be found [[skill token|on this page]]. MINIMUM_SIZE determines the minimum size a creature must be before the weapon can be wielded, while TWO_HANDED determines how large a creature must be in order to wield the weapon with one hand.
 
SIZE determines how heavy the weapon is. This has a substantial effect on weapon effectiveness. SKILL determines which skill is used in using the weapon; a list of skills can be found [[skill token|on this page]]. MINIMUM_SIZE determines the minimum size a creature must be before the weapon can be wielded, while TWO_HANDED determines how large a creature must be in order to wield the weapon with one hand.
Line 369: Line 524:
 
Attacks take a little more explanation. The first value determines the contact area of the weapon's attack; this should be high for slashing weapons and low for bludgeoning, piercing and poking ones. The second value determines how deep the weapon penetrates - for BLUNT attacks this value is ignored as they're not supposed to penetrate anyway, but in the case of EDGE attacks it should generally be lower for slashing attacks and higher for stabbing attacks.
 
Attacks take a little more explanation. The first value determines the contact area of the weapon's attack; this should be high for slashing weapons and low for bludgeoning, piercing and poking ones. The second value determines how deep the weapon penetrates - for BLUNT attacks this value is ignored as they're not supposed to penetrate anyway, but in the case of EDGE attacks it should generally be lower for slashing attacks and higher for stabbing attacks.
  
Following these are the nouns and verb used; they should be self-explanatory. Finally, we have the velocity modifier, which has a multiplying effect on the weapon's size for the purposes of determining how powerful it is in combat.
+
Following these are the nouns and verb used; they should be self-explanatory. Finally, we have the velocity modifier, which has a multiplying effect on the weapon's size for the purposes of determining how powerful it is in combat. But more accurate it describe distribution of momentum across length of weapon. So STAB perfomed with only muscular power and modifier is x1 (1000). SLASH performed with some rotating momentum of cutting edge, but sword is pretty balanced thru it's length and modifier is just x1.25 (1250). Axes, hammers and maces have more unbalanced mass distribution and weapon mass concentrated far from grasp, so higher modifiers.
 +
 
 +
ATTACK_PREPARE_AND_RECOVER determine number of game frames to perform these actions. In vanilla almost not varies for different weapons.
  
 
Other, more miscellaneous items are generally simple and shouldn't require any further explanation.
 
Other, more miscellaneous items are generally simple and shouldn't require any further explanation.
Line 375: Line 532:
 
Once you've made an item, you just add it to the civ entry so a civilization can actually craft it, and it's done.
 
Once you've made an item, you just add it to the civ entry so a civilization can actually craft it, and it's done.
  
== Modding language files ==
+
=== Modding language files ===
 +
{{main|Language token}}
  
 
Let's say you added a whole new species.  Sure, you could just swipe one of the existing translation files and steal their language for your species, but that's the lazy way!  If you want to create a whole new language, it is very simple.
 
Let's say you added a whole new species.  Sure, you could just swipe one of the existing translation files and steal their language for your species, but that's the lazy way!  If you want to create a whole new language, it is very simple.
  
First, you'd need a whole new language_RACE file, such as language_LIZARDMAN.txt, along with "language_LIZARDMAN" at the top of the file proceeded by [OBJECT:LANGUAGE] and [TRANSLATION:LIZARDMAN].  After that, it's just a matter of copy-pasting one of the existing language lists and editing the finished 'translated' word.  That's it! Then just add the translation link to your civ in entity_default.txt and it'll be added to the game on worldgen.
+
First, you'd need a whole new language_RACE file, such as language_LIZARDMAN.txt, along with "language_LIZARDMAN" at the top of the file proceeded by [OBJECT:LANGUAGE] and [TRANSLATION:LIZARDMAN].  After that, it's just a matter of copy-pasting one of the existing language lists and editing the finished 'translated' word.  That's it! Then just add the translation link to your civ in entity_default.txt and it'll be added to the game on worldgen.
 +
 
 +
All raw files use Code Page 437 encoding, and you should make sure you are editing these files in that format. As many text editors default to UTF-8, some characters with diacritical marks may fail to show properly. Saving one of the default language raw files in this state will overwrite these characters with the unicode question mark, which will corrupt the file. To fix this  replace the file with a clean one downloaded from the distributed version of DF.
  
 
(Note that the name of the file doesn't actually matter; however, it's good form to name the file after a creature if only that creature speaks the language.)
 
(Note that the name of the file doesn't actually matter; however, it's good form to name the file after a creature if only that creature speaks the language.)
  
== Modding body parts ==
+
=== Modding body parts ===
  
 
Imagine you have this fantastic idea for a multi-tentacled winged spider-monster. Sounds great! But in order to make this a reality you may need to create a new set of body parts for it. That's no problem! Making body parts is easy, though it may look complicated at first.  
 
Imagine you have this fantastic idea for a multi-tentacled winged spider-monster. Sounds great! But in order to make this a reality you may need to create a new set of body parts for it. That's no problem! Making body parts is easy, though it may look complicated at first.  
  
All of the default body definitions are located in body_default.txt and then linked to a creature in the creature's entry. We've talked about how bodyparts make up creatures earlier, in the creature section. You can mix and match them in the creature entry and it makes no difference, as long as they're there: each bodypart will link itself to the appropriate connection automatically when the creature is first created.
+
All of the default body definitions are located in body_default.txt and then linked to a creature in the creature's entry. We've talked about how bodyparts make up creatures earlier, in the creature section. You can mix and match them in the creature entry and it makes no difference, as long as they're there: each body part will link itself to the appropriate connection automatically when the creature is first created.
  
Body parts work by sections: you can add as many sections as you want to a bodypart definition, but generally you should keep it fairly low for ease of use. Each body section entry is in the, very simple, format:
+
Body parts work by sections: you can add as many sections as you want to a body part definition, but generally you should keep it fairly low for ease of use. Each body section entry is in the, very simple, format:
  
 +
{{code|
 
  [BODY:BODYNAME]
 
  [BODY:BODYNAME]
 
  [BP:TOKENID:name][TOKENSGOHERE][DEFAULT_RELSIZE:][CATEGORY:WHATEVER]
 
  [BP:TOKENID:name][TOKENSGOHERE][DEFAULT_RELSIZE:][CATEGORY:WHATEVER]
 +
}}
  
The most important tokens are "CONTYPE" and "CON": CONTYPE means the bodypart in question is connected to a certain ''type'' of bodypart, while CON means it's connected to a ''specific'' one. TOKENID is yet another identifier, which should be unique, as it's referenced every time something uses CON or BY_TOKEN. DEFAULT_RELSIZE defines, of course, what the bodypart's size is in relation to the other parts. CATEGORY defines a category for the part, which can be unique or shared with other parts. This is referenced whenever BY_CATEGORY is used.
+
The most important tokens are "CONTYPE" and "CON": CONTYPE means the body part in question is connected to a certain ''type'' of body part, while CON means it's connected to a ''specific'' one. TOKENID is yet another identifier, which should be unique, as it's referenced every time something uses CON or BY_TOKEN. DEFAULT_RELSIZE defines, of course, what the body part's size is in relation to the other parts. CATEGORY defines a category for the part, which can be unique or shared with other parts. This is referenced whenever BY_CATEGORY is used.
  
A list of bodypart tokens can be found [[body token|here]].
+
A list of body part tokens can be found [[body token|here]].
  
 
Let's take a simple example, a head:
 
Let's take a simple example, a head:
  
 +
{{code|
 
  [BODY:BASIC_HEAD]
 
  [BODY:BASIC_HEAD]
 
  [BP:HD:head:STP][CONTYPE:UPPERBODY][HEAD][CATEGORY:HEAD]
 
  [BP:HD:head:STP][CONTYPE:UPPERBODY][HEAD][CATEGORY:HEAD]
 
  [DEFAULT_RELSIZE:300]
 
  [DEFAULT_RELSIZE:300]
 +
}}
  
 
It connects directly to an upper body.
 
It connects directly to an upper body.
  
 +
{{code|
 
  [BODY:2EYES]
 
  [BODY:2EYES]
 
     [BP:REYE:right eye:STP][CONTYPE:HEAD][SIGHT][EMBEDDED][SMALL][RIGHT][CATEGORY:EYE]
 
     [BP:REYE:right eye:STP][CONTYPE:HEAD][SIGHT][EMBEDDED][SMALL][RIGHT][CATEGORY:EYE]
Line 411: Line 576:
 
     [BP:LEYE:left eye:STP][CONTYPE:HEAD][SIGHT][EMBEDDED][SMALL][LEFT][CATEGORY:EYE]
 
     [BP:LEYE:left eye:STP][CONTYPE:HEAD][SIGHT][EMBEDDED][SMALL][LEFT][CATEGORY:EYE]
 
         [DEFAULT_RELSIZE:5]
 
         [DEFAULT_RELSIZE:5]
 +
}}
  
 
These are a pair of eyes, connecting to the head.
 
These are a pair of eyes, connecting to the head.
  
 +
{{code|
 
  [BODY:HUMANOID]
 
  [BODY:HUMANOID]
 
     [BP:UB:upper body:upper bodies][UPPERBODY][CATEGORY:BODY_UPPER]
 
     [BP:UB:upper body:upper bodies][UPPERBODY][CATEGORY:BODY_UPPER]
Line 445: Line 612:
 
     [BP:LF:left foot:left feet][CON:LLL][STANCE][LEFT][CATEGORY:FOOT]
 
     [BP:LF:left foot:left feet][CON:LLL][STANCE][LEFT][CATEGORY:FOOT]
 
         [DEFAULT_RELSIZE:120]
 
         [DEFAULT_RELSIZE:120]
 +
}}
  
 
An entire humanoid body. The foot bone's connected to the ankle bone...
 
An entire humanoid body. The foot bone's connected to the ankle bone...
Line 450: Line 618:
 
"BODYGLOSS" entries, which you can sometimes find applied to creature entries, are simply replacement words for specific part name strings in a creature. For example, you'll find the bodygloss [BODYGLOSS:CLAW_HAND:hand:claw] in body_default.txt; you can then use this in a creature via "[BODYGLOSS:CLAW_HAND]" and it'll replace all instances of "hand" with "claw" in that creature. Be warned, however—if you were to, say make a bodygloss [BODYGLOSS:EARSTALK:ear:stalk:ears:stalk], it would not only change "ear" and "ears" to "stalk" and "stalks", it would also change "h'''ear'''t" to "h'''stalk'''t"! For all intents and purposes the body part will still function as the proper part, though.
 
"BODYGLOSS" entries, which you can sometimes find applied to creature entries, are simply replacement words for specific part name strings in a creature. For example, you'll find the bodygloss [BODYGLOSS:CLAW_HAND:hand:claw] in body_default.txt; you can then use this in a creature via "[BODYGLOSS:CLAW_HAND]" and it'll replace all instances of "hand" with "claw" in that creature. Be warned, however—if you were to, say make a bodygloss [BODYGLOSS:EARSTALK:ear:stalk:ears:stalk], it would not only change "ear" and "ears" to "stalk" and "stalks", it would also change "h'''ear'''t" to "h'''stalk'''t"! For all intents and purposes the body part will still function as the proper part, though.
  
== Modding plants ==
+
=== Modding plants ===
  
 
Plants are, again, not unlike creatures. With what you've learned so far in regard to tokens and the materials system, running through the notes included in plant_standard.txt should explain most things. [[Plant token|Here's the list of plant-specific tokens]].
 
Plants are, again, not unlike creatures. With what you've learned so far in regard to tokens and the materials system, running through the notes included in plant_standard.txt should explain most things. [[Plant token|Here's the list of plant-specific tokens]].
Line 456: Line 624:
 
Below is the [[plump helmet]] raw description:
 
Below is the [[plump helmet]] raw description:
  
 +
{{code|
 
  [PLANT:MUSHROOM_HELMET_PLUMP]
 
  [PLANT:MUSHROOM_HELMET_PLUMP]
 
  [NAME:plump helmet][NAME_PLURAL:plump helmets][ADJ:plump helmet]
 
  [NAME:plump helmet][NAME_PLURAL:plump helmets][ADJ:plump helmet]
Line 493: Line 662:
 
  [SHRUB_COLOR:5:13:0]
 
  [SHRUB_COLOR:5:13:0]
 
  [DEAD_SHRUB_COLOR:5:6:0]
 
  [DEAD_SHRUB_COLOR:5:6:0]
 +
}}
  
 
Let's look at this line by line:<br>
 
Let's look at this line by line:<br>
 
First, we define its file name. In this case it's MUSHROOM_HELMET_PLUMP. Next we define its in-game name (plump helmet) and its adjective for if you were to craft with it (e.g. plump helmet earrings).
 
First, we define its file name. In this case it's MUSHROOM_HELMET_PLUMP. Next we define its in-game name (plump helmet) and its adjective for if you were to craft with it (e.g. plump helmet earrings).
  
 +
{{code|
 
  [USE_MATERIAL_TEMPLATE:STRUCTURAL:STRUCTURAL_PLANT_TEMPLATE]
 
  [USE_MATERIAL_TEMPLATE:STRUCTURAL:STRUCTURAL_PLANT_TEMPLATE]
 
  [MATERIAL_VALUE:2]
 
  [MATERIAL_VALUE:2]
 
  [BASIC_MAT:LOCAL_PLANT_MAT:STRUCTURAL]
 
  [BASIC_MAT:LOCAL_PLANT_MAT:STRUCTURAL]
 +
}}
  
 
This defines the structure and material of the plant. It references STRUCTURAL_PLANT_TEMPLATE in the first line, so if you were to say, add wings to the template, the plump helmet plant would be winged. This is for the plant itself, not the end plump helmets.
 
This defines the structure and material of the plant. It references STRUCTURAL_PLANT_TEMPLATE in the first line, so if you were to say, add wings to the template, the plump helmet plant would be winged. This is for the plant itself, not the end plump helmets.
Line 505: Line 677:
 
After that we get our edible tokens. These say that vermin can eat the plant, and it can be eaten raw or cooked by your dwarves. So if you wanted a plant vermin would leave alone, you'd remove the [EDIBLE_VERMIN] token.
 
After that we get our edible tokens. These say that vermin can eat the plant, and it can be eaten raw or cooked by your dwarves. So if you wanted a plant vermin would leave alone, you'd remove the [EDIBLE_VERMIN] token.
  
 +
{{code|
 
  [EDIBLE_VERMIN]
 
  [EDIBLE_VERMIN]
 
  [EDIBLE_RAW]
 
  [EDIBLE_RAW]
 
  [EDIBLE_COOKED]
 
  [EDIBLE_COOKED]
 +
}}
  
 
Next, [PICKED_TILE:161] is the character (161 in this case) shown when the crop is harvested. See [[Main:Character table|character table]] for a table of usable tiles. [PICKED_COLOR:6:13:0] is the color used for the crop's tile when harvested. It's in a foreground:background:brightness format. See [[color]] for the colors usable.
 
Next, [PICKED_TILE:161] is the character (161 in this case) shown when the crop is harvested. See [[Main:Character table|character table]] for a table of usable tiles. [PICKED_COLOR:6:13:0] is the color used for the crop's tile when harvested. It's in a foreground:background:brightness format. See [[color]] for the colors usable.
  
 +
{{code|
 
  [PICKED_TILE:161][PICKED_COLOR:6:13:0]
 
  [PICKED_TILE:161][PICKED_COLOR:6:13:0]
 +
}}
  
 
[GROWDUR:300] is how long it takes for your crop to grow. There are 1008 growdur units in a season.<br>
 
[GROWDUR:300] is how long it takes for your crop to grow. There are 1008 growdur units in a season.<br>
[VALUE:2] Is the value of harvested plant (default 1). Appears to have no effect in version 0.31.
+
[VALUE:2] Is the value of the harvested plant (default 1).  
  
 +
{{code|
 
  [GROWDUR:300][VALUE:2]
 
  [GROWDUR:300][VALUE:2]
 +
}}
  
 
This defines the plant's alcohol states. [STATE_NAME_ADJ:ALL_SOLID:] is the frozen name, followed is the actual drink name, and then its boiling name. These are achieved by either Scorching or Freezing climates. [DISPLAY_COLOR] is, of course, color, and [EDIBLE_RAW] and [EDIBLE_COOKED] are saying you can drink the alcohol raw or cooked.
 
This defines the plant's alcohol states. [STATE_NAME_ADJ:ALL_SOLID:] is the frozen name, followed is the actual drink name, and then its boiling name. These are achieved by either Scorching or Freezing climates. [DISPLAY_COLOR] is, of course, color, and [EDIBLE_RAW] and [EDIBLE_COOKED] are saying you can drink the alcohol raw or cooked.
  
 +
{{code|
 
  [USE_MATERIAL_TEMPLATE:DRINK:PLANT_ALCOHOL_TEMPLATE]
 
  [USE_MATERIAL_TEMPLATE:DRINK:PLANT_ALCOHOL_TEMPLATE]
 
  [STATE_NAME_ADJ:ALL_SOLID:frozen dwarven wine]
 
  [STATE_NAME_ADJ:ALL_SOLID:frozen dwarven wine]
Line 530: Line 709:
 
  [PREFIX:NONE]
 
  [PREFIX:NONE]
 
  [DRINK:LOCAL_PLANT_MAT:DRINK]
 
  [DRINK:LOCAL_PLANT_MAT:DRINK]
 +
}}
  
 
After that we get our seed template:
 
After that we get our seed template:
  
 +
{{code|
 
  [USE_MATERIAL_TEMPLATE:SEED:SEED_TEMPLATE]
 
  [USE_MATERIAL_TEMPLATE:SEED:SEED_TEMPLATE]
 
  [MATERIAL_VALUE:1]
 
  [MATERIAL_VALUE:1]
Line 538: Line 719:
 
  [EDIBLE_COOKED]
 
  [EDIBLE_COOKED]
 
  [SEED:plump helmet spawn:plump helmet spawn:4:0:1:LOCAL_PLANT_MAT:SEED]
 
  [SEED:plump helmet spawn:plump helmet spawn:4:0:1:LOCAL_PLANT_MAT:SEED]
 +
}}
  
 
And all this says is that the seeds may be eaten by vermin or cooked. Then it gives the name of our plant's seed, its plural name, its foreground, background, and brightness colors, followed by its seed material; said material should have [SEED_MAT] to permit proper stockpiling.
 
And all this says is that the seeds may be eaten by vermin or cooked. Then it gives the name of our plant's seed, its plural name, its foreground, background, and brightness colors, followed by its seed material; said material should have [SEED_MAT] to permit proper stockpiling.
Line 543: Line 725:
 
And finally for the last chunk we have this:
 
And finally for the last chunk we have this:
  
 +
{{code|
 
  [SPRING][SUMMER][AUTUMN][WINTER]
 
  [SPRING][SUMMER][AUTUMN][WINTER]
 
  [FREQUENCY:100]
 
  [FREQUENCY:100]
Line 554: Line 737:
 
  [SHRUB_COLOR:5:13:0]
 
  [SHRUB_COLOR:5:13:0]
 
  [DEAD_SHRUB_COLOR:5:6:0]
 
  [DEAD_SHRUB_COLOR:5:6:0]
 +
}}
  
 
First we define what season(s) the plant may grow in, then we define how frequently this plant is generated in a particular area, followed by how many harvested crop items may come from 1 plant. [PREFSTRING:] is what your dwarves like about the plant, which in this case is the rounded tops. [WET][DRY] are the conditions under which the plant can grow. Wet means it can grow close to water, dry means it can grow away from water. This does not mean you can grow the plant on dry stone however. It is just for natural spawning of the plant.<br>
 
First we define what season(s) the plant may grow in, then we define how frequently this plant is generated in a particular area, followed by how many harvested crop items may come from 1 plant. [PREFSTRING:] is what your dwarves like about the plant, which in this case is the rounded tops. [WET][DRY] are the conditions under which the plant can grow. Wet means it can grow close to water, dry means it can grow away from water. This does not mean you can grow the plant on dry stone however. It is just for natural spawning of the plant.<br>
[BIOME] Is what biome the plant grows in. [UNDERGROUND_DEPTH:Minimum:Maximum] Is the highest and lowest cavern levels that the plant can appear in if its biome is subterranean. Dwarven civilizations will only export (via the embark screen or caravans) things that available at depth 1. Defaults to 0:0 (surface only).<br>
+
[BIOME] Is what biome the plant grows in. [UNDERGROUND_DEPTH:Minimum:Maximum] Is the highest and lowest cavern levels that the plant can appear in if its biome is subterranean. Dwarven civilizations will only export (via the embark screen or caravans) things that are available at depth 1. Defaults to 0:0 (surface only).<br>
 
Lastly, [SHRUB_TILE] is the character used for the naturally spawning shrub of this plant, [DEAD_SHRUB] is the dead shrub character. [SHRUB_COLOR] Is the shrub's color, and [DEAD_SHRUB_COLOR] is, of course, the dead shrub's color.
 
Lastly, [SHRUB_TILE] is the character used for the naturally spawning shrub of this plant, [DEAD_SHRUB] is the dead shrub character. [SHRUB_COLOR] Is the shrub's color, and [DEAD_SHRUB_COLOR] is, of course, the dead shrub's color.
  
Line 562: Line 746:
 
For the rest of the tokens, see [[plant token]].
 
For the rest of the tokens, see [[plant token]].
  
== Workshops ==
+
==== Trees ====
 +
 
 +
Trees are another kind of plant that can be modded. Being plants, they use many of the same tokens as edible crops, but differ in having a few tree-specific tokens.
 +
 
 +
Below is the [[apple|apple tree]] raw description:
 +
 
 +
{{code|
 +
  [PLANT:APPLE] malus sieversii
 +
  [NAME:apple tree][NAME_PLURAL:apple trees][ADJ:apple tree]
 +
  [USE_MATERIAL_TEMPLATE:STRUCTURAL:STRUCTURAL_PLANT_TEMPLATE]
 +
  [BASIC_MAT:LOCAL_PLANT_MAT:STRUCTURAL]
 +
  [USE_MATERIAL_TEMPLATE:WOOD:WOOD_TEMPLATE]
 +
  [STATE_NAME:ALL_SOLID:apple wood]
 +
  [STATE_ADJ:ALL_SOLID:apple wood]
 +
  [PREFIX:NONE]
 +
  [SOLID_DENSITY:745] *** http://www.csudh.edu/oliver/chemdata/woods.htm
 +
  [STATE_COLOR:ALL_SOLID:CHOCOLATE] *** http://www.forestryforum.com/board/index.php/topic,61009.0.html
 +
  [USE_MATERIAL_TEMPLATE:DRINK:PLANT_ALCOHOL_TEMPLATE]
 +
    [STATE_NAME_ADJ:ALL_SOLID:frozen apple cider]
 +
  [STATE_NAME_ADJ:LIQUID:apple cider]
 +
  [STATE_NAME_ADJ:GAS:boiling apple cider]
 +
  [MATERIAL_VALUE:2]
 +
  [DISPLAY_COLOR:6:0:0]
 +
  [EDIBLE_RAW]
 +
    [EDIBLE_COOKED]
 +
  [PREFIX:NONE]
 +
  [DRINK:LOCAL_PLANT_MAT:DRINK]
 +
  [USE_MATERIAL_TEMPLATE:LEAF:LEAF_TEMPLATE]
 +
  [STATE_COLOR:ALL:GREEN]
 +
  [DISPLAY_COLOR:2:0:0]
 +
  [USE_MATERIAL_TEMPLATE:FLOWER:FLOWER_TEMPLATE]
 +
  [STATE_COLOR:ALL:ROSE]
 +
  [DISPLAY_COLOR:5:0:1]
 +
  [USE_MATERIAL_TEMPLATE:FRUIT:FRUIT_TEMPLATE]
 +
  [STATE_COLOR:ALL:RUST]
 +
  [DISPLAY_COLOR:4:0:0]
 +
  [EDIBLE_VERMIN]
 +
  [EDIBLE_RAW]
 +
  [EDIBLE_COOKED]
 +
  [STOCKPILE_PLANT_GROWTH]
 +
  [MATERIAL_REACTION_PRODUCT:DRINK_MAT:LOCAL_PLANT_MAT:DRINK]
 +
  [MATERIAL_REACTION_PRODUCT:SEED_MAT:LOCAL_PLANT_MAT:SEED]
 +
  [USE_MATERIAL_TEMPLATE:SEED:SEED_TEMPLATE]
 +
  [MATERIAL_VALUE:1]
 +
  [EDIBLE_VERMIN]
 +
  [SEED:apple seed:apple seeds:0:0:1:LOCAL_PLANT_MAT:SEED]
 +
  [TREE:LOCAL_PLANT_MAT:WOOD][TREE_TILE:5]
 +
  [TRUNK_PERIOD:10]
 +
  [HEAVY_BRANCH_DENSITY:25]
 +
  [BRANCH_DENSITY:50]
 +
  [MAX_TRUNK_HEIGHT:3]
 +
  [HEAVY_BRANCH_RADIUS:1]
 +
  [BRANCH_RADIUS:2]
 +
  [TRUNK_BRANCHING:2]
 +
  [MAX_TRUNK_DIAMETER:1]
 +
  [TRUNK_WIDTH_PERIOD:200]
 +
  [ROOT_DENSITY:5]
 +
  [ROOT_RADIUS:3]
 +
  [STANDARD_TILE_NAMES]
 +
  [PREFSTRING:fruit]
 +
  [DRY]
 +
  [BIOME:ANY_TEMPERATE]
 +
  [SAPLING]
 +
  [GROWTH:LEAVES]
 +
  [GROWTH_NAME:apple leaf:apple leaves]
 +
  [GROWTH_ITEM:PLANT_GROWTH:NONE:LOCAL_PLANT_MAT:LEAF]
 +
  [GROWTH_DENSITY:1000]
 +
  [GROWTH_HOST_TILE:BRANCHES_AND_TWIGS]
 +
  [GROWTH_HOST_TILE:SAPLING]
 +
  [GROWTH_TIMING:0:300000]
 +
  [GROWTH_PRINT:0:6:2:0:0:0:209999:1]
 +
  [GROWTH_PRINT:0:6:6:0:1:210000:239999:1] autumn color
 +
  [GROWTH_PRINT:0:6:4:0:1:240000:269999:1]
 +
[GROWTH_PRINT:0:6:4:0:0:270000:300000:1]
 +
  [GROWTH_DROPS_OFF]
 +
  [GROWTH:FLOWERS]
 +
  [GROWTH_NAME:apple flower:STP]
 +
  [GROWTH_ITEM:PLANT_GROWTH:NONE:LOCAL_PLANT_MAT:FLOWER]
 +
  [GROWTH_DENSITY:1000]
 +
  [GROWTH_HOST_TILE:BRANCHES_AND_TWIGS]
 +
  [GROWTH_TIMING:60000:119999]
 +
  [GROWTH_PRINT:5:5:5:0:1:60000:119999:2]
 +
[GROWTH:FRUIT]
 +
  [GROWTH_NAME:apple:STP]
 +
  [GROWTH_ITEM:PLANT_GROWTH:NONE:LOCAL_PLANT_MAT:FRUIT]
 +
  [GROWTH_DENSITY:1000]
 +
  [GROWTH_HOST_TILE:BRANCHES_AND_TWIGS]
 +
  [GROWTH_TIMING:120000:200000]
 +
  [GROWTH_DROPS_OFF_NO_CLOUD]
 +
  [GROWTH_PRINT:'%':'%':4:0:0:120000:200000:3]
 +
  [GROWTH_HAS_SEED]
 +
}}
 +
 
 +
The first lines are the same as the ones we saw being used in the plump helmets, defining the plant object, giving it a name, and deciding that it should use the standard STRUCTURAL_PLANT material for its structure.
 +
 
 +
{{code|
 +
[PLANT:APPLE] malus sieversii
 +
[NAME:apple tree][NAME_PLURAL:apple trees][ADJ:apple tree]
 +
[USE_MATERIAL_TEMPLATE:STRUCTURAL:STRUCTURAL_PLANT_TEMPLATE]
 +
[BASIC_MAT:LOCAL_PLANT_MAT:STRUCTURAL]
 +
}}
 +
 
 +
Adding the token [[DF2014:Material_definition_token#DISPLAY_COLOR|DISPLAY_COLOR]] directly after [USE_MATERIAL_TEMPLATE] would allow us to change the color of the tree.
 +
 
 +
{{code|
 +
        [USE_MATERIAL_TEMPLATE:STRUCTURAL:STRUCTURAL_PLANT_TEMPLATE]
 +
        [DISPLAY_COLOR:1:0:0]
 +
[BASIC_MAT:LOCAL_PLANT_MAT:STRUCTURAL]
 +
}}
 +
 
 +
would give us a dark blue apple tree. This method is used by the game in [[birch|birches]] and [[spore tree|various]] [[nether-cap|underground]] [[blood thorn|trees]].
 +
 
 +
Next come the definitions of various other materials used by the tree:
 +
 
 +
{{code|
 +
        [USE_MATERIAL_TEMPLATE:WOOD:WOOD_TEMPLATE]
 +
  [STATE_NAME:ALL_SOLID:apple wood]
 +
  [STATE_ADJ:ALL_SOLID:apple wood]
 +
  [PREFIX:NONE]
 +
  [SOLID_DENSITY:745] *** http://www.csudh.edu/oliver/chemdata/woods.htm
 +
  [STATE_COLOR:ALL_SOLID:CHOCOLATE] *** http://www.forestryforum.com/board/index.php/topic,61009.0.html
 +
  [USE_MATERIAL_TEMPLATE:DRINK:PLANT_ALCOHOL_TEMPLATE]
 +
    [STATE_NAME_ADJ:ALL_SOLID:frozen apple cider]
 +
  [STATE_NAME_ADJ:LIQUID:apple cider]
 +
  [STATE_NAME_ADJ:GAS:boiling apple cider]
 +
  [MATERIAL_VALUE:2]
 +
  [DISPLAY_COLOR:6:0:0]
 +
  [EDIBLE_RAW]
 +
    [EDIBLE_COOKED]
 +
  [PREFIX:NONE]
 +
  [DRINK:LOCAL_PLANT_MAT:DRINK]
 +
  [USE_MATERIAL_TEMPLATE:LEAF:LEAF_TEMPLATE]
 +
  [STATE_COLOR:ALL:GREEN]
 +
  [DISPLAY_COLOR:2:0:0]
 +
  [USE_MATERIAL_TEMPLATE:FLOWER:FLOWER_TEMPLATE]
 +
  [STATE_COLOR:ALL:ROSE]
 +
  [DISPLAY_COLOR:5:0:1]
 +
  [USE_MATERIAL_TEMPLATE:FRUIT:FRUIT_TEMPLATE]
 +
  [STATE_COLOR:ALL:RUST]
 +
  [DISPLAY_COLOR:4:0:0]
 +
  [EDIBLE_VERMIN]
 +
  [EDIBLE_RAW]
 +
  [EDIBLE_COOKED]
 +
  [STOCKPILE_PLANT_GROWTH]
 +
  [MATERIAL_REACTION_PRODUCT:DRINK_MAT:LOCAL_PLANT_MAT:DRINK]
 +
  [MATERIAL_REACTION_PRODUCT:SEED_MAT:LOCAL_PLANT_MAT:SEED]
 +
  [USE_MATERIAL_TEMPLATE:SEED:SEED_TEMPLATE]
 +
  [MATERIAL_VALUE:1]
 +
  [EDIBLE_VERMIN]
 +
  [SEED:apple seed:apple seeds:0:0:1:LOCAL_PLANT_MAT:SEED]
 +
}}
 +
 
 +
 
 +
From them, we get to know what the parts of the tree can be used for, as well as how they will appear when separated from the tree. Any alterations that can be done to materials normally can be done here, such as changing the value or adding a [[syndrome]].
 +
 
 +
[TREE:LOCAL_PLANT_MAT:WOOD][TREE_TILE:5]
 +
 
 +
[TREE] is what turns your plant object into an actual tree. The following argument describes what material the harvested logs should be made of. If NONE, the felled tree will give no logs. [TREE_TILE] is the tile the tree shows up as on the world map.
 +
 
 +
Note that all vanilla trees (that give logs) use the WOOD material defined above as the argument for [TREE], as opposed to the STRUCTURAL material. Thus, any changes to the properties of the wood harvested should be done to the WOOD material.
 +
 
 +
The following tokens decide the dimensions of the tree, and how it grows.
 +
 
 +
{{code|
 +
    [TRUNK_PERIOD:10]
 +
[HEAVY_BRANCH_DENSITY:25]
 +
[BRANCH_DENSITY:50]
 +
[MAX_TRUNK_HEIGHT:3]
 +
[HEAVY_BRANCH_RADIUS:1]
 +
[BRANCH_RADIUS:2]
 +
[TRUNK_BRANCHING:2]
 +
[MAX_TRUNK_DIAMETER:1]
 +
[TRUNK_WIDTH_PERIOD:200]
 +
[ROOT_DENSITY:5]
 +
[ROOT_RADIUS:3]
 +
}}
 +
 
 +
 
 +
[TRUNK_PERIOD] and [TRUNK_WIDTH_PERIOD] determine how long it takes for the trunk to grow one tile taller respectively wider, in years. [MAX_TRUNK_HEIGHT:3] and [MAX_TRUNK_DIAMETER:1] determine the maximum value the above can reach. [TRUNK_BRANCHING] decides how "curvy" the tree is, with [TRUNK_BRANCHING:0] meaning the tree is entirely straight.
 +
 
 +
[HEAVY_BRANCH_DENSITY:25], [HEAVY_BRANCH_RADIUS:1], [BRANCH_DENSITY:50], [BRANCH_RADIUS:2], [ROOT_DENSITY:5], and [ROOT_RADIUS:3] determine the density (how many are there, integer ranging 0-100) and radius (in tiles) away from the trunk, of heavy branches, normal branches and roots respectively.
 +
 
 +
[STANDARD_TILE_NAMES] makes the tree use standard names for the trunk, branches etc. Otherwise custom ones can be used. (see [[Plant_token|full plant token list]])
 +
 
 +
[SAPLING] ensures saplings of this tree are called "[tree name] sapling", instead of the standard "young [tree name]".
 +
 
 +
Lastly, we are introduced to the [GROWTH] token. [GROWTH] defines growths growing on a plant, in this case our apple tree. Apple trees have three growths: leaves, flowers and fruits.
 +
 
 +
{{code|
 +
  [GROWTH:FRUIT]
 +
[GROWTH_NAME:apple:STP]
 +
[GROWTH_ITEM:PLANT_GROWTH:NONE:LOCAL_PLANT_MAT:FRUIT]
 +
[GROWTH_DENSITY:1000]
 +
[GROWTH_HOST_TILE:BRANCHES_AND_TWIGS]
 +
  [GROWTH_TIMING:120000:200000]
 +
[GROWTH_DROPS_OFF_NO_CLOUD]
 +
[GROWTH_PRINT:'%':'%':4:0:0:120000:200000:3]
 +
[GROWTH_HAS_SEED]
 +
}}
 +
 
 +
 
 +
First comes the name of the growth. Then, with [GROWTH_ITEM], what kind of growth it is, in this case a PLANT_GROWTH made out of the local FRUIT material. [GROWTH_DENSITY] says how densely the growth grows, and [GROWTH_HOST_TILE] where on the tree it grows. [GROWTH_TIMING] decides when the growth appears, in annual ticks. The growth then drops off, leaving no clouds (items to be picked up by your dwarves). [GROWTH_PRINT] sets it to look like a red '%', and [GROWTH_HAS_SEED] implies that eating this growth will leave you with a seed.
 +
 
 +
=== Workshops ===
  
 
Workshops are raw-designed pretty differently from everything else in the game, being buildable structures rather than items or methods to gain items. However, they are fairly simple. For example, here's the raw for the [[soap maker's workshop]]:
 
Workshops are raw-designed pretty differently from everything else in the game, being buildable structures rather than items or methods to gain items. However, they are fairly simple. For example, here's the raw for the [[soap maker's workshop]]:
  
[BUILDING_WORKSHOP:SOAP_MAKER]
+
{{code|code=
[NAME:Soap Maker's Workshop]
+
[BUILDING_WORKSHOP:SOAP_MAKER]
[NAME_COLOR:7:0:1]
+
[NAME:Soap Maker's Workshop]
[DIM:3:3]
+
[NAME_COLOR:7:0:1]
[WORK_LOCATION:2:2]
+
[DIM:3:3]
[BUILD_LABOR:SOAP_MAKER]
+
[WORK_LOCATION:2:2]
[BUILD_KEY:CUSTOM_SHIFT_S]
+
[BUILD_LABOR:SOAP_MAKER]
[BLOCK:1:0:0:1]
+
[BUILD_KEY:CUSTOM_SHIFT_P]
[BLOCK:2:0:0:1]
+
[BLOCK:1:0:0:0] workbenches no longer block
[BLOCK:3:0:0:0]
+
[BLOCK:2:0:0:0]
[TILE:0:1:' ':' ':150]
+
[BLOCK:3:0:0:0]
[TILE:0:2:' ':' ':'/']
+
[TILE:0:1:' ':' ':150]
[TILE:0:3:'-':' ':' ']
+
[TILE:0:2:' ':' ':'/']
[COLOR:0:1:0:0:0:0:0:0:6:0:0]
+
[TILE:0:3:'-':' ':' ']
[COLOR:0:2:0:0:0:0:0:0:6:0:0]
+
[COLOR:0:1:0:0:0:0:0:0:6:0:0]
[COLOR:0:3:6:0:0:0:0:0:0:0:0]
+
[COLOR:0:2:0:0:0:0:0:0:6:0:0]
[TILE:1:1:' ':' ':'=']
+
[COLOR:0:3:6:0:0:0:0:0:0:0:0]
[TILE:1:2:'-':' ':8]
+
[TILE:1:1:' ':' ':'=']
[TILE:1:3:' ':' ':150]
+
[TILE:1:2:'-':' ':8]
[COLOR:1:1:0:0:0:0:0:0:6:0:0]
+
[TILE:1:3:' ':' ':150]
[COLOR:1:2:6:0:0:0:0:0:6:0:0]
+
[COLOR:1:1:0:0:0:0:0:0:6:0:0]
[COLOR:1:3:0:0:0:0:0:0:6:0:0]
+
[COLOR:1:2:6:0:0:0:0:0:6:0:0]
[TILE:2:1:'-':' ':8]
+
[COLOR:1:3:0:0:0:0:0:0:6:0:0]
[TILE:2:2:' ':' ':8]
+
[TILE:2:1:'-':' ':8]
[TILE:2:3:' ':150:' ']
+
[TILE:2:2:' ':' ':8]
[COLOR:2:1:6:0:0:0:0:0:6:0:0]
+
[TILE:2:3:' ':150:' ']
[COLOR:2:2:0:0:0:0:0:0:6:0:0]
+
[COLOR:2:1:6:0:0:0:0:0:6:0:0]
[COLOR:2:3:0:0:0:6:0:0:0:0:0]
+
[COLOR:2:2:0:0:0:0:0:0:6:0:0]
[TILE:3:1:150:' ':8]
+
[COLOR:2:3:0:0:0:6:0:0:0:0:0]
[TILE:3:2:' ':' ':8]
+
[TILE:3:1:150:' ':8]
[TILE:3:3:' ':240:' ']
+
[TILE:3:2:' ':' ':8]
[COLOR:3:1:6:0:0:0:0:0:6:7:0]
+
[TILE:3:3:' ':240:' ']
[COLOR:3:2:0:0:0:0:0:0:6:7:0]
+
[COLOR:3:1:6:0:0:0:0:0:6:7:0]
[COLOR:3:3:0:0:0:7:0:1:0:0:0]
+
[COLOR:3:2:0:0:0:0:0:0:6:7:0]
[BUILD_ITEM:1:BUCKET:NONE:NONE:NONE][EMPTY][CAN_USE_ARTIFACT]
+
[COLOR:3:3:0:0:0:7:0:1:0:0:0]
[BUILD_ITEM:1:NONE:NONE:NONE:NONE][BUILDMAT][WORTHLESS_STONE_ONLY][CAN_USE_ARTIFACT]
+
[BUILD_ITEM:1:BUCKET:NONE:NONE:NONE][EMPTY][CAN_USE_ARTIFACT]
 +
[BUILD_ITEM:1:NONE:NONE:NONE:NONE][BUILDMAT][WORTHLESS_STONE_ONLY][CAN_USE_ARTIFACT]
 +
[TOOLTIP:Use tallow (rendered fat) or oil here with lye to make soap.]
 +
}}
  
 
A line-by-line breakdown:
 
A line-by-line breakdown:
  
 +
{{code|
 
  [NAME:Soap Maker's Workshop]
 
  [NAME:Soap Maker's Workshop]
 
  [NAME_COLOR:7:0:1]
 
  [NAME_COLOR:7:0:1]
 +
}}
  
 
These are the name of the workshop ("Soap Maker's Workshop") and [[color]] of the workshop's name when examined with 'q' (White with a black background).
 
These are the name of the workshop ("Soap Maker's Workshop") and [[color]] of the workshop's name when examined with 'q' (White with a black background).
  
 +
{{code|
 
  [DIM:3:3]
 
  [DIM:3:3]
 
  [WORK_LOCATION:2:2]
 
  [WORK_LOCATION:2:2]
 +
}}
  
 
DIM refers to how large the workshop will be, in this case 3 wide, 3 tall. WORK_LOCATION tells where the creature using it (usually a dwarf) will work, numbered from the top right--in this case, 2:2, or the middle. Multiple work locations can be defined, even outside the dim.
 
DIM refers to how large the workshop will be, in this case 3 wide, 3 tall. WORK_LOCATION tells where the creature using it (usually a dwarf) will work, numbered from the top right--in this case, 2:2, or the middle. Multiple work locations can be defined, even outside the dim.
  
 +
{{code|
 
  [BUILD_LABOR:SOAP_MAKER]
 
  [BUILD_LABOR:SOAP_MAKER]
 
  [BUILD_KEY:CUSTOM_SHIFT_S]
 
  [BUILD_KEY:CUSTOM_SHIFT_S]
 +
}}
  
 
These refer to the worker required to build it (soap maker) and the key used to build it in the workshop menu (capital S).
 
These refer to the worker required to build it (soap maker) and the key used to build it in the workshop menu (capital S).
  
 
+
{{code|
   [BLOCK:1:0:0:1]
+
   [BLOCK:1:0:0:0]
 
  ...
 
  ...
This is a bit more complex, and is where we get to the meaty part of workshop making--the tiles' properties. BLOCK refers to which tiles will be untraversable--1 means blocked, 0 means unblocked. The first number refers to row, and the next 3 refer to column, so 1:0:0:1 means that, on the first row, the first two tiles will be unblocked and the last will be blocked.
+
}}
 +
This is a bit more complex, and is where we get to the meaty part of workshop making--the tiles' properties. BLOCK refers to which tiles will be untraversable--1 means blocked, 0 means unblocked. The first number refers to row, and the next 3 refer to column, so 1:0:0:0 means that, on the first row, all tiles will be unblocked. This is the case for all vanilla workshops, as of now.
  
 +
{{code|
 
  [TILE:0:1:' ':' ':150]
 
  [TILE:0:1:' ':' ':150]
 
  ...
 
  ...
 +
}}
 
The TILE token tells which tile will go where. note, however, that there are 5 entries here instead of 4. The first number, in this case, refers to build stage, numbered from 0 to 3; 3 or 1 is fully built (depending on whether there are stages), 0 is just placed, and 2 is always an intermediate stage, while 1 is usually an intermediate stage. Whether 1 is an intermediate stage or not depends on if there are a 2 and 3 stage; if 2 and 3 exist, 1 will be intermediate. The second number and beyond are similar to BLOCK; however, instead of 1s and 0s, you must input tiles. The tiles themselves can be given in quotes (as in ' ') or given as a number, which can be looked up [[Tilesets|here]]. Here, we have 150, which is û.
 
The TILE token tells which tile will go where. note, however, that there are 5 entries here instead of 4. The first number, in this case, refers to build stage, numbered from 0 to 3; 3 or 1 is fully built (depending on whether there are stages), 0 is just placed, and 2 is always an intermediate stage, while 1 is usually an intermediate stage. Whether 1 is an intermediate stage or not depends on if there are a 2 and 3 stage; if 2 and 3 exist, 1 will be intermediate. The second number and beyond are similar to BLOCK; however, instead of 1s and 0s, you must input tiles. The tiles themselves can be given in quotes (as in ' ') or given as a number, which can be looked up [[Tilesets|here]]. Here, we have 150, which is û.
  
 
+
{{code|
 
  [COLOR:1:1:0:0:0:0:0:0:6:0:0]
 
  [COLOR:1:1:0:0:0:0:0:0:6:0:0]
 
  ...
 
  ...
 +
}}
 
Color is as TILE, but with colors instead of tiles; however, colors are made up of 3 numbers each or MAT. MAT refers to the color of the material used to make it; the 3 numbers refer to foreground:background:foreground brightness, and can be looked up [[Color|here]]. For example, 4:2:1 will give you bright red with a dark green background.
 
Color is as TILE, but with colors instead of tiles; however, colors are made up of 3 numbers each or MAT. MAT refers to the color of the material used to make it; the 3 numbers refer to foreground:background:foreground brightness, and can be looked up [[Color|here]]. For example, 4:2:1 will give you bright red with a dark green background.
  
 +
{{code|
 
  [BUILD_ITEM:1:BUCKET:NONE:NONE:NONE][EMPTY][CAN_USE_ARTIFACT]
 
  [BUILD_ITEM:1:BUCKET:NONE:NONE:NONE][EMPTY][CAN_USE_ARTIFACT]
 
  [BUILD_ITEM:1:NONE:NONE:NONE:NONE][BUILDMAT][WORTHLESS_STONE_ONLY][CAN_USE_ARTIFACT]
 
  [BUILD_ITEM:1:NONE:NONE:NONE:NONE][BUILDMAT][WORTHLESS_STONE_ONLY][CAN_USE_ARTIFACT]
 +
}}
 
These refer to items required to build the building. These are in the same format as [[Reaction|reaction reagents and products]]--quantity:[[Item token|item]]:[[Material token|material]]. You'll learn more about those on the article about [[Reaction|reactions]], though. The second BUILD_ITEM is special-- it uses modifiers exclusively to determine its requirements. BUILDMAT refers to wood logs, wood blocks, stone boulders, and stone blocks; WORTHLESS_STONE_ONLY means it can't use economic stone; CAN_USE_ARTIFACT means that it... can use artifacts. EMPTY, in the bucket's case, means that the bucket must be empty.
 
These refer to items required to build the building. These are in the same format as [[Reaction|reaction reagents and products]]--quantity:[[Item token|item]]:[[Material token|material]]. You'll learn more about those on the article about [[Reaction|reactions]], though. The second BUILD_ITEM is special-- it uses modifiers exclusively to determine its requirements. BUILDMAT refers to wood logs, wood blocks, stone boulders, and stone blocks; WORTHLESS_STONE_ONLY means it can't use economic stone; CAN_USE_ARTIFACT means that it... can use artifacts. EMPTY, in the bucket's case, means that the bucket must be empty.
 +
 +
{{code|
 +
[TOOLTIP:Use tallow (rendered fat) or oil here with lye to make soap.]
 +
}}
 +
 +
This is the text in the tooltip shown when the building is highlighted by the mouse in the workshops list.
  
 
More can be seen at the [[Building token|building tokens]] article.
 
More can be seen at the [[Building token|building tokens]] article.
  
== Reactions ==
+
=== Reactions ===
 +
 
 +
Reactions are the crafting recipes used in [[workshop]]s, and by the [[adventurer mode|adventurer]]. By adding new reactions you can make new items available, or enable you to get items or materials in new ways. The reactions can also be given to entities, in which case they will make use of them during both world gen and play; making a reaction that creates [[steel]] directly from [[plant fiber]]s, would allow the elves to craft steel and arrive clad in it in a [[siege]].
 +
 
 +
Not all crafting reactions are defined in the raws, but some are, such as those for [[ceramic industry|pottery]] and [[Metal#Alloys_2|alloy]] making.
  
 
An in-depth guide for reactions is available [[Reactions|here]].
 
An in-depth guide for reactions is available [[Reactions|here]].
  
== Materials ==
+
=== Materials ===
  
 
As we've seen when talking about creatures, materials are vital. Materials show up in two forms: material templates, which generally show up in creatures, and specific materials (designated as "inorganic"), which are (by default, at least) consigned purely to metal and stone types.
 
As we've seen when talking about creatures, materials are vital. Materials show up in two forms: material templates, which generally show up in creatures, and specific materials (designated as "inorganic"), which are (by default, at least) consigned purely to metal and stone types.
Line 655: Line 1,067:
  
 
[[material definition token|Here's a list of material tokens]]. It should also help you out with any modifications you want to make regarding those creature modifications we were making a while back. See, it all ties together in the end. The beauty of the current materials system is that there's actually very little difference between, say, leather and iron - they're fundamentally the same thing, just with different properties, which is how things really should be.
 
[[material definition token|Here's a list of material tokens]]. It should also help you out with any modifications you want to make regarding those creature modifications we were making a while back. See, it all ties together in the end. The beauty of the current materials system is that there's actually very little difference between, say, leather and iron - they're fundamentally the same thing, just with different properties, which is how things really should be.
 +
 +
== Selecting and Cutting ==
 +
 +
[[Modding#Modifying_the_vanilla_objects|As explained above]], existing raws can be altered with the use of SELECT, and can also be culled with CUT for more granular control, compared to simply unloading vanilla content in the mod loader. Token behavior when multiple tokens are added is dependent on the individual token. Removing tags from an object without cutting and recreating the object in question is typically impossible, except for creature object tags removed and/or replaced with the use of [[Creature_variation_token|creature variation tokens]].
 +
 +
The syntax for selecting and cutting objects is as follows:
 +
 +
{{code|code=
 +
Substitute X for the desired object. A CUT does not need a SELECT prior, this is simply a list of available options.
 +
 +
[SELECT_CREATURE:X]
 +
[CUT_CREATURE:X]
 +
 +
[SELECT_ENTITY:X]
 +
[CUT_ENTITY:X]
 +
 +
[SELECT_INTERACTION:X]
 +
[CUT_INTERACTION:X]
 +
 +
[SELECT_ITEM:X]
 +
[CUT_ITEM:X]
 +
 +
[SELECT_WORD:X]
 +
[CUT_WORD:X]
 +
 +
[SELECT_TRANSLATION:X]
 +
[CUT_TRANSLATION:X]
 +
 +
[SELECT_SYMBOL:X]
 +
[CUT_SYMBOL:X]
 +
 +
[SELECT_INORGANIC:X]
 +
[CUT_INORGANIC:X]
 +
 +
[SELECT_PLANT:X]
 +
[CUT_PLANT:X]
 +
 +
[SELECT_MUSIC:X]
 +
[CUT_MUSIC:X]
 +
 +
[SELECT_REACTION:X]
 +
[CUT_REACTION:X]
 +
 +
[SELECT_SOUND:X]
 +
[CUT_SOUND:X]
 +
 +
}}
  
 
== Examples ==
 
== Examples ==
 +
:''Main articles: [[:Category:Modding_Examples]]''
  
The Hydling by Mysteryguye (annotated, updated and separated into blocks by Putnam)
+
The Hydling below was made by Mysteryguye (and annotated, updated and separated into blocks by Putnam), to act as an example creature.
  
 +
{{code|code=
 
  [CREATURE:HYDLING]
 
  [CREATURE:HYDLING]
 
  [DESCRIPTION:A seven-headed small hairy thing, about the size of a dog. It is very loyal to its masters, and will promptly disembowel any enemy straying too close.]
 
  [DESCRIPTION:A seven-headed small hairy thing, about the size of a dog. It is very loyal to its masters, and will promptly disembowel any enemy straying too close.]
This is the description that shows up in-game when viewing the creature.
+
This is the description that shows up in-game when viewing the creature.
  
 
  [NAME:hydling:hydlings:hydlish] If there were a civ made of hydlings, it would appear as "hydlings" in the neighbors screen.
 
  [NAME:hydling:hydlings:hydlish] If there were a civ made of hydlings, it would appear as "hydlings" in the neighbors screen.
Line 670: Line 1,131:
 
  [CREATURE_TILE:'='][COLOR:2:0:1] Will appear as a light green "=".
 
  [CREATURE_TILE:'='][COLOR:2:0:1] Will appear as a light green "=".
  
  [PETVALUE:78][NATURAL] Creature is known to be naturally occurring by the game. Will cost 40 embark points to buy.
+
  [PETVALUE:40][NATURAL] Creature is known to be naturally occurring by the game. Will cost 40 embark points to buy.
  
 
  [LARGE_ROAMING] Will spawn outdoors, wandering around.
 
  [LARGE_ROAMING] Will spawn outdoors, wandering around.
Line 680: Line 1,141:
 
  [PREFSTRING:loyalty] Dwarves will like it for its loyalty.
 
  [PREFSTRING:loyalty] Dwarves will like it for its loyalty.
  
  [LIKES_FIGHTING] Will attack rather than flee.
+
  [LARGE_PREDATOR] Will attack rather than flee.
  
 
  [BODY:BASIC_2PARTBODY:7HEADNECKS:BASIC_FRONTLEGS:BASIC_REARLEGS:TAIL:2EYES:NOSE:2LUNGS:HEART:GUTS:ORGANS:THROAT:SPINE:BRAIN:SKULL:3TOES_FQ_REG:3TOES_RQ_REG:MOUTH:TONGUE:GENERIC_TEETH_WITH_FANGS:RIBCAGE]
 
  [BODY:BASIC_2PARTBODY:7HEADNECKS:BASIC_FRONTLEGS:BASIC_REARLEGS:TAIL:2EYES:NOSE:2LUNGS:HEART:GUTS:ORGANS:THROAT:SPINE:BRAIN:SKULL:3TOES_FQ_REG:3TOES_RQ_REG:MOUTH:TONGUE:GENERIC_TEETH_WITH_FANGS:RIBCAGE]
  
Has a lower body, upper body, 4 legs, a tail, ten eyes, ten ears, five noses, two lungs, a heart, guts, a pancreas etc., and 5 heads with all that goes with those.
+
Has a lower body, upper body, 4 legs, a tail, fourteen eyes, fourteen ears, seven noses, two lungs, a heart, guts, a pancreas etc., and 7 heads with all that goes with those.
  
 
  [BODYGLOSS:PAW] Feet will be called "paws"
 
  [BODYGLOSS:PAW] Feet will be called "paws"
Line 706: Line 1,167:
 
  [TL_MAJOR_ARTERIES] Heart and throat--called above--will cause heavy bleeding if ruptured.
 
  [TL_MAJOR_ARTERIES] Heart and throat--called above--will cause heavy bleeding if ruptured.
  
  [BODY_DETAIL_PLAN:STANDARD_HEAD_POSITIONS] Places eyes, ears and what have you into their correct placement, so that you don't have people punching out eyes from behind.
+
  [BODY_DETAIL_PLAN:STANDARD_HEAD_POSITIONS] Places eyes, ears and what-have-you into their correct placement, so that you don't have people punching out eyes from behind.
  
 
  [BODY_DETAIL_PLAN:HUMANOID_RIBCAGE_POSITIONS] Sets the ribcage as being around lungs and heart.
 
  [BODY_DETAIL_PLAN:HUMANOID_RIBCAGE_POSITIONS] Sets the ribcage as being around lungs and heart.
  
 
  [USE_MATERIAL_TEMPLATE:SINEW:SINEW_TEMPLATE] Defines sinew so that...
 
  [USE_MATERIAL_TEMPLATE:SINEW:SINEW_TEMPLATE] Defines sinew so that...
  [TENDONS:LOCAL_CREATURE_MAT:SINEW:200] Tendons
+
  [TENDONS:LOCAL_CREATURE_MAT:SINEW:200] Tendons...
  [LIGAMENTS:LOCAL_CREATURE_MAT:SINEW:200] And ligaments can be defined.
+
  [LIGAMENTS:LOCAL_CREATURE_MAT:SINEW:200] ...And ligaments can be defined.
  
 
  [HAS_NERVES] Creature has nerves, and as such can be disabled by severing them.
 
  [HAS_NERVES] Creature has nerves, and as such can be disabled by severing them.
Line 754: Line 1,215:
 
  [ATTACK_FLAG_EDGE] Attack is an EDGE attack.
 
  [ATTACK_FLAG_EDGE] Attack is an EDGE attack.
 
  [ATTACK_PRIORITY:MAIN] Attack is of priority MAIN. Other option is SECOND.
 
  [ATTACK_PRIORITY:MAIN] Attack is of priority MAIN. Other option is SECOND.
  [ATTACK_FLAG_CANLATCH] Attack can latch.
+
  [ATTACK_FLAG_CANLATCH] Attack can latch on.
 
                 [ATTACK_PREPARE_AND_RECOVER:3:3] Takes 3 ticks to wind up attack and 3 to recover from it.
 
                 [ATTACK_PREPARE_AND_RECOVER:3:3] Takes 3 ticks to wind up attack and 3 to recover from it.
 
                 [ATTACK_FLAG_INDEPENDENT_MULTIATTACK] Can use each head independently.
 
                 [ATTACK_FLAG_INDEPENDENT_MULTIATTACK] Can use each head independently.
Line 785: Line 1,246:
 
  [CASTE:MALE] As above, but with male.
 
  [CASTE:MALE] As above, but with male.
 
  [MALE] See above.
 
  [MALE] See above.
 +
}}
  
= Modding utilities =
+
== See also ==
 +
{{catbox|DF2014:Modding}}
  
[http://www.bay12forums.com/smf/index.php?topic=28829.0 A list of many mods and community-developed utilities]
+
* [[Raw file]]
 +
* [[Token]]
 +
* [[Modding pitfalls]]
 +
* [[Cheating]]
 +
* Bay 12 Guide: https://bay12games.com/dwarves/modding_guide.html
  
 
{{Category|Modding}}
 
{{Category|Modding}}
[[Category:v0.31:Guides]]
+
{{Category|Guides}}
 +
[[ru:Modding]]

Latest revision as of 22:51, 28 April 2024

This article is about the current version of DF.
Note that some content may still need to be updated.

For a list of Dwarf Fortress mods, see List of mods.


Modding, or creating mods, refers to modifying the behavior of the base game (vanilla). Dwarf Fortress is remarkably moddable.

Resource Overview[edit]

Modding icon.png

This section serves as a portal to all modding-related pages on the wiki.

Using Mods
Guides and references
Where to get help?
Modding tools

There are several utilities that assist in modding efforts. There is a list of them on the Bay 12 Forums.

  • Text Editors are used in all areas of modding. Use a good text editor to edit files and search into multiple files (like the free Notepad++ for example) or more advanced editors capable of highlighting and formatting the displayed text (like DF RAW Language server)
  • Image Editor will be needed for doing custom graphics. Paint.NET, Photoshop and GIMP are the most used, but whatever supports the .png format will work.

Documentation[edit]

Raw files

These object files, stored in /data/vanilla/*/objects/, define various specifics of game items, materials, and creatures, and can be changed using mods to alter how the game behaves. These are text based and can be edited with any text editor, however, editing the vanilla raw files is now discouraged.

See Token reference - It's always good to refer to tokens on the wiki. Even experienced modders have to look up tokens! A list of articles about tokens can be found here.

Graphics Files

The `/data/art/` subfolder of Dwarf Fortress is used to store user-customizable graphics sets.

Reactions
Language and Speech file
Sound and Music files

All sound and music files used by Dwarf Fortress are stored in the .ogg format within the /data/sound/ subfolders. You can replace the existing ogg files with different ones. That has to be performed manually and isn't actually supported by the game. You can also change some of the definitions of when certain musical cues are played, using available music tokens and sound tokens in the raw files. However, you can't add new music or sounds other than replacing what's already there.

Best practice[edit]

The current best practice is to not modify the original raw files, since most modifications can be made via mods. Mods can add new objects, add tokens to existing objects, and cut objects entirely. You should prefer SELECT over CUT, and prefer CUT over not loading vanilla raws.

Guide[edit]

This is intended to be a guide to inform those new to Dwarf Fortress modding on what elements of the game can be modified, and how. After reading through this guide, a user should be capable of editing creatures, entities, materials et al, and creating their own.

Generally, breaking stuff is fine - nothing that can be changed will affect the DF executable, and new additions can be easily removed.

This guide is based on Teldin's guide, originally created for version 0.27.176.39c. Per wiki tradition, it has been updated through all the major releases since then; hopefully it reflects current knowledge.

Token reference[edit]

It's always good to refer to tokens on the wiki. Even experienced modders have to look up tokens! A list of articles about tokens can be found here.

Basics of DF modding[edit]

To make a mod, one must put a folder into the /mods/ folder. The vast majority of modifications to the game can be done via this method. This folder should contain a file named "info.txt" and two subfolders: "graphics" (where you insert graphics sets), and "objects", which contains all the data for, generally, everything in the game that is not hardcoded.

The info.txt is formatted like so:

[ID:my_first_mod]
[NUMERIC_VERSION:1]
[DISPLAYED_VERSION:1.0.0]
[EARLIEST_COMPATIBLE_NUMERIC_VERSION:1]
[EARLIEST_COMPATIBLE_DISPLAYED_VERSION:1.0.0]
[AUTHOR:Your Name Here]
[NAME:My First Mod]
[DESCRIPTION:A cool mod I made!]

A mod should have all of these. There are a few more tokens, but the above are the important ones.

Most of the game's vanilla content is in the same format as mods. Many text files can be found in the subfolders of the /data/vanilla folder - these are the raw files, and using them as a basis for modification is quite easy. For now, we will take a look at one of the existing files. For example, if you open /data/vanilla/vanilla_creatures/creature_standard.txt, it should look something like this:

 creature_standard
 
 [OBJECT:CREATURE]
 
 [CREATURE:DWARF]
     [DESCRIPTION:A short, sturdy creature fond of drink and industry.]
     [NAME:dwarf:dwarves:dwarven]
     [CASTE_NAME:dwarf:dwarves:dwarven]
     [CREATURE_TILE:1][COLOR:3:0:0]
     [CREATURE_SOLDIER_TILE:2]
 ...

As you can see, each file comprises a header string stating the file name, a second header stating the type of object data it contains, followed by the contents of the file itself. These are all necessary elements of the file, and without them, the file will be ignored by the game.

In other words, to be recognized by the game, a raw file must have all of the following:

  1. A filename that refers to the type of objects contained therein. Creature files must start with creature_, entity files must start with entity_, and so on.
  2. The filename on the first line of the file.
  3. [OBJECT:type], where "type" is replaced with the relevant object type.

Below the headers, there begins a list of entries. Each entry is made up of its own header (in this case, "[CREATURE:DWARF]"), again stating the type of object, and then the object's unique identifier - if an identifier isn't unique, the game will mess up and you'll get some serious, and potentially very trippy, errors. (For example...) Below that, we have the body of the entry, which determines the entry's specific properties.

The body of an entry is made up of a series of "tokens", which are essentially flags that can be added or removed to affect the entry's attributes. Most of these effects are hardcoded: for example, it's possible to make a creature only eat meat with the [CARNIVOROUS] token, but it's impossible to create your own token detailing a specific diet for the creature.

Before we continue, a few key things to remember when modding the raw files:

  • Try to avoid modifying the existing raw files when possible. You should make a mod instead!
  • When adding files, token identifiers are all you need to include to ensure proper references are maintained. The game searches through all loaded raw files by tokens. For example, you can add a new pair of leather boots and not even have to add it to a file named item_shoes.txt, but rather your own file, say item_shoes_new.txt and ensure you have the token listed, ex. [ITEM_SHOES:ITEM_SHOES_BOOTS_NEW].
  • When a new world is generated, the mods included are "baked in" and cannot be modified except to be updated--for this, the game checks that the mod used by the save is of a compatible NUMERIC_VERSION.
  • There's nothing stopping you from just copying an existing creature/entity/whatever, changing the identifier, and modifying it. This can save you a lot of time, especially when it comes to entities.

Modifying the vanilla objects[edit]

You should not modify the vanilla raws where they originally are if you can help it. Instead, patch them using the patching functions provided with Dwarf Fortress since v50.01.

There are two patching functions: SELECT and CUT. When SELECT is used, it lets you make changes to an object without needing the entire entry to be present in your mod file. When CUT is used, it forces the game to not use that object, even though it is still found in the vanilla raws (or in any other mods earlier in the load order). Both of these functions take the form of tokens. These functions are not universally applicable to any token found in any entry, just the following list of objects:

CREATURE, ENTITY, INTERACTION, ITEM, WORD, TRANSLATION, SYMBOL, INORGANIC, PLANT, MUSIC, REACTION, SOUND

The syntax required for these functions is: [<function>_<object>:<specific object being affected>]. For instance, [CUT_PLANT:MUSHROOM_HELMET_PLUMP] cuts the plump helmet object in the vanilla file plant_standard.txt, so the game will not use that object at all. However, [SELECT_ITEM_HELM:ITEM_HELM_HELM] does not select the helm object from the vanilla file item_helm.txt, even though that's how the object appears in that file, because there is no [SELECT_ITEM_HELM] token. Instead, the helm would be selected with [SELECT_ITEM:ITEM_HELM_HELM].

For example, if you wanted to mod beards onto dwarven women while also removing elephants from the game:

creature_mypatch

[OBJECT:CREATURE]

[SELECT_CREATURE:DWARF] starts editing DWARF from the end of the entry
    [SELECT_CASTE:FEMALE]
        [BODY_DETAIL_PLAN:FACIAL_HAIR_TISSUE_LAYERS]

[CUT_CREATURE:ELEPHANT] removes the ELEPHANT creature

Or, say, add your own reaction and building to dwarves:

entity_mypatch

[OBJECT:ENTITY]

[SELECT_ENTITY:MOUNTAIN]
    [PERMITTED_REACTION:MY_REACTION]
    [PERMITTED_BUILDING:MY_BUILDING]

And in any of these, one can add the token [LOG_CURRENT_ENTRY] somewhere under one of the objects of the file, which logs the full contents of the object in question to logs\current_entry.txt. This can be useful to make sure that the patch is doing what you think it is. For instance if [LOG_CURRENT_ENTRY] were added on the next line after [CREATURE:DWARF] in your mod file, then the dwarf object would be the object detailed in the log entry.

...Speaking of, let's move on to modifying and adding entities.

Modding civilizations (entities)[edit]

Entities - the objects that determine how civilizations work - are stored in vanilla_entities/entity_default.txt (though, like all other files, you may add more). They follow the same format as any other raw file:

 entity_default
 
 [OBJECT:ENTITY]
 
 [ENTITY:ENTITYNAME]
     [CREATURE:CREATURETYPE]
     [TRANSLATION:LANGUAGETYPE]
     [BIOME_SUPPORT:BIOMETOKEN:FREQUENCY]
     ...[OTHER TAGS]...

Most of the time, it doesn't matter which order these tokens are in or where they're placed so long as they're below the "ENTITY:" identifier, but there are some important exceptions in the case of other files, especially creatures, which can contain a lot of "nested" tokens.

"[CREATURE:]" links the civilization with a specific creature defined in a creature file. This is the creature that'll be making up the entity's population, and, therefore, the creature you'll be playing as in fortress or adventure mode if the entity is a playable one. For example, if you wanted to do something silly, you could switch the "CREATURE:DWARF" entry in entity_default.txt with "CREATURE:ELF" and you would be marching elves around in fortress mode, although they would still use dwarven technology, language and names and so forth. Oh, and before you get any funny ideas - it is possible to define more than one creature for a civ, but that won't work in quite the way you probably expect; it will pick only one of the defined creatures at random to use for the civ. Later on, in the creature section, you'll learn about castes, which will provide a much more viable alternative, so try to bear with us until then.

"[TRANSLATION:]" defines the language file that the entity will be using, which will determine what their untranslated words are for things. This doesn't determine which words they use for naming things, only the way those words are spelled. The default language files are HUMAN, DWARF, ELF, and GOBLIN.

"[BIOME_SUPPORT:]" defines the biomes that civs will attempt to settle in. The "FREQUENCY" value determines the likelihood of them building there, but also raises an important point: most of the values you'll be setting for things are relative to each other. If one were to type:

 [BIOME_SUPPORT:ANY_FOREST:1]
 [BIOME_SUPPORT:SAVANNA:2]

This would have very much the same effect as:

 [BIOME_SUPPORT:ANY_FOREST:5]
 [BIOME_SUPPORT:SAVANNA:10]

This holds true for a lot of values throughout the files, excluding when it simply doesn't make sense, such as in materials.

You can find many details about the rest of the civilization tokens here.

Besides those mentioned, some fundamental ones are the [SITE_CONTROLLABLE] token, which lets you control the civ in fortress mode, the [OUTSIDER_CONTROLLABLE] token, which allows you to play in adventure mode as an outsider, and the [ALL_MAIN_POPS_CONTROLLABLE] token, which allows you to play a civ native (non-outsider) in adventure mode. Other tokens that you should pay attention to are START_BIOME and the ones regarding sites, but in general, you can just run through the aforementioned list and add or remove what you want.

If you have more than one civ with the [SITE_CONTROLLABLE] token, all the available civs from those entities will appear in the group selection section on the embark screen. It may not be immediately obvious from which species each civ may be - while this can be determined from legends mode, the topmost species in the "neighbors" display in the embark screen is always 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 civ (and therefore a species if there is more than one) at random.

You can also attempt to discern the civ yourself by the names it uses - this is the realm of "symbols", collections of words centered around a specific concept. The civ will use the words comprising whatever symbols are applicable to it for various things. This association might be a little confusing at first, so, let's refer to the DWARF entity:

 [SELECT_SYMBOL:WAR:NAME_WAR]
 [SUBSELECT_SYMBOL:WAR:VIOLENT]
 [SELECT_SYMBOL:BATTLE:NAME_BATTLE]
 [SUBSELECT_SYMBOL:BATTLE:VIOLENT]
 [SELECT_SYMBOL:SIEGE:NAME_SIEGE]
 [SUBSELECT_SYMBOL:SIEGE:VIOLENT]

Here, we can see that dwarves will generally name their wars first after words in the "NAME_WAR" symbol group, and then, after words in the "VIOLENT" symbol group. This might, for example, result in a war being named "The War of Carnage". The symbols used for the other types of conflict are arrayed in a similar fashion. It would be trivial to replace the instances of VIOLENT with, say, PEACE and end up with a battle called "The Clash of Calm" or something.

 [SELECT_SYMBOL:ROAD:NAME_ROAD]
 [SELECT_SYMBOL:TUNNEL:NAME_TUNNEL]
 [SELECT_SYMBOL:BRIDGE:NAME_BRIDGE]
 [SELECT_SYMBOL:WALL:NAME_WALL]

The above applies here. Dwarves are fond of naming their roads and tunnels after... roads and tunnels.

 [SELECT_SYMBOL:REMAINING:ARTIFICE]
 [SELECT_SYMBOL:REMAINING:EARTH]
 [CULL_SYMBOL:ALL:DOMESTIC]
 [CULL_SYMBOL:ALL:SUBORDINATE]
 [CULL_SYMBOL:ALL:EVIL]
 [CULL_SYMBOL:ALL:UNTOWARD]
 [CULL_SYMBOL:ALL:FLOWERY]
 [CULL_SYMBOL:ALL:NEGATIVE]
 [CULL_SYMBOL:ALL:UGLY]
 [CULL_SYMBOL:ALL:NEGATOR]

This section deals with everything else. The things that haven't already been dealt with (hence the "REMAINING") - such as site names, kingdom names, the names of individuals, and such - will have names from the ARTIFICE and EARTH symbol groups. After that, the dwarf entity is told to cull all inappropriate symbols - this applies to everything (hence the "ALL") so if the game happens to choose a symbol associated with, say, EVIL for one of the battles, it'll scrap that name and try again. This sort of thing adds a lot of flavour to DF's entities and can account for a lot of a civ's perceived personality.

Another basic thing to note: any entity token that's dealing with weapons, armor, clothing, etc., will state the items that the civ can build natively, not necessarily the ones they can wear or use. For example, you could create a species with no clothes specified, but then rob a clothes shop in adventurer mode and wear everything you want, or give them weapons that are too large to wield and they could sell them, but not use them.

An easy method of creating a civilization is just to copy-paste a similar one to the bottom of the entity_default.txt file and edit things to your liking. Remember to always change the civ's "ENTITY:" identifier! This can be anything, so long as it's not already existing.

At the end of some of the default entries you'll find a list of positions, both ones that'll directly affect you in fort mode (such as nobles) and ones that'll primarily affect worldgen and adventure mode. A list of the tokens applicable to positions can be found here; they don't require a great deal of explanation, but that can be found in Advanced Entity Position Mechanics

Trade[edit]

The following entity tokens affect the appearance of trading caravans:

  • [ACTIVE_SEASON] - Defines the seasons when an entity may visit your fortress.
  • [PROGRESS_TRIGGER_*] - Defines the triggers which control when an entity will become interested in your fortress.
  • [COMMON_DOMESTIC_PACK] - Allows the civilization to use domestic pack animals. If an entity lacks pack animals (or ability to pull wagons), it will be unable to send caravans (showing as No Trade at the embark screen), unless it has domesticated any suitable animal species or is forced to use a non-suitable creature by the [ANIMAL] definition [ALWAYS_WAGON_PULLER] on creature, caste or class.
  • [COMMON_DOMESTIC_PULL] - Allows the civilization to use domestic animals to pull wagons, assuming their KILL_PLANT ethic permits them to use wagons in the first place.
  • [MERCHANT_BODYGUARDS] - Caravan will be guarded by soldiers.

Modding creatures[edit]

Creature modding is great fun – you can change nearly any aspect of a creature, or make your own completely from scratch.

Modding creatures is very similar to modding civs: it's just a matter of editing, adding, or removing tokens, enclosed in square brackets underneath the creature's [CREATURE:] header. The creature entries contain all of the information about each and every non-random creature in the game, from animals to dwarves to goblins to even caravan wagons. A lot of the creature tokens are fairly self-explanatory; you can find a list of such tokens here. But before you start creating your own creatures, you'll want to learn how the tissues system works.

Creature materials and tissues[edit]

In the most basic sense, a creature is a series of body parts. These parts are defined in their own file, and we'll talk about them later, as a specific aspect of how creatures work, which throws off a lot of prospective modders, is the relationship between body parts, tissues, and materials. We're going to show you part of the creature entry for a bronze colossus (bear with us):

 ...
 [BODY:HUMANOID:2EYES:2EARS:NOSE:HUMANOID_JOINTS:5FINGERS:5TOES]
 [NO_THOUGHT_CENTER_FOR_MOVEMENT]
 [TISSUE:BRONZE]
     [TISSUE_NAME:bronze:bronze]
     [TISSUE_MATERIAL:INORGANIC:BRONZE]
     [MUSCULAR]
     [FUNCTIONAL]
     [STRUCTURAL]
     [RELATIVE_THICKNESS:1]
     [CONNECTS]
     [TISSUE_SHAPE:LAYER]
 [TISSUE_LAYER:BY_CATEGORY:ALL:BRONZE]
 ...

At the top, we can see the "BODY:" token, followed by a list of body parts. As you've probably guessed, these parts make up the physical form of the colossus. But the colossus has to be made out of something - it has to have tissues, and those tissues also have to be made out of something - in this case, bronze.

Below the BODY token you'll see a TISSUE token, followed by an identifier, much like the others we've seen. The TISSUE block is determining how the tissue works, and which purposes it'll serve. As the colossus is just going to be made out of this one tissue, this tissue needs to act like bone, muscle, and everything else combined, hence the MUSCULAR, FUNCTIONAL and STRUCTURAL tokens. The tissue also references a material - INORGANIC:BRONZE - the properties of which are declared in the inorganic materials file, and the tissue is subsequently made out of this material. With us so far?

Below the tissue definition is the TISSUE_LAYER line. TISSUE_LAYER allows you to control where each tissue is applied. Its first argument defines if it's to search by body part category (BY_CATEGORY), body part type (BY_TYPE), or look for a specific part (BY_TOKEN). That's followed by the parts argument itself, which is in this case ALL (so the game's looking for parts in all categories, which is to say, every body part). This is followed by the tissue to be applied, BRONZE. So the TISSUE_LAYER token is telling the game to select all body parts in every category and make them out of the tissue "BRONZE". The colossus is now made of bronze.

By now you're probably thinking "Wow, if this was for a creature made out of however many tissues, this would be amazingly longwinded" and you're right. Luckily, there are two methods by which we can speed things up a lot.

Firstly, there are material and tissue templates. Let's say you were going to make a lot of creatures out of bronze, and you didn't want to have to copy and paste the bronze tissue all over the place. Instead, you create a tissue template. This goes, as you've probably guessed, in a tissue template file.

 [TISSUE_TEMPLATE:BRONZE_TEMPLATE]
     [TISSUE_NAME:bronze:bronze]
     [TISSUE_MATERIAL:INORGANIC:BRONZE]
     [MUSCULAR]
     [FUNCTIONAL]
     [STRUCTURAL]
     [RELATIVE_THICKNESS:1]
     [CONNECTS]
     [TISSUE_SHAPE:LAYER]

Now, instead of applying the tissue to each and every bronze creature you're making, you can just refer to the template:

 ...
 [BODY:HUMANOID:2EYES:2EARS:NOSE:HUMANOID_JOINTS:5FINGERS:5TOES]
 [NO_THOUGHT_CENTER_FOR_MOVEMENT]
 [USE_TISSUE_TEMPLATE:BRONZE:BRONZE_TEMPLATE]
 [TISSUE_LAYER:BY_CATEGORY:ALL:BRONZE]
 ...

Material templates work in the same way, but refer to materials instead of tissues.

However, if we're looking at something like a dwarf, even with the templates, editing can get very slow indeed:

     ...
     [USE_MATERIAL_TEMPLATE:SKIN:SKIN_TEMPLATE]
     [USE_MATERIAL_TEMPLATE:FAT:FAT_TEMPLATE]
     [USE_MATERIAL_TEMPLATE:MUSCLE:MUSCLE_TEMPLATE]
     [USE_MATERIAL_TEMPLATE:BONE:BONE_TEMPLATE]
     [USE_MATERIAL_TEMPLATE:CARTILAGE:CARTILAGE_TEMPLATE]
     [USE_MATERIAL_TEMPLATE:HAIR:HAIR_TEMPLATE]
     [USE_MATERIAL_TEMPLATE:TOOTH:TOOTH_TEMPLATE]
     [USE_MATERIAL_TEMPLATE:EYE:EYE_TEMPLATE]
     [USE_MATERIAL_TEMPLATE:NERVE:NERVE_TEMPLATE]
     [USE_MATERIAL_TEMPLATE:BRAIN:BRAIN_TEMPLATE]
     [USE_MATERIAL_TEMPLATE:LUNG:LUNG_TEMPLATE]
     [USE_MATERIAL_TEMPLATE:HEART:HEART_TEMPLATE]
     [USE_MATERIAL_TEMPLATE:LIVER:LIVER_TEMPLATE]
     [USE_MATERIAL_TEMPLATE:GUT:GUT_TEMPLATE]
     [USE_MATERIAL_TEMPLATE:STOMACH:STOMACH_TEMPLATE]
     [USE_MATERIAL_TEMPLATE:PANCREAS:PANCREAS_TEMPLATE]
     [USE_MATERIAL_TEMPLATE:SPLEEN:SPLEEN_TEMPLATE]
     [USE_MATERIAL_TEMPLATE:KIDNEY:KIDNEY_TEMPLATE]
     [USE_TISSUE_TEMPLATE:SKIN:SKIN_TEMPLATE]
     [USE_TISSUE_TEMPLATE:FAT:FAT_TEMPLATE]
     [USE_TISSUE_TEMPLATE:MUSCLE:MUSCLE_TEMPLATE]
     ...

This is where body detail plans, which have their own file, and are designed to help automate some of the more common processes in creature creation, come in. The first entry in b_detail_plan_default.txt does exactly what we've been trying to do above: it takes all the common materials and shoves them into one plan, which can be referenced with a single token.

     ...
     [BODY_DETAIL_PLAN:STANDARD_MATERIALS]
     ...

Much easier. But what about the TISSUE_LAYER tokens? Will we have to type out all of those manually?

Nope, detail plans have that covered as well. It's possible to place variable arguments into a detail plan. For example:

 [BODY_DETAIL_PLAN:VERTEBRATE_TISSUE_LAYERS]
     [BP_LAYERS:BY_CATEGORY:BODY:ARG3:50:ARG2:5:ARG1:1]
     [BP_LAYERS:BY_CATEGORY:BODY_UPPER:ARG3:50:ARG2:5:ARG1:1]
     [BP_LAYERS:BY_CATEGORY:BODY_LOWER:ARG3:50:ARG2:5:ARG1:1]
     [BP_LAYERS:BY_CATEGORY:ARM:ARG4:25:ARG3:25:ARG2:5:ARG1:1]
     [BP_LAYERS:BY_CATEGORY:ARM_UPPER:ARG4:25:ARG3:25:ARG2:5:ARG1:1]
     ...
     [BP_LAYERS:BY_CATEGORY:NOSE:ARG5:4:ARG1:1]
     ...

First an argument is placed in the plan (ARG1, ARG2 etc.), followed by the thickness of the tissue that will be inserted in place of the argument. So when we reference the VERTEBRATE_TISSUE_LAYERS plan, we'll be able to do something like this:

     [BODY_DETAIL_PLAN:VERTEBRATE_TISSUE_LAYERS:SKIN:FAT:MUSCLE:BONE:CARTILAGE]

ARG1 in the detail plan is replaced by SKIN, the first tissue we entered. ARG2 is replaced by FAT, ARG3 by MUSCLE, ARG4 by BONE, and ARG5 by CARTILAGE. Hence, our creature's body part designated as BODY is made up of SKIN with thickness 1, FAT with thickness 5, and MUSCLE with thickness 50. Its nose is made up of SKIN (thickness 1) and CARTILAGE (thickness 4).

Things left out of the body plans aside, our dwarf's entire body, material, tissue and tissue layer tokens have been boiled down to this:

     ...
     [BODY:HUMANOID:2EYES:2EARS:NOSE:2LUNGS:HEART:GUTS:ORGANS:HUMANOID_JOINTS:
     THROAT:NECK:SPINE:BRAIN:SKULL:5FINGERS:5TOES:MOUTH:FACIAL_FEATURES:TEETH:RIBCAGE]
     [BODY_DETAIL_PLAN:STANDARD_MATERIALS]
     [BODY_DETAIL_PLAN:STANDARD_TISSUES]
     [BODY_DETAIL_PLAN:VERTEBRATE_TISSUE_LAYERS:SKIN:FAT:MUSCLE:BONE:CARTILAGE]
     ...

This can save you a lot of time and space if you're making lots of changes common to many creatures. In general, if you're making a creature that's fleshy or chitinous, there are detail plans already included in the game to help you out. You should only have to resort to declaring tissues individually (like our bronze colossus) if you're doing something really out-of-the-ordinary.

Another great thing about templates (and so, detail plans) is that they can be modified after being declared. Let's say we wanted our dwarves to be perpetually on fire (don't ask). We leave the body stuff declared normally:

     ...
     [BODY:HUMANOID:2EYES:2EARS:NOSE:2LUNGS:HEART:GUTS:ORGANS:HUMANOID_JOINTS:
     THROAT:NECK:SPINE:BRAIN:SKULL:5FINGERS:5TOES:MOUTH:FACIAL_FEATURES:TEETH:RIBCAGE]
     [BODY_DETAIL_PLAN:STANDARD_MATERIALS]
     [BODY_DETAIL_PLAN:STANDARD_TISSUES]
     [BODY_DETAIL_PLAN:VERTEBRATE_TISSUE_LAYERS:SKIN:FAT:MUSCLE:BONE:CARTILAGE]
     ...

We then, in our own mod, select the appropriate material:

[SELECT_CREATURE:DWARF]
     [SELECT_MATERIAL:SKIN]
         [MAT_FIXED_TEMP:10600]
     ...

We don't want them burning to death, so we'll need to stop that from happening:

[SELECT_CREATURE:DWARF]
     [SELECT_MATERIAL:SKIN]
         [MAT_FIXED_TEMP:10600]
     [SELECT_MATERIAL:ALL]
         [HEATDAM_POINT:NONE]
     ...

Note that this makes use of DF's built-in temperature scale. You can read more about that on this page. We're also referencing material tokens, which we haven't gone over yet - we'll talk about making your own materials later.

Creature castes[edit]

Another potentially extremely powerful part of the creature raws is the caste system. The caste system handles both true biological castes and lesser variations, such as sexes.

To understand the true potential of the caste system, we only need to take a look at the raws for antmen, found in creature_subterrenean.txt:

     ...
     [CASTE:WORKER]
         [CASTE_NAME:worker ant woman:worker ant women:worker ant woman]
         Female, but non-breeding.
         [POP_RATIO:10000]
     [CASTE:SOLDIER]
         [CASTE_NAME:soldier ant woman:soldier ant women:soldier ant woman]
         Female, but non-breeding.
         [POP_RATIO:1000]
     [CASTE:DRONE]
         [MALE]
         [CASTE_NAME:drone ant man:drone ant men:drone ant man]
         [POP_RATIO:5]
     [CASTE:QUEEN]
         [FEMALE]
         [CASTE_NAME:queen ant woman:queen ant women:queen ant woman]
         [POP_RATIO:1]
     [SELECT_CASTE:WORKER]
      [SELECT_ADDITIONAL_CASTE:SOLDIER]
      [SELECT_ADDITIONAL_CASTE:QUEEN]
         [BODY:HUMANOID_4ARMS:2EYES:HEART:GUTS:BRAIN:MOUTH]
         [BODYGLOSS:INSECT_UPPERBODY:INSECT_LOWERBODY]
     [SELECT_CASTE:DRONE]
         [BODY:HUMANOID_4ARMS:2EYES:HEART:GUTS:BRAIN:MOUTH:2WINGS]
         [BODYGLOSS:INSECT_UPPERBODY:INSECT_LOWERBODY]
         [FLIER]
     [SELECT_CASTE:ALL]
         [BODY_DETAIL_PLAN:CHITIN_MATERIALS]
         [BODY_DETAIL_PLAN:CHITIN_TISSUES]
         [BODY_DETAIL_PLAN:EXOSKELETON_TISSUE_LAYERS:CHITIN:FAT:MUSCLE]
         [BODY_DETAIL_PLAN:STANDARD_HEAD_POSITIONS]
         [ATTACK:PUNCH:BODYPART:BY_TYPE:GRASP]
             [ATTACK_SKILL:GRASP_STRIKE]
             [ATTACK_VERB:punch:punches]
     ...

It's evident that the process of creating and editing castes is comparable to the modifications we were making to tissues and materials earlier: A caste is declared, and modifications to the base creature are made. Declared castes can be selected and subsequently modified, again, just like tissues and materials.

In this case, each caste is declared, given its own name, and a POP_RATIO, which determines how commonly a birth results in that caste - for every 10000 workers born, there'll be an average of 1000 soldiers, 5 drones and one queen. You've probably also noticed that the DRONE and QUEEN castes have the MALE and FEMALE tokens respectively - these tokens determine how breeding works. A creature without both a MALE caste and a FEMALE caste will be unable to breed (no asexually reproducing creatures yet, unfortunately). As they lack FEMALE, the workers and soldiers are unable to breed with the male drones.

After this, there are some modifications to bodyparts. In this case, the drones have wings and the FLIER token, which the other castes lack. It's entirely possible for creatures of different castes to have completely different body structures, even to the extent that they don't resemble each other at all. If you read the section of this guide that dealt with entities, you may remember a passing mention of multi-creature civilisations and how they don't quite work as you may think they would. The castes system is your workaround. You could create a caste that is, for all intents and purposes, a human, and another caste of the same creature that acts exactly like a giant cave spider, put the creature in a civ, and get a human-spider civ. The only flaw in this approach is that the castes will interbreed.

That's the most complex components of creature creation out of the way. You should find the rest trivial by comparison.

Modding items[edit]

Items are fairly simple to deal with. By default, each item type is contained in its own file; this may help make browsing for a specific item easier, but from a purely technical point of view, it's possible to throw all items into one file. Unfortunately, item definition tokens don't seem to be especially well-documented (at least not as well as the other object types), but you should be able to figure out most things by way of our explanations and your assumptions.

Let's look at the entry for, of course, the thong:

 [ITEM_PANTS:ITEM_PANTS_THONG]
 [NAME:thong:thongs]
 [LAYER:UNDER]
 [COVERAGE:25]
 [LAYER_SIZE:10]
 [LAYER_PERMIT:30]
 [MATERIAL_SIZE:1]
 [SOFT]
 [LEATHER]
 [STRUCTURAL_ELASTICITY_WOVEN_THREAD]

Most of these are pretty obvious if one compares them to the other entries in the file. There's a layer for the item, determining where it's worn; a coverage value to determine how well it protects you from cold and other things; a size token to determine how much it counts for when it's under something else; a layer permit token to determine how much can be worn under it; and a material size token to determine how much raw material it takes to make it.

Now, if you wanted to mod these to turn them into metal thongs (ouch!), you would simply have to add [METAL] to it somewhere. Simple! These tokens work by tying into material properties - some materials are designated as suitable for making hard items, some for soft, etc..

Weapons involve a little more detail:

 [ITEM_WEAPON:ITEM_WEAPON_SWORD_2H]
 [NAME:two-handed sword:two-handed swords]
 [SIZE:900]
 [SKILL:SWORD]
 [TWO_HANDED:67500]
 [MINIMUM_SIZE:62500]
 [MATERIAL_SIZE:5]
 [ATTACK:EDGE:100000:8000:slash:slashes:NO_SUB:1250]
 	[ATTACK_PREPARE_AND_RECOVER:3:3]
 [ATTACK:EDGE:50:4000:stab:stabs:NO_SUB:1000]
 	[ATTACK_PREPARE_AND_RECOVER:3:3]
 [ATTACK:BLUNT:100000:8000:slap:slaps:flat:1250]
 	[ATTACK_PREPARE_AND_RECOVER:3:3]
 [ATTACK:BLUNT:100:1000:strike:strikes:pommel:1000]
 	[ATTACK_PREPARE_AND_RECOVER:3:3]

SIZE determines how heavy the weapon is. This has a substantial effect on weapon effectiveness. SKILL determines which skill is used in using the weapon; a list of skills can be found on this page. MINIMUM_SIZE determines the minimum size a creature must be before the weapon can be wielded, while TWO_HANDED determines how large a creature must be in order to wield the weapon with one hand.

Attacks take a little more explanation. The first value determines the contact area of the weapon's attack; this should be high for slashing weapons and low for bludgeoning, piercing and poking ones. The second value determines how deep the weapon penetrates - for BLUNT attacks this value is ignored as they're not supposed to penetrate anyway, but in the case of EDGE attacks it should generally be lower for slashing attacks and higher for stabbing attacks.

Following these are the nouns and verb used; they should be self-explanatory. Finally, we have the velocity modifier, which has a multiplying effect on the weapon's size for the purposes of determining how powerful it is in combat. But more accurate it describe distribution of momentum across length of weapon. So STAB perfomed with only muscular power and modifier is x1 (1000). SLASH performed with some rotating momentum of cutting edge, but sword is pretty balanced thru it's length and modifier is just x1.25 (1250). Axes, hammers and maces have more unbalanced mass distribution and weapon mass concentrated far from grasp, so higher modifiers.

ATTACK_PREPARE_AND_RECOVER determine number of game frames to perform these actions. In vanilla almost not varies for different weapons.

Other, more miscellaneous items are generally simple and shouldn't require any further explanation.

Once you've made an item, you just add it to the civ entry so a civilization can actually craft it, and it's done.

Modding language files[edit]

Main article: Language token

Let's say you added a whole new species. Sure, you could just swipe one of the existing translation files and steal their language for your species, but that's the lazy way! If you want to create a whole new language, it is very simple.

First, you'd need a whole new language_RACE file, such as language_LIZARDMAN.txt, along with "language_LIZARDMAN" at the top of the file proceeded by [OBJECT:LANGUAGE] and [TRANSLATION:LIZARDMAN]. After that, it's just a matter of copy-pasting one of the existing language lists and editing the finished 'translated' word. That's it! Then just add the translation link to your civ in entity_default.txt and it'll be added to the game on worldgen.

All raw files use Code Page 437 encoding, and you should make sure you are editing these files in that format. As many text editors default to UTF-8, some characters with diacritical marks may fail to show properly. Saving one of the default language raw files in this state will overwrite these characters with the unicode question mark, which will corrupt the file. To fix this replace the file with a clean one downloaded from the distributed version of DF.

(Note that the name of the file doesn't actually matter; however, it's good form to name the file after a creature if only that creature speaks the language.)

Modding body parts[edit]

Imagine you have this fantastic idea for a multi-tentacled winged spider-monster. Sounds great! But in order to make this a reality you may need to create a new set of body parts for it. That's no problem! Making body parts is easy, though it may look complicated at first.

All of the default body definitions are located in body_default.txt and then linked to a creature in the creature's entry. We've talked about how bodyparts make up creatures earlier, in the creature section. You can mix and match them in the creature entry and it makes no difference, as long as they're there: each body part will link itself to the appropriate connection automatically when the creature is first created.

Body parts work by sections: you can add as many sections as you want to a body part definition, but generally you should keep it fairly low for ease of use. Each body section entry is in the, very simple, format:

 [BODY:BODYNAME]
 [BP:TOKENID:name][TOKENSGOHERE][DEFAULT_RELSIZE:][CATEGORY:WHATEVER]

The most important tokens are "CONTYPE" and "CON": CONTYPE means the body part in question is connected to a certain type of body part, while CON means it's connected to a specific one. TOKENID is yet another identifier, which should be unique, as it's referenced every time something uses CON or BY_TOKEN. DEFAULT_RELSIZE defines, of course, what the body part's size is in relation to the other parts. CATEGORY defines a category for the part, which can be unique or shared with other parts. This is referenced whenever BY_CATEGORY is used.

A list of body part tokens can be found here.

Let's take a simple example, a head:

 [BODY:BASIC_HEAD]
 [BP:HD:head:STP][CONTYPE:UPPERBODY][HEAD][CATEGORY:HEAD]
 [DEFAULT_RELSIZE:300]

It connects directly to an upper body.

 [BODY:2EYES]
     [BP:REYE:right eye:STP][CONTYPE:HEAD][SIGHT][EMBEDDED][SMALL][RIGHT][CATEGORY:EYE]
         [DEFAULT_RELSIZE:5]
     [BP:LEYE:left eye:STP][CONTYPE:HEAD][SIGHT][EMBEDDED][SMALL][LEFT][CATEGORY:EYE]
         [DEFAULT_RELSIZE:5]

These are a pair of eyes, connecting to the head.

 [BODY:HUMANOID]
     [BP:UB:upper body:upper bodies][UPPERBODY][CATEGORY:BODY_UPPER]
         [DEFAULT_RELSIZE:1000]
     [BP:LB:lower body:lower bodies][CON:UB][LOWERBODY][CATEGORY:BODY_LOWER]
         [DEFAULT_RELSIZE:1000]
     [BP:HD:head:STP][CON:UB][HEAD][CATEGORY:HEAD]
         [DEFAULT_RELSIZE:300]
     [BP:RUA:right upper arm:STP][CON:UB][LIMB][RIGHT][CATEGORY:ARM_UPPER]
         [DEFAULT_RELSIZE:200]
     [BP:LUA:left upper arm:STP][CON:UB][LIMB][LEFT][CATEGORY:ARM_UPPER]
         [DEFAULT_RELSIZE:200]
     [BP:RLA:right lower arm:STP][CON:RUA][LIMB][RIGHT][CATEGORY:ARM_LOWER]
         [DEFAULT_RELSIZE:200]
     [BP:LLA:left lower arm:STP][CON:LUA][LIMB][LEFT][CATEGORY:ARM_LOWER]
         [DEFAULT_RELSIZE:200]
     [BP:RH:right hand:STP][CON:RLA][GRASP][RIGHT][CATEGORY:HAND]
         [DEFAULT_RELSIZE:80]
     [BP:LH:left hand:STP][CON:LLA][GRASP][LEFT][CATEGORY:HAND]
         [DEFAULT_RELSIZE:80]
     [BP:RUL:right upper leg:STP][CON:LB][LIMB][RIGHT][CATEGORY:LEG_UPPER]
         [DEFAULT_RELSIZE:500]
     [BP:LUL:left upper leg:STP][CON:LB][LIMB][LEFT][CATEGORY:LEG_UPPER]
         [DEFAULT_RELSIZE:500]
     [BP:RLL:right lower leg:STP][CON:RUL][LIMB][RIGHT][CATEGORY:LEG_LOWER]
         [DEFAULT_RELSIZE:400]
     [BP:LLL:left lower leg:STP][CON:LUL][LIMB][LEFT][CATEGORY:LEG_LOWER]
         [DEFAULT_RELSIZE:400]
     [BP:RF:right foot:right feet][CON:RLL][STANCE][RIGHT][CATEGORY:FOOT]
         [DEFAULT_RELSIZE:120]
     [BP:LF:left foot:left feet][CON:LLL][STANCE][LEFT][CATEGORY:FOOT]
         [DEFAULT_RELSIZE:120]

An entire humanoid body. The foot bone's connected to the ankle bone...

"BODYGLOSS" entries, which you can sometimes find applied to creature entries, are simply replacement words for specific part name strings in a creature. For example, you'll find the bodygloss [BODYGLOSS:CLAW_HAND:hand:claw] in body_default.txt; you can then use this in a creature via "[BODYGLOSS:CLAW_HAND]" and it'll replace all instances of "hand" with "claw" in that creature. Be warned, however—if you were to, say make a bodygloss [BODYGLOSS:EARSTALK:ear:stalk:ears:stalk], it would not only change "ear" and "ears" to "stalk" and "stalks", it would also change "heart" to "hstalkt"! For all intents and purposes the body part will still function as the proper part, though.

Modding plants[edit]

Plants are, again, not unlike creatures. With what you've learned so far in regard to tokens and the materials system, running through the notes included in plant_standard.txt should explain most things. Here's the list of plant-specific tokens.

Below is the plump helmet raw description:

 [PLANT:MUSHROOM_HELMET_PLUMP]
 	[NAME:plump helmet][NAME_PLURAL:plump helmets][ADJ:plump helmet]
 	[USE_MATERIAL_TEMPLATE:STRUCTURAL:STRUCTURAL_PLANT_TEMPLATE]
 		[MATERIAL_VALUE:2]
 	[BASIC_MAT:LOCAL_PLANT_MAT:STRUCTURAL]
 		[EDIBLE_VERMIN]
 		[EDIBLE_RAW]
 		[EDIBLE_COOKED]
 	[PICKED_TILE:161][PICKED_COLOR:6:13:0]
 	[GROWDUR:300][VALUE:2]
 	[USE_MATERIAL_TEMPLATE:DRINK:PLANT_ALCOHOL_TEMPLATE]
 		[STATE_NAME_ADJ:ALL_SOLID:frozen dwarven wine]
 		[STATE_NAME_ADJ:LIQUID:dwarven wine]
 		[STATE_NAME_ADJ:GAS:boiling dwarven wine]
 		[MATERIAL_VALUE:2]
 		[DISPLAY_COLOR:5:0:0]
 		[EDIBLE_RAW]
 		[EDIBLE_COOKED]
 		[PREFIX:NONE]
 	[DRINK:LOCAL_PLANT_MAT:DRINK]
 
 	[USE_MATERIAL_TEMPLATE:SEED:SEED_TEMPLATE]
 		[MATERIAL_VALUE:1]
 		[EDIBLE_VERMIN]
 		[EDIBLE_COOKED]
 	[SEED:plump helmet spawn:plump helmet spawn:4:0:1:LOCAL_PLANT_MAT:SEED]
 	[SPRING][SUMMER][AUTUMN][WINTER]
 	[FREQUENCY:100]
 	[CLUSTERSIZE:5]
 	[PREFSTRING:rounded tops]
 	[WET][DRY]
 	[BIOME:SUBTERRANEAN_WATER]
 	[UNDERGROUND_DEPTH:1:3]
 	[SHRUB_TILE:142]
 	[DEAD_SHRUB_TILE:28]
 	[SHRUB_COLOR:5:13:0]
 	[DEAD_SHRUB_COLOR:5:6:0]

Let's look at this line by line:
First, we define its file name. In this case it's MUSHROOM_HELMET_PLUMP. Next we define its in-game name (plump helmet) and its adjective for if you were to craft with it (e.g. plump helmet earrings).

 	[USE_MATERIAL_TEMPLATE:STRUCTURAL:STRUCTURAL_PLANT_TEMPLATE]
 		[MATERIAL_VALUE:2]
 	[BASIC_MAT:LOCAL_PLANT_MAT:STRUCTURAL]

This defines the structure and material of the plant. It references STRUCTURAL_PLANT_TEMPLATE in the first line, so if you were to say, add wings to the template, the plump helmet plant would be winged. This is for the plant itself, not the end plump helmets.

After that we get our edible tokens. These say that vermin can eat the plant, and it can be eaten raw or cooked by your dwarves. So if you wanted a plant vermin would leave alone, you'd remove the [EDIBLE_VERMIN] token.

 		[EDIBLE_VERMIN]
 		[EDIBLE_RAW]
 		[EDIBLE_COOKED]

Next, [PICKED_TILE:161] is the character (161 in this case) shown when the crop is harvested. See character table for a table of usable tiles. [PICKED_COLOR:6:13:0] is the color used for the crop's tile when harvested. It's in a foreground:background:brightness format. See color for the colors usable.

 	[PICKED_TILE:161][PICKED_COLOR:6:13:0]

[GROWDUR:300] is how long it takes for your crop to grow. There are 1008 growdur units in a season.
[VALUE:2] Is the value of the harvested plant (default 1).

 	[GROWDUR:300][VALUE:2]

This defines the plant's alcohol states. [STATE_NAME_ADJ:ALL_SOLID:] is the frozen name, followed is the actual drink name, and then its boiling name. These are achieved by either Scorching or Freezing climates. [DISPLAY_COLOR] is, of course, color, and [EDIBLE_RAW] and [EDIBLE_COOKED] are saying you can drink the alcohol raw or cooked.

 	[USE_MATERIAL_TEMPLATE:DRINK:PLANT_ALCOHOL_TEMPLATE]
 		[STATE_NAME_ADJ:ALL_SOLID:frozen dwarven wine]
 		[STATE_NAME_ADJ:LIQUID:dwarven wine]
 		[STATE_NAME_ADJ:GAS:boiling dwarven wine]
 		[MATERIAL_VALUE:2]
 		[DISPLAY_COLOR:5:0:0]
 		[EDIBLE_RAW]
 		[EDIBLE_COOKED]
 		[PREFIX:NONE]
 	[DRINK:LOCAL_PLANT_MAT:DRINK]

After that we get our seed template:

 	[USE_MATERIAL_TEMPLATE:SEED:SEED_TEMPLATE]
 		[MATERIAL_VALUE:1]
 		[EDIBLE_VERMIN]
 		[EDIBLE_COOKED]
 	[SEED:plump helmet spawn:plump helmet spawn:4:0:1:LOCAL_PLANT_MAT:SEED]

And all this says is that the seeds may be eaten by vermin or cooked. Then it gives the name of our plant's seed, its plural name, its foreground, background, and brightness colors, followed by its seed material; said material should have [SEED_MAT] to permit proper stockpiling.

And finally for the last chunk we have this:

 	[SPRING][SUMMER][AUTUMN][WINTER]
 	[FREQUENCY:100]
 	[CLUSTERSIZE:5]
 	[PREFSTRING:rounded tops]
 	[WET][DRY]
 	[BIOME:SUBTERRANEAN_WATER]
 	[UNDERGROUND_DEPTH:1:3]
 	[SHRUB_TILE:142]
 	[DEAD_SHRUB_TILE:28]
 	[SHRUB_COLOR:5:13:0]
 	[DEAD_SHRUB_COLOR:5:6:0]

First we define what season(s) the plant may grow in, then we define how frequently this plant is generated in a particular area, followed by how many harvested crop items may come from 1 plant. [PREFSTRING:] is what your dwarves like about the plant, which in this case is the rounded tops. [WET][DRY] are the conditions under which the plant can grow. Wet means it can grow close to water, dry means it can grow away from water. This does not mean you can grow the plant on dry stone however. It is just for natural spawning of the plant.
[BIOME] Is what biome the plant grows in. [UNDERGROUND_DEPTH:Minimum:Maximum] Is the highest and lowest cavern levels that the plant can appear in if its biome is subterranean. Dwarven civilizations will only export (via the embark screen or caravans) things that are available at depth 1. Defaults to 0:0 (surface only).
Lastly, [SHRUB_TILE] is the character used for the naturally spawning shrub of this plant, [DEAD_SHRUB] is the dead shrub character. [SHRUB_COLOR] Is the shrub's color, and [DEAD_SHRUB_COLOR] is, of course, the dead shrub's color.

While this may or may not look like a lot of tokens, it's very easy. Just copy an existing plant and edit it to your new plant.
For the rest of the tokens, see plant token.

Trees[edit]

Trees are another kind of plant that can be modded. Being plants, they use many of the same tokens as edible crops, but differ in having a few tree-specific tokens.

Below is the apple tree raw description:

  [PLANT:APPLE] malus sieversii
  	[NAME:apple tree][NAME_PLURAL:apple trees][ADJ:apple tree]
  	[USE_MATERIAL_TEMPLATE:STRUCTURAL:STRUCTURAL_PLANT_TEMPLATE]
  	[BASIC_MAT:LOCAL_PLANT_MAT:STRUCTURAL]
  	[USE_MATERIAL_TEMPLATE:WOOD:WOOD_TEMPLATE]
  		[STATE_NAME:ALL_SOLID:apple wood]
  		[STATE_ADJ:ALL_SOLID:apple wood]
  		[PREFIX:NONE]
  		[SOLID_DENSITY:745] *** http://www.csudh.edu/oliver/chemdata/woods.htm
  		[STATE_COLOR:ALL_SOLID:CHOCOLATE] *** http://www.forestryforum.com/board/index.php/topic,61009.0.html
  	[USE_MATERIAL_TEMPLATE:DRINK:PLANT_ALCOHOL_TEMPLATE]
    		[STATE_NAME_ADJ:ALL_SOLID:frozen apple cider]
  		[STATE_NAME_ADJ:LIQUID:apple cider]
  		[STATE_NAME_ADJ:GAS:boiling apple cider]
  		[MATERIAL_VALUE:2]
  		[DISPLAY_COLOR:6:0:0]
  		[EDIBLE_RAW]
    		[EDIBLE_COOKED]
  		[PREFIX:NONE]
  	[DRINK:LOCAL_PLANT_MAT:DRINK]
  	[USE_MATERIAL_TEMPLATE:LEAF:LEAF_TEMPLATE]
  		[STATE_COLOR:ALL:GREEN]
  		[DISPLAY_COLOR:2:0:0]
  	[USE_MATERIAL_TEMPLATE:FLOWER:FLOWER_TEMPLATE]
  		[STATE_COLOR:ALL:ROSE]
  		[DISPLAY_COLOR:5:0:1]
  	[USE_MATERIAL_TEMPLATE:FRUIT:FRUIT_TEMPLATE]
  		[STATE_COLOR:ALL:RUST]
  		[DISPLAY_COLOR:4:0:0]
  		[EDIBLE_VERMIN]
  		[EDIBLE_RAW]
  		[EDIBLE_COOKED]
  		[STOCKPILE_PLANT_GROWTH]
  		[MATERIAL_REACTION_PRODUCT:DRINK_MAT:LOCAL_PLANT_MAT:DRINK]
  		[MATERIAL_REACTION_PRODUCT:SEED_MAT:LOCAL_PLANT_MAT:SEED]
  	[USE_MATERIAL_TEMPLATE:SEED:SEED_TEMPLATE]
  		[MATERIAL_VALUE:1]
  		[EDIBLE_VERMIN]
  	[SEED:apple seed:apple seeds:0:0:1:LOCAL_PLANT_MAT:SEED]
  	[TREE:LOCAL_PLANT_MAT:WOOD][TREE_TILE:5]
  	[TRUNK_PERIOD:10]
  	[HEAVY_BRANCH_DENSITY:25]
  	[BRANCH_DENSITY:50]
  	[MAX_TRUNK_HEIGHT:3]
  	[HEAVY_BRANCH_RADIUS:1]
  	[BRANCH_RADIUS:2]
  	[TRUNK_BRANCHING:2]
  	[MAX_TRUNK_DIAMETER:1]
  	[TRUNK_WIDTH_PERIOD:200]
  	[ROOT_DENSITY:5]
  	[ROOT_RADIUS:3]
  	[STANDARD_TILE_NAMES]
  	[PREFSTRING:fruit]
  	[DRY]
  	[BIOME:ANY_TEMPERATE]
  	[SAPLING]
  	[GROWTH:LEAVES]
  		[GROWTH_NAME:apple leaf:apple leaves]
  		[GROWTH_ITEM:PLANT_GROWTH:NONE:LOCAL_PLANT_MAT:LEAF]
  		[GROWTH_DENSITY:1000]
  		[GROWTH_HOST_TILE:BRANCHES_AND_TWIGS]
  		[GROWTH_HOST_TILE:SAPLING]
  		[GROWTH_TIMING:0:300000]
  		[GROWTH_PRINT:0:6:2:0:0:0:209999:1]
  		[GROWTH_PRINT:0:6:6:0:1:210000:239999:1] autumn color
  		[GROWTH_PRINT:0:6:4:0:1:240000:269999:1]
 		[GROWTH_PRINT:0:6:4:0:0:270000:300000:1]
   		[GROWTH_DROPS_OFF]
  	[GROWTH:FLOWERS]
  		[GROWTH_NAME:apple flower:STP]
  		[GROWTH_ITEM:PLANT_GROWTH:NONE:LOCAL_PLANT_MAT:FLOWER]
  		[GROWTH_DENSITY:1000]
  		[GROWTH_HOST_TILE:BRANCHES_AND_TWIGS]
  		[GROWTH_TIMING:60000:119999]
  		[GROWTH_PRINT:5:5:5:0:1:60000:119999:2]
 	[GROWTH:FRUIT]
  		[GROWTH_NAME:apple:STP]
  		[GROWTH_ITEM:PLANT_GROWTH:NONE:LOCAL_PLANT_MAT:FRUIT]
  		[GROWTH_DENSITY:1000]
  		[GROWTH_HOST_TILE:BRANCHES_AND_TWIGS]
   		[GROWTH_TIMING:120000:200000]
  		[GROWTH_DROPS_OFF_NO_CLOUD]
  		[GROWTH_PRINT:'%':'%':4:0:0:120000:200000:3]
  		[GROWTH_HAS_SEED]

The first lines are the same as the ones we saw being used in the plump helmets, defining the plant object, giving it a name, and deciding that it should use the standard STRUCTURAL_PLANT material for its structure.

 [PLANT:APPLE] malus sieversii
 	[NAME:apple tree][NAME_PLURAL:apple trees][ADJ:apple tree]
 	[USE_MATERIAL_TEMPLATE:STRUCTURAL:STRUCTURAL_PLANT_TEMPLATE]
 	[BASIC_MAT:LOCAL_PLANT_MAT:STRUCTURAL]

Adding the token DISPLAY_COLOR directly after [USE_MATERIAL_TEMPLATE] would allow us to change the color of the tree.

        [USE_MATERIAL_TEMPLATE:STRUCTURAL:STRUCTURAL_PLANT_TEMPLATE]
        	[DISPLAY_COLOR:1:0:0]
 	[BASIC_MAT:LOCAL_PLANT_MAT:STRUCTURAL]

would give us a dark blue apple tree. This method is used by the game in birches and various underground trees.

Next come the definitions of various other materials used by the tree:

        [USE_MATERIAL_TEMPLATE:WOOD:WOOD_TEMPLATE]
  		[STATE_NAME:ALL_SOLID:apple wood]
  		[STATE_ADJ:ALL_SOLID:apple wood]
  		[PREFIX:NONE]
  		[SOLID_DENSITY:745] *** http://www.csudh.edu/oliver/chemdata/woods.htm
  		[STATE_COLOR:ALL_SOLID:CHOCOLATE] *** http://www.forestryforum.com/board/index.php/topic,61009.0.html
  	[USE_MATERIAL_TEMPLATE:DRINK:PLANT_ALCOHOL_TEMPLATE]
    		[STATE_NAME_ADJ:ALL_SOLID:frozen apple cider]
  		[STATE_NAME_ADJ:LIQUID:apple cider]
  		[STATE_NAME_ADJ:GAS:boiling apple cider]
  		[MATERIAL_VALUE:2]
  		[DISPLAY_COLOR:6:0:0]
  		[EDIBLE_RAW]
    		[EDIBLE_COOKED]
  		[PREFIX:NONE]
  	[DRINK:LOCAL_PLANT_MAT:DRINK]
  	[USE_MATERIAL_TEMPLATE:LEAF:LEAF_TEMPLATE]
  		[STATE_COLOR:ALL:GREEN]
  		[DISPLAY_COLOR:2:0:0]
  	[USE_MATERIAL_TEMPLATE:FLOWER:FLOWER_TEMPLATE]
  		[STATE_COLOR:ALL:ROSE]
  		[DISPLAY_COLOR:5:0:1]
  	[USE_MATERIAL_TEMPLATE:FRUIT:FRUIT_TEMPLATE]
  		[STATE_COLOR:ALL:RUST]
  		[DISPLAY_COLOR:4:0:0]
  		[EDIBLE_VERMIN]
  		[EDIBLE_RAW]
  		[EDIBLE_COOKED]
  		[STOCKPILE_PLANT_GROWTH]
  		[MATERIAL_REACTION_PRODUCT:DRINK_MAT:LOCAL_PLANT_MAT:DRINK]
  		[MATERIAL_REACTION_PRODUCT:SEED_MAT:LOCAL_PLANT_MAT:SEED]
  	[USE_MATERIAL_TEMPLATE:SEED:SEED_TEMPLATE]
  		[MATERIAL_VALUE:1]
  		[EDIBLE_VERMIN]
  	[SEED:apple seed:apple seeds:0:0:1:LOCAL_PLANT_MAT:SEED]


From them, we get to know what the parts of the tree can be used for, as well as how they will appear when separated from the tree. Any alterations that can be done to materials normally can be done here, such as changing the value or adding a syndrome.

	[TREE:LOCAL_PLANT_MAT:WOOD][TREE_TILE:5]

[TREE] is what turns your plant object into an actual tree. The following argument describes what material the harvested logs should be made of. If NONE, the felled tree will give no logs. [TREE_TILE] is the tile the tree shows up as on the world map.

Note that all vanilla trees (that give logs) use the WOOD material defined above as the argument for [TREE], as opposed to the STRUCTURAL material. Thus, any changes to the properties of the wood harvested should be done to the WOOD material.

The following tokens decide the dimensions of the tree, and how it grows.

    [TRUNK_PERIOD:10]
 	[HEAVY_BRANCH_DENSITY:25]
 	[BRANCH_DENSITY:50]
 	[MAX_TRUNK_HEIGHT:3]
 	[HEAVY_BRANCH_RADIUS:1]
 	[BRANCH_RADIUS:2]
 	[TRUNK_BRANCHING:2]
 	[MAX_TRUNK_DIAMETER:1]
 	[TRUNK_WIDTH_PERIOD:200]
 	[ROOT_DENSITY:5]
 	[ROOT_RADIUS:3]


[TRUNK_PERIOD] and [TRUNK_WIDTH_PERIOD] determine how long it takes for the trunk to grow one tile taller respectively wider, in years. [MAX_TRUNK_HEIGHT:3] and [MAX_TRUNK_DIAMETER:1] determine the maximum value the above can reach. [TRUNK_BRANCHING] decides how "curvy" the tree is, with [TRUNK_BRANCHING:0] meaning the tree is entirely straight.

[HEAVY_BRANCH_DENSITY:25], [HEAVY_BRANCH_RADIUS:1], [BRANCH_DENSITY:50], [BRANCH_RADIUS:2], [ROOT_DENSITY:5], and [ROOT_RADIUS:3] determine the density (how many are there, integer ranging 0-100) and radius (in tiles) away from the trunk, of heavy branches, normal branches and roots respectively.

[STANDARD_TILE_NAMES] makes the tree use standard names for the trunk, branches etc. Otherwise custom ones can be used. (see full plant token list)

[SAPLING] ensures saplings of this tree are called "[tree name] sapling", instead of the standard "young [tree name]".

Lastly, we are introduced to the [GROWTH] token. [GROWTH] defines growths growing on a plant, in this case our apple tree. Apple trees have three growths: leaves, flowers and fruits.

  [GROWTH:FRUIT]
 		[GROWTH_NAME:apple:STP]
 		[GROWTH_ITEM:PLANT_GROWTH:NONE:LOCAL_PLANT_MAT:FRUIT]
 		[GROWTH_DENSITY:1000]
 		[GROWTH_HOST_TILE:BRANCHES_AND_TWIGS]
  		[GROWTH_TIMING:120000:200000]
 		[GROWTH_DROPS_OFF_NO_CLOUD]
 		[GROWTH_PRINT:'%':'%':4:0:0:120000:200000:3]
 		[GROWTH_HAS_SEED]


First comes the name of the growth. Then, with [GROWTH_ITEM], what kind of growth it is, in this case a PLANT_GROWTH made out of the local FRUIT material. [GROWTH_DENSITY] says how densely the growth grows, and [GROWTH_HOST_TILE] where on the tree it grows. [GROWTH_TIMING] decides when the growth appears, in annual ticks. The growth then drops off, leaving no clouds (items to be picked up by your dwarves). [GROWTH_PRINT] sets it to look like a red '%', and [GROWTH_HAS_SEED] implies that eating this growth will leave you with a seed.

Workshops[edit]

Workshops are raw-designed pretty differently from everything else in the game, being buildable structures rather than items or methods to gain items. However, they are fairly simple. For example, here's the raw for the soap maker's workshop:

[BUILDING_WORKSHOP:SOAP_MAKER]
	[NAME:Soap Maker's Workshop]
	[NAME_COLOR:7:0:1]
	[DIM:3:3]
	[WORK_LOCATION:2:2]
	[BUILD_LABOR:SOAP_MAKER]
	[BUILD_KEY:CUSTOM_SHIFT_P]
	[BLOCK:1:0:0:0] workbenches no longer block
	[BLOCK:2:0:0:0]
	[BLOCK:3:0:0:0]
	[TILE:0:1:' ':' ':150]
	[TILE:0:2:' ':' ':'/']
	[TILE:0:3:'-':' ':' ']
	[COLOR:0:1:0:0:0:0:0:0:6:0:0]
	[COLOR:0:2:0:0:0:0:0:0:6:0:0]
	[COLOR:0:3:6:0:0:0:0:0:0:0:0]
	[TILE:1:1:' ':' ':'=']
	[TILE:1:2:'-':' ':8]
	[TILE:1:3:' ':' ':150]
	[COLOR:1:1:0:0:0:0:0:0:6:0:0]
	[COLOR:1:2:6:0:0:0:0:0:6:0:0]
	[COLOR:1:3:0:0:0:0:0:0:6:0:0]
	[TILE:2:1:'-':' ':8]
	[TILE:2:2:' ':' ':8]
	[TILE:2:3:' ':150:' ']
	[COLOR:2:1:6:0:0:0:0:0:6:0:0]
	[COLOR:2:2:0:0:0:0:0:0:6:0:0]
	[COLOR:2:3:0:0:0:6:0:0:0:0:0]
	[TILE:3:1:150:' ':8]
	[TILE:3:2:' ':' ':8]
	[TILE:3:3:' ':240:' ']
	[COLOR:3:1:6:0:0:0:0:0:6:7:0]
	[COLOR:3:2:0:0:0:0:0:0:6:7:0]
	[COLOR:3:3:0:0:0:7:0:1:0:0:0]
	[BUILD_ITEM:1:BUCKET:NONE:NONE:NONE][EMPTY][CAN_USE_ARTIFACT]
	[BUILD_ITEM:1:NONE:NONE:NONE:NONE][BUILDMAT][WORTHLESS_STONE_ONLY][CAN_USE_ARTIFACT]
	[TOOLTIP:Use tallow (rendered fat) or oil here with lye to make soap.]

A line-by-line breakdown:

 	[NAME:Soap Maker's Workshop]
 	[NAME_COLOR:7:0:1]

These are the name of the workshop ("Soap Maker's Workshop") and color of the workshop's name when examined with 'q' (White with a black background).

 	[DIM:3:3]
 	[WORK_LOCATION:2:2]

DIM refers to how large the workshop will be, in this case 3 wide, 3 tall. WORK_LOCATION tells where the creature using it (usually a dwarf) will work, numbered from the top right--in this case, 2:2, or the middle. Multiple work locations can be defined, even outside the dim.

 	[BUILD_LABOR:SOAP_MAKER]
 	[BUILD_KEY:CUSTOM_SHIFT_S]

These refer to the worker required to build it (soap maker) and the key used to build it in the workshop menu (capital S).

  	[BLOCK:1:0:0:0]
 	...

This is a bit more complex, and is where we get to the meaty part of workshop making--the tiles' properties. BLOCK refers to which tiles will be untraversable--1 means blocked, 0 means unblocked. The first number refers to row, and the next 3 refer to column, so 1:0:0:0 means that, on the first row, all tiles will be unblocked. This is the case for all vanilla workshops, as of now.

 	[TILE:0:1:' ':' ':150]
 	...

The TILE token tells which tile will go where. note, however, that there are 5 entries here instead of 4. The first number, in this case, refers to build stage, numbered from 0 to 3; 3 or 1 is fully built (depending on whether there are stages), 0 is just placed, and 2 is always an intermediate stage, while 1 is usually an intermediate stage. Whether 1 is an intermediate stage or not depends on if there are a 2 and 3 stage; if 2 and 3 exist, 1 will be intermediate. The second number and beyond are similar to BLOCK; however, instead of 1s and 0s, you must input tiles. The tiles themselves can be given in quotes (as in ' ') or given as a number, which can be looked up here. Here, we have 150, which is û.

 	[COLOR:1:1:0:0:0:0:0:0:6:0:0]
 	...

Color is as TILE, but with colors instead of tiles; however, colors are made up of 3 numbers each or MAT. MAT refers to the color of the material used to make it; the 3 numbers refer to foreground:background:foreground brightness, and can be looked up here. For example, 4:2:1 will give you bright red with a dark green background.

 	[BUILD_ITEM:1:BUCKET:NONE:NONE:NONE][EMPTY][CAN_USE_ARTIFACT]
 	[BUILD_ITEM:1:NONE:NONE:NONE:NONE][BUILDMAT][WORTHLESS_STONE_ONLY][CAN_USE_ARTIFACT]

These refer to items required to build the building. These are in the same format as reaction reagents and products--quantity:item:material. You'll learn more about those on the article about reactions, though. The second BUILD_ITEM is special-- it uses modifiers exclusively to determine its requirements. BUILDMAT refers to wood logs, wood blocks, stone boulders, and stone blocks; WORTHLESS_STONE_ONLY means it can't use economic stone; CAN_USE_ARTIFACT means that it... can use artifacts. EMPTY, in the bucket's case, means that the bucket must be empty.

 	[TOOLTIP:Use tallow (rendered fat) or oil here with lye to make soap.]

This is the text in the tooltip shown when the building is highlighted by the mouse in the workshops list.

More can be seen at the building tokens article.

Reactions[edit]

Reactions are the crafting recipes used in workshops, and by the adventurer. By adding new reactions you can make new items available, or enable you to get items or materials in new ways. The reactions can also be given to entities, in which case they will make use of them during both world gen and play; making a reaction that creates steel directly from plant fibers, would allow the elves to craft steel and arrive clad in it in a siege.

Not all crafting reactions are defined in the raws, but some are, such as those for pottery and alloy making.

An in-depth guide for reactions is available here.

Materials[edit]

As we've seen when talking about creatures, materials are vital. Materials show up in two forms: material templates, which generally show up in creatures, and specific materials (designated as "inorganic"), which are (by default, at least) consigned purely to metal and stone types.

Let's take a look at METAL_TEMPLATE in material_template_default.txt. It's evident that most of the basic properties of metals are already defined in the template - it goes red and melts at a high enough temperature, it's heavy, and (as noted by the very bottom token) is a metal. We already know just how useful templates can be to creatures, and the same applies to other materials.

Now let's take a look at inorganic_metal.txt. You can see that the metals here refer to the templates, and, just like we did with creatures, then modify the properties of that template and expand upon it.

Finally, let's look at inorganic_stone_mineral.txt. Here we can see that in addition to the changes made to the template, there are also ENVIRONMENT tokens - these tell the game where to place these minerals during worldgen.

Here's a list of material tokens. It should also help you out with any modifications you want to make regarding those creature modifications we were making a while back. See, it all ties together in the end. The beauty of the current materials system is that there's actually very little difference between, say, leather and iron - they're fundamentally the same thing, just with different properties, which is how things really should be.

Selecting and Cutting[edit]

As explained above, existing raws can be altered with the use of SELECT, and can also be culled with CUT for more granular control, compared to simply unloading vanilla content in the mod loader. Token behavior when multiple tokens are added is dependent on the individual token. Removing tags from an object without cutting and recreating the object in question is typically impossible, except for creature object tags removed and/or replaced with the use of creature variation tokens.

The syntax for selecting and cutting objects is as follows:

Substitute X for the desired object. A CUT does not need a SELECT prior, this is simply a list of available options.

[SELECT_CREATURE:X]
[CUT_CREATURE:X]

[SELECT_ENTITY:X]
[CUT_ENTITY:X]

[SELECT_INTERACTION:X]
[CUT_INTERACTION:X]

[SELECT_ITEM:X]
[CUT_ITEM:X]

[SELECT_WORD:X]
[CUT_WORD:X]

[SELECT_TRANSLATION:X]
[CUT_TRANSLATION:X]

[SELECT_SYMBOL:X]
[CUT_SYMBOL:X]

[SELECT_INORGANIC:X] 
[CUT_INORGANIC:X]

[SELECT_PLANT:X]
[CUT_PLANT:X]

[SELECT_MUSIC:X]
[CUT_MUSIC:X]

[SELECT_REACTION:X]
[CUT_REACTION:X]

[SELECT_SOUND:X]
[CUT_SOUND:X]

Examples[edit]

Main articles: Category:Modding_Examples

The Hydling below was made by Mysteryguye (and annotated, updated and separated into blocks by Putnam), to act as an example creature.

[CREATURE:HYDLING]
 	[DESCRIPTION:A seven-headed small hairy thing, about the size of a dog. It is very loyal to its masters, and will promptly disembowel any enemy straying too close.]
 	This is the description that shows up in-game when viewing the creature.

 	[NAME:hydling:hydlings:hydlish] If there were a civ made of hydlings, it would appear as "hydlings" in the neighbors screen.

 	[CASTE_NAME:hydling:hydlings:hydlish]

 	[CREATURE_TILE:'='][COLOR:2:0:1] Will appear as a light green "=".

 	[PETVALUE:40][NATURAL] Creature is known to be naturally occurring by the game. Will cost 40 embark points to buy.

 	[LARGE_ROAMING] Will spawn outdoors, wandering around.

 	[COMMON_DOMESTIC][TRAINABLE][PET] Can be bought on embark as a pet, war animal, or hunting animal.

 	[BONECARN] Can eat meat and bones only--no vegetables.

 	[PREFSTRING:loyalty] Dwarves will like it for its loyalty.

 	[LARGE_PREDATOR] Will attack rather than flee.

 	[BODY:BASIC_2PARTBODY:7HEADNECKS:BASIC_FRONTLEGS:BASIC_REARLEGS:TAIL:2EYES:NOSE:2LUNGS:HEART:GUTS:ORGANS:THROAT:SPINE:BRAIN:SKULL:3TOES_FQ_REG:3TOES_RQ_REG:MOUTH:TONGUE:GENERIC_TEETH_WITH_FANGS:RIBCAGE]

 	Has a lower body, upper body, 4 legs, a tail, fourteen eyes, fourteen ears, seven noses, two lungs, a heart, guts, a pancreas etc., and 7 heads with all that goes with those.

 	[BODYGLOSS:PAW] Feet will be called "paws"

 	[BODY_DETAIL_PLAN:STANDARD_MATERIALS] Declares the standard materials that most creatures' tissues are made of.

 	[BODY_DETAIL_PLAN:STANDARD_TISSUES] This declares the tissues that the creature's tissue layers are made of.

 	[BODY_DETAIL_PLAN:VERTEBRATE_TISSUE_LAYERS:SKIN:FAT:MUSCLE:BONE:CARTILAGE] And this describes the tissue layers that the creature is made of.

 	[BODY_DETAIL_PLAN:BODY_HAIR_TISSUE_LAYERS:HAIR] Creature will be covered with a layer of fur.

 	[USE_MATERIAL_TEMPLATE:NAIL:NAIL_TEMPLATE] And it'll have nails.

 	[USE_TISSUE_TEMPLATE:NAIL:NAIL_TEMPLATE]

 	[TISSUE_LAYER:BY_CATEGORY:TOE:NAIL:FRONT] On the toe, specifically.

 	[SELECT_TISSUE_LAYER:HEART:BY_CATEGORY:HEART]
 	 [PLUS_TISSUE_LAYER:SKIN:BY_CATEGORY:THROAT]
 		[TL_MAJOR_ARTERIES] Heart and throat--called above--will cause heavy bleeding if ruptured.

 	[BODY_DETAIL_PLAN:STANDARD_HEAD_POSITIONS] Places eyes, ears and what-have-you into their correct placement, so that you don't have people punching out eyes from behind.

 	[BODY_DETAIL_PLAN:HUMANOID_RIBCAGE_POSITIONS] Sets the ribcage as being around lungs and heart.

 	[USE_MATERIAL_TEMPLATE:SINEW:SINEW_TEMPLATE] Defines sinew so that...
 	[TENDONS:LOCAL_CREATURE_MAT:SINEW:200] Tendons...
 	[LIGAMENTS:LOCAL_CREATURE_MAT:SINEW:200] ...And ligaments can be defined.

 	[HAS_NERVES] Creature has nerves, and as such can be disabled by severing them.

 	[USE_MATERIAL_TEMPLATE:BLOOD:BLOOD_TEMPLATE] Defines the material BLOOD using the template BLOOD_TEMPLATE.
 	[BLOOD:LOCAL_CREATURE_MAT:BLOOD:LIQUID] Defines the creature's BLOOD as being made of the above-defined BLOOD material in a LIQUID state.

 	[CREATURE_CLASS:GENERAL_POISON] Creature can be affected by syndromes that affect GENERAL_POISON.

 	[GETS_WOUND_INFECTIONS] Pretty much self-explanatory. Creature can get infected from wounds.
 	[GETS_INFECTIONS_FROM_ROT] And from necrosis.

 	[USE_MATERIAL_TEMPLATE:PUS:PUS_TEMPLATE] Defines PUS using PUS_TEMPLATE.
 	[PUS:LOCAL_CREATURE_MAT:PUS:LIQUID] Defines PUS as being made of PUS.

 	[BODY_SIZE:0:0:1000] Creature will be 1000 cubic centimeters at birth...
 	[BODY_SIZE:1:0:12500] 12500 cubic centimeters at 1 year old...
 	[BODY_SIZE:2:0:30000] and 30000 cubic centimeters at 2.

 	[BODY_APPEARANCE_MODIFIER:LENGTH:90:95:98:100:102:105:110] Creature can be anywhere from 90% to 110% as long as others.
 	[BODY_APPEARANCE_MODIFIER:HEIGHT:90:95:98:100:102:105:110] As above, but with height.
 	[BODY_APPEARANCE_MODIFIER:BROADNESS:90:95:98:100:102:105:110] As above, but with broadness. This puts the minimum size of the creature (when fully grown) at 21870 and the maximum size at 39930.

 	[MAXAGE:20:30] Creature will die of old age between the ages of 20 and 30, no later than 30, no sooner than 20.

 	[CAN_DO_INTERACTION:MATERIAL_EMISSION] Creature can use the MATERIAL_EMISSION interaction.
 		[CDI:ADV_NAME:Hurl fireball] In adventurer mode, the MATERIAL_EMISSION interaction will appear as "Hurl fireball".
 		[CDI:USAGE_HINT:ATTACK] Creature will use MATERIAL_EMISSION when it's attacking, on creatures that it's attacking.
 		[CDI:BP_REQUIRED:BY_CATEGORY:HEAD] Creature must have at least one HEAD to use MATERIAL_EMISSION.
 		[CDI:FLOW:FIREBALL] The MATERIAL_EMISSION will shoot a fireball.
 		[CDI:TARGET:C:LINE_OF_SIGHT] The target for the emission--a location--must be within the line of sight of the Hydling.
 		[CDI:TARGET_RANGE:C:15] And must be, at most, 15 tiles away.
 		[CDI:MAX_TARGET_NUMBER:C:1] The hydling can only shoot at one target at a time...
 		[CDI:WAIT_PERIOD:30] and only every 30 ticks (3 tenths of a second at 100 FPS)

 	[ATTACK:BITE:CHILD_BODYPART_GROUP:BY_CATEGORY:HEAD:BY_CATEGORY:TOOTH] Defines a BITE attack that uses teeth.
 		[ATTACK_SKILL:BITE] Attack uses the BITE skill.
 		[ATTACK_VERB:nom:noms] "The Hydling noms the Elf in the left first toe, tearing the muscle!"
 		[ATTACK_CONTACT_PERC:100] Will use all of the tooth. Note that this can be more than 100.
 		[ATTACK_PENETRATION_PERC:100] Will sink the tooth all the way in. This can also be more than 100.
 		[ATTACK_FLAG_EDGE] Attack is an EDGE attack.
 		[ATTACK_PRIORITY:MAIN] Attack is of priority MAIN. Other option is SECOND.
 		[ATTACK_FLAG_CANLATCH] Attack can latch on.
                [ATTACK_PREPARE_AND_RECOVER:3:3] Takes 3 ticks to wind up attack and 3 to recover from it.
                [ATTACK_FLAG_INDEPENDENT_MULTIATTACK] Can use each head independently.

 	[ATTACK:SCRATCH:CHILD_TISSUE_LAYER_GROUP:BY_TYPE:STANCE:BY_CATEGORY:ALL:NAIL] As above, but for nail instead of teeth.
 		[ATTACK_SKILL:STANCE_STRIKE] Uses the kicking skill.
 		[ATTACK_VERB:slice:slices] "You slice the Elf in the left foot and the severed part sails off in an arc!"
 		[ATTACK_CONTACT_PERC:100] Uses the whole nail.
 		[ATTACK_PENETRATION_PERC:100] The whole nail goes in.
 		[ATTACK_FLAG_EDGE] Attack is an edge attack.
                [ATTACK_PREPARE_AND_RECOVER:3:3]
 		[ATTACK_PRIORITY:SECOND]

 	[CHILD:1] Hydling will become an adult at 1 year old.

 	[GENERAL_CHILD_NAME:hydie:hydies] Children will appear as "hydies".

 	[DIURNAL] Is active during the daytime.

 	[HOMEOTHERM:10070] Has a body temperature of 102 Fahrenheit.

 	[APPLY_CREATURE_VARIATION:STANDARD_QUADRUPED_GAITS:900:730:561:351:1900:2900] Can run at 25 kph
 	[APPLY_CREATURE_VARIATION:STANDARD_SWIMMING_GAITS:3512:2634:1756:878:4900:6900] Can swim at 10 kph
 	[APPLY_CREATURE_VARIATION:STANDARD_CRAWLING_GAITS:6561:6115:5683:1755:7456:8567] Can crawl at 5 kph
 	[SWIMS_INNATE]Swims innately.

 	[CASTE:FEMALE] Defines a caste called FEMALE.
 		[FEMALE] FEMALE caste is female.

 	[CASTE:MALE] As above, but with male.
 		[MALE] See above.

See also[edit]