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 "Graphics token"

From Dwarf Fortress Wiki
Jump to navigation Jump to search
(Addition of basic how-to's for creature graphics.)
(→‎Creature Graphics: Added statue and layer graphics)
Line 46: Line 46:
  
 
=== Basic Graphics ===
 
=== Basic Graphics ===
The most basic form of creature graphics is a single-tile, displayed by default for all conditions the creature is in:
+
The most basic form of creature graphics is a single tile, defined below:
 
  [CREATURE_GRAPHICS:<creature id>]
 
  [CREATURE_GRAPHICS:<creature id>]
 
     [<condition>:<tile page identifier>:<x position>:<y position>:<color type>:<secondary condition>]
 
     [<condition>:<tile page identifier>:<x position>:<y position>:<color type>:<secondary condition>]
  
* ''condition'': The state the creature needs to be in for this image to be displayed. Use <code>DEFAULT</code> for the simplest graphics.
+
* ''[[#Condition|condition]]'': The condition the creature needs to be in for this image to be displayed. Use <code>DEFAULT</code> for generic graphics.
* ''creature id'': The [[Creature token|Creature ID]] the graphics represent.
+
* ''creature id'': The [[Creature token|Creature ID]] of the creature the graphics represent.
* ''tile page identifier'': The Internal ID of the image defined in [[#Tile Page|tile page]].
+
* ''[[#Tile page|tile page identifier]]'': The Internal ID of the image defined in the Tile Page.
* ''x position'': The x position (left&rarr;right) of the image in tiles counting from 0.
+
* ''x position'': The x position of the graphic to be displayed in tiles counting from 0 (left&rarr;right).
* ''y position'': The y position (top&rarr;bottom) of the image in tiles counting from 0.
+
* ''y position'': The y position of the graphic to be displayed in tiles counting from 0 (top&rarr;bottom).
 
* ''color type'': (optional) Frequently replaced with <code>AS_IS</code> in vanilla [[Raw|RAW]]s. ColorTypeEnum{{cite|DF language server|https://gitlab.com/df-modding-tools/df-raw-language-server/-/blob/dev/df_ls_structure/src/objects/graphics.rs}}
 
* ''color type'': (optional) Frequently replaced with <code>AS_IS</code> in vanilla [[Raw|RAW]]s. ColorTypeEnum{{cite|DF language server|https://gitlab.com/df-modding-tools/df-raw-language-server/-/blob/dev/df_ls_structure/src/objects/graphics.rs}}
* ''secondary condition'': (optional) An additional condition that must be satisfied for the image to be displayed.
+
* ''[[#Condition|secondary condition]]'': (optional) An additional condition that must be satisfied for the image to be displayed.
 +
 
 +
When the condition {{token|DEFAULT|g}} is used, this graphic will be displayed for the creature in all conditions unless additional, more specific conditions are also defined.
  
  
 
==== Caste Graphics ====
 
==== Caste Graphics ====
 +
Creature caste graphics allow a simple alternative to [[#Layered Graphics:|Layered Graphics]] to represent males and females of a creature with a different image.
 
  [CREATURE_CASTE_GRAPHICS:<creature id>:<caste id>]
 
  [CREATURE_CASTE_GRAPHICS:<creature id>:<caste id>]
 
     [<condition>:<tile page identifier>:<x position>:<y position>:<color type>:<secondary condition>]
 
     [<condition>:<tile page identifier>:<x position>:<y position>:<color type>:<secondary condition>]
Line 70: Line 73:
 
==== Large Graphics ====
 
==== Large Graphics ====
 
The only difference between graphics for large creatures and small creatures is the addition of <code>LARGE_IMAGE</code> and additional coordinates to the line below:
 
The only difference between graphics for large creatures and small creatures is the addition of <code>LARGE_IMAGE</code> and additional coordinates to the line below:
 
 
     [<condition>:<tile page identifier>:LARGE_IMAGE:<x1>:<y1>:<x2>:<y2>:<color type>:<secondary condition>]
 
     [<condition>:<tile page identifier>:LARGE_IMAGE:<x1>:<y1>:<x2>:<y2>:<color type>:<secondary condition>]
  
Line 82: Line 84:
  
  
==== Conditions ====
+
==== Statue Graphics ====
Different graphics can be defined for the same creature based on some properties about it. Below is a list of all conditions that can be used for <code>CREATURE_GRAPHICS</code> and <code>CREATURE_CASTE_GRAPHICS</code>.
+
Statue graphics are the generic images placed on top of a pedestal whenever a creature is the primary subject of a statue. The image is implied to occupy multiple tiles, and all examples in vanilla are 1x2 vertical rectangles. Statue graphics are defined as below:
 +
[STATUE_CREATURE_GRAPHICS:<creature id>]
 +
        [DEFAULT:STATUES_LAYERED:<x1>:<y1>:<x2>:<y2>]
 +
 
 +
* ''creature id'': The [[Creature token|Creature ID]] the graphics represent.
 +
* ''x1'': The x position of the upper left tile counting from 0 from the left of the tile page.
 +
* ''y1'': The y position of the upper left tile counting from 0 from the top of the tile page.
 +
* ''x2'': The x position of the lower right tile.
 +
* ''y2'': The y position of the lower right tile.
 +
 
 +
 
 +
=== Layered Graphics ===
 +
Layered graphics are a method for displaying overlapping body parts, equipment, clothing, professions, hairstyles.. etc. They allow much more freedom in conditions than normal [[#Creature Graphics|Creature Graphics]], and they allow combinations of many graphical variations within the same creature to give your graphics more personality and display more information about the individuals. All layered graphics started as shown below:
 +
[CREATURE_GRAPHICS:<creature id>]
 +
[LAYER_SET:<condition>]
 +
 
 +
* ''creature id'': The [[Creature token|Creature ID]] of the creature the graphics represent.
 +
* ''[[#Condition|condition]]'': The condition the creature needs to be in for this set of layers to be displayed.
 +
 
 +
Once you start defining a Layer Set, you can begin adding individual layers from the bottom up to create your final image. For example, if you want to draw a helmet being worn on a head, you would define the head layer first, then define the helmet layer. Layers are defined according to this format:
 +
 
 +
[LAYER:<layer name>:<tile page id>:<x position>:<y position>:<color type>]
 +
 
 +
* ''layer name'': The internal name of the layer. Only one layer with the same name is displayed at a time.{{verify}}
 +
* ''[[#Tile page|tile page identifier]]'': The Internal ID of the image defined in the Tile Page.
 +
* ''x position'': The x position of the graphic to be displayed in tiles counting from 0 (left&rarr;right).
 +
* ''y position'': The y position of the graphic to be displayed in tiles counting from 0 (top&rarr;bottom).
 +
* ''LARGE_IMAGE:x1:y1:x2:y2'': (optional) Allows a multiple tile image to be displayed. Replaces <x position>:<y position>.
 +
* ''color type'': (optional) Frequently replaced with <code>AS_IS</code> in vanilla [[Raw|RAW]]s. ColorTypeEnum{{cite|DF language server|https://gitlab.com/df-modding-tools/df-raw-language-server/-/blob/dev/df_ls_structure/src/objects/graphics.rs}}
 +
 
 +
==== Layered Conditons ====
 +
Layers aren't very useful on their own, so they come with a set of conditions to define how when they are displayed and how they interact.
  
 
{| {{prettytable}}
 
{| {{prettytable}}
 
|- bgcolor="#dddddd"
 
|- bgcolor="#dddddd"
! Condition
+
! Token
! Accepts<br>Secondary
+
! Arguments
 +
! Type
 
! Description
 
! Description
 +
 +
|-
 +
| {{text_anchor|LAYER_GROUP}} ||  || Layer<br>Group
 +
| Begins defining a layer group. Current effect unknown.{{verify}}
 +
 +
|-
 +
| {{text_anchor|END_LAYER_GROUP}} ||  || Layer<br>Group
 +
| marks the end of a layer group. Current effect unknown.{{verify}}
 +
 
|-
 
|-
| {{text anchor|DEFAULT}} || No || The default condition that will be displayed unless overwritten by a more specific one below.
+
| {{text_anchor|CONDITION_ITEM_WORN}} ||
 +
* BY_CATEGORY / BY_TOKEN
 +
* [[Body_token#CATEGORY|category]] / [[Body_token#BP|body part token]]
 +
* Armor type (ARMOR, GLOVES, Etc.)
 +
* Item ID(s)
 +
|| Armor<br>Wieldables || Defines a clothing or armor graphic by the specific part it is equipped to, the type of armor it is, and the internal id of that item.  
 +
For example, a condition representing a right handed mitten or glove would be defined as:
 +
<code>[CONDITION_ITEM_WORN:BY_TOKEN:RH:GLOVES:ITEM_GLOVES_GLOVES:ITEM:GLOVES:MITTENS]</code>
  
 
|-
 
|-
| {{text anchor|CHILD}} || Yes || Will only be displayed if the creature has a {{token|CHILD|c}} or {{token|BABY|c}} and is younger than one of those ages.
+
| {{text_anchor|SHUT_OFF_IF_ITEM_PRESENT}} ||
 +
* BY_CATEGORY / BY_TOKEN
 +
* [[Body_token#CATEGORY|category]] / [[Body_token#BP|body part token]]
 +
* Armor type
 +
* Item ID(s)
 +
|| Armor || Causes the current layer to not be rendered if the creature has one of the items worn or equipped. Also accepts the input <code>WIELD:WEAPON:ANY</code>.
  
 
|-
 
|-
| {{text anchor|ANIMATED}} || Yes || Displayed if the creature is risen from the dead (has {{token|NOT_LIVING|c}} or {{token|OPPOSED_TO_LIFE|c}}){{verify}}
+
| {{text_anchor|CONDITION_DYE}} ||
 +
* dye color
 +
|| Armor
 +
|| Should represent which color the clothing is dyed. Currently nonfunctional.{{version|50.05}}
  
 
|-
 
|-
| {{text anchor|CORPSE}} || Yes || Displayed as soon as the creature dies.
+
| {{text_anchor|CONDITION_NOT_DYED}} ||   || Armor
 +
|| Should check if the clothing is dyed. Currently nonfunctional.{{version|50.05}}
  
 
|-
 
|-
| {{text anchor|TRAINED_HUNTER}} || Yes || Shown for hunting-trained versions of this creature.
+
| {{text_anchor|CONDITION_MATERIAL_FLAG}} ||
 +
* material flag
 +
|| Material || Changes graphics based on the material an equipped item is made of. Valid material flags include:
 +
* WOVEN_ITEM
 +
* ANY_WOOD_MATERIAL
 +
* ANY_BONE_MATERIAL
 +
* ANY_SHELL_MATERIAL
 +
* ANY_PLANT_MATERIAL
 +
* ANY_SILK_MATERIAL
 +
* ANY_YARN_MATERIAL
 +
* IS_DIVINE_MATERIAL
 +
* IS_CRAFTED_ARTIFACT
  
 
|-
 
|-
| {{text anchor|TRAINED_WAR}} || Yes || Shown for war-trained versions of this creature.
+
| {{text_anchor|CONDITION_MATERIAL_TYPE}} ||
 +
* material token
 +
|| Material || Changes graphics based on the material an equipped item is made of. Valid material types take the form <code>METAL:COPPER</code> where copper can be replaced with any weapons-grade metal. Initial testing has shown that some [[material token]]s are not functional. {{token|CONDITION_MATERIAL_FLAG}} is a better option for any material condition other than metal.
  
 
|-
 
|-
| {{text anchor|LIST_ICON}} || Unknown || Displayed in menus. Useful for large images that would extend beyond the menu boxes otherwise/
+
| {{text_anchor|CONDITION_PROFESSION_CATEGORY}} ||
 +
* [[Unit type token|profession token(s)]]
 +
|| General
 +
|| Checks the profession of the creature to act as a condition. Multiple profession tokens can be chained together.
  
 
|-
 
|-
| {{text anchor|SKELETON}} || Unknown || Decayed remains of the creature.{{verify}}
+
| {{text_anchor|CONDITION_RANDOM_PART_INDEX}} ||
 +
* body part
 +
* integer index
 +
* integer range
 +
|| General
 +
|| Chooses a random layer within the same group of body parts. Index is which option this condition is, out of Range number of options. Ex:
 +
<code>[CONDITION_RANDOM_PART_INDEX:HEAD:3:4]</code>
 +
Is the third possible random head out of four total options. One of these random conditions each will be put into a set of four slightly different heads to add some random variation in the appearance of the creature's head.
  
 
|-
 
|-
| {{text anchor|SKELETON_WITH_SKULL}} || Unknown || Decayed remains of the creature with a skull.{{verify}}
+
| {{text_anchor|CONDITION_HAUL_COUNT_MIN}} ||
 +
* integer
 +
|| General
 +
|| Counts how many items the creature is hauling. Used for {{token|PACK_ANIMAL}}s in vanilla.
  
 
|-
 
|-
| {{text anchor|VERMIN}} || Unknown || Necessary for defining graphics that use the tokens below.{{verify}}
+
| {{text_anchor|CONDITION_HAUL_COUNT_MAX}} ||
 +
* integer
 +
|| General
 +
|| Counts how many items the creature is hauling. Used for {{token|PACK_ANIMAL}}s in vanilla.
  
 
|-
 
|-
| {{text anchor|VERMIN_ALT}} || Unknown || Image cycles every 1 second.
+
| {{text_anchor|CONDITION_CHILD}} || General ||
 +
|| Checks if the creature is a child.
  
 
|-
 
|-
| {{text anchor|SWARM_SMALL}} || Unknown || For swarming vermin like [[fly|flies]] and [[fairy|fairies]] in small groups.
+
| {{text_anchor|CONDITION_NOT_CHILD}} || General ||
 +
|| Checks if the creature is an adult.
  
 
|-
 
|-
| {{text anchor|SWARM_MEDIUM}} || Unknown || For swarming vermin like [[fly|flies]] and [[fairy|fairies]] in medium-sized groups.
+
| {{text_anchor|CONDITION_GHOST}} || General ||
 +
|| Checks if the creature is a ghost.
  
 
|-
 
|-
| {{text anchor|SWARM_LARGE}} || Unknown || For swarming vermin like [[fly|flies]] and [[fairy|fairies]] in large groups.
+
| {{text_anchor|CONDITION_SYN_CLASS}} ||
 +
* {{token|SYN_CLASS}}
 +
|| Syndrome || Changes graphics based on any syndromes the creature is affected by. Valid values include:
 +
* ZOMBIE
 +
* NECROMANCER
 +
* VAMPCURSE
 +
* RAISED_UNDEAD
 +
* GHOUL
 +
As well as any mod-defined Syndrome Classes.{{verify}}
  
 
|-
 
|-
| {{text anchor|LIGHT_VERMIN}} || Unknown || For [[firefly|fireflies]] etc. Does not replace {{token|VERMIN|g}}.
+
| {{text_anchor|CONDITION_TISSUE_LAYER}} ||
 +
* BY_CATEGORY
 +
* [[Body_token#CATEGORY|body part category]] or ALL
 +
* [[Body_detail_plan_token#BP_LAYERS|tissue layer]] or ALL
 +
|| Tissue
 +
|| Selects a tissue layer to use for checking other conditions. Ex:
 +
<code>[CONDITION_TISSUE_LAYER:BY_CATEGORY:ALL:SKIN]</code>
  
 
|-
 
|-
| {{text anchor|LIGHT_VERMIN_ALT}} || Unknown || Like {{token|VERMIN_ALT|g}} for [[firefly|fireflies]] etc.
+
| {{text_anchor|TISSUE_MIN_LENGTH}} ||
 +
* integer
 +
|| Tissue
 +
|| Checks the current {{token|CONDITION_TISSUE_LAYER}}'s LENGTH [[Creature_token#TISSUE_LAYER_APPEARANCE_MODIFIER|appearance modifier]]. Is true if the LENGTH is greater than the integer input.
  
 
|-
 
|-
| {{text anchor|LIGHT_SWARM_SMALL}} || Unknown || Like {{token|SWARM_SMALL|g}} for [[firefly|fireflies]] etc in small groups.
+
| {{text_anchor|TISSUE_MAX_LENGTH}} ||
 +
* integer
 +
|| Tissue
 +
|| Checks the current {{token|CONDITION_TISSUE_LAYER}}'s LENGTH [[Creature_token#TISSUE_LAYER_APPEARANCE_MODIFIER|appearance modifier]]. Is true if the LENGTH is less than the integer input.
  
 
|-
 
|-
| {{text anchor|LIGHT_SWARM_MEDIUM}} || Unknown || Like {{token|SWARM_LARGE|g}} for [[firefly|fireflies]] etc in large groups.
+
| {{text_anchor|TISSUE_MAY_HAVE_COLOR}} ||
 +
* [[Color#Color_tokens|color token(s)]]
 +
|| Tissue
 +
|| Checks the selected tissue's color. Accepts multiple color tokens, and is true if the any of the colors is present in the selected tissues.
  
 
|-
 
|-
| {{text anchor|LIGHT_SWARM_LARGE}} || Unknown || Like {{token|SWARM_LARGE|g}} for [[firefly|fireflies]] etc.
+
| {{text_anchor|TISSUE_MAY_HAVE_SHAPING}} ||
 +
* styling token
 +
|| Tissue
 +
|| Checks the current {{token|CONDITION_TISSUE_LAYER}}'s shaping (hairstyle). Valid tokens are NEATLY_COMBED, BRAIDED, DOUBLE_BRAIDS, PONY_TAILS, CLEAN_SHAVEN and STANDARD_HAIR/BEARD/MOUSTACHE/SIDEBURNS_SHAPINGS.{{verify}}
  
 
|-
 
|-
| {{text anchor|REMAINS}} || Unknown || Vermin corpses.
+
| {{text_anchor|TISSUE_NOT_SHAPED}} || || Tissue
 +
|| Checks the current {{token|CONDITION_TISSUE_LAYER}}'s color. Accepts multiple color tokens, and is true if the any of the colors is present in the selected tissues.
  
 
|-
 
|-
| {{text anchor|HIVE}} || Unknown || Vermin hives.
+
| {{text_anchor|TISSUE_SWAP}} ||
|}
+
* IF_MIN_CURLY
 +
* integer
 +
* tile page id
 +
* x position
 +
* y position
 +
| Tissue
 +
| Checks if a tissue is sufficiently curly, and if so swaps to display a different image. The new image is defined by the tile page ID, x position, and y position.
  
 +
This condition should be within a [LAYER:... ] that has a similar graphic to the on in the TISSUE_SWAP.
 +
The current {{token|CONDITION_TISSUE_LAYER}} group must also include a {{token|TISSUE_MIN_LENGTH}}.
  
=== Layered Graphics ===
+
|}
Layered graphics are a method for displaying overlapping body parts, equipment, clothing, professions, hairstyles.. etc.
 
  
  
Line 162: Line 287:
 
Forgotten beast graphics define layered graphics based on which body parts are present in each procedurally-generated forgotten beast.
 
Forgotten beast graphics define layered graphics based on which body parts are present in each procedurally-generated forgotten beast.
  
     [TILE_GRAPHICS_RECTANGLE:<tile page id>:<x1>:<y1>:<x2>:<y2>:<body_rcp token>]
+
     [TILE_GRAPHICS_RECTANGLE:<tile page id>:<x1>:<y1>:<x2>:<y2>:<beast body token>]
  
* ''condition'': The state the creature needs to be in for this image to be displayed. Use <code>DEFAULT</code> for the simplest graphics.
+
* ''[[#Tile Page|tile page identifier]]'': Internal ID of the image defined in Tile Page.
* ''creature token'': The [[Creature token|Creature ID]] the graphics represent.
 
* ''tile page identifier'': The Internal ID of the image defined in [[#Tile Page|tile page]].
 
 
* ''x1'': The x position of the upper left tile counting from 0 from the left of the tile page.
 
* ''x1'': The x position of the upper left tile counting from 0 from the left of the tile page.
 
* ''y1'': The y position of the upper left tile counting from 0 from the top of the tile page.
 
* ''y1'': The y position of the upper left tile counting from 0 from the top of the tile page.
* ''x2'': The x position of the lower right tile.
+
* ''x2'': X position of the lower right tile.
* ''y2'': The y position of the lower right tile.
+
* ''y2'': Y position of the lower right tile.
 +
* ''beast body token'': The internal ID of generated forgotten beast body types and body parts.
  
The <code>TILE_GRAPHICS_RECTANGLE</code> token displays a large image with the upper left corner being defined by <x1>, <y1> and the lower right corner defined by <x2>, <y2>. The <body_rcp_token> is a conditional token that causes the graphics for each layer to be displayed only when the forgotten beast has that particular body part.{{verify}}
+
The <code>TILE_GRAPHICS_RECTANGLE</code> token displays a large image with the upper left corner being defined by <x1>, <y1> and the lower right corner defined by <x2>, <y2>. The <beast body token> is a conditional token that causes the graphics for each layer to be displayed only when the forgotten beast has that particular body type or part.{{verify}}
  
 
There is not currently a way to use procedurally defined graphics like this for non-{{token|FEATURE_BEAST|c}} creatures.{{verify}}
 
There is not currently a way to use procedurally defined graphics like this for non-{{token|FEATURE_BEAST|c}} creatures.{{verify}}
  
 +
 +
=== Conditions ===
 +
Different graphics can be defined for the same creature based on some properties about it. Below is a list of all conditions that can be used for creature graphics that accept a ''condition'' token.
 +
 +
{| {{prettytable}}
 +
|- bgcolor="#dddddd"
 +
! Condition
 +
! Accepts<br>Secondary
 +
! Description
 +
|-
 +
| {{text anchor|DEFAULT}} || No || The default condition that will be displayed unless overwritten by a more specific one below.
 +
 +
|-
 +
| {{text anchor|CHILD}} || Yes || Will only be displayed if the creature has a {{token|CHILD|c}} or {{token|BABY|c}} and is younger than one of those ages.
 +
 +
|-
 +
| {{text anchor|ANIMATED}} || Yes || Displayed if the creature is risen from the dead (has {{token|NOT_LIVING|c}} or {{token|OPPOSED_TO_LIFE|c}}){{verify}}
 +
 +
|-
 +
| {{text anchor|CORPSE}} || Yes || Displayed as soon as the creature dies.
 +
 +
|-
 +
| {{text anchor|TRAINED_HUNTER}} || Yes || Shown for hunting-trained versions of this creature.
 +
 +
|-
 +
| {{text anchor|TRAINED_WAR}} || Yes || Shown for war-trained versions of this creature.
 +
 +
|-
 +
| {{text anchor|LIST_ICON}} || Unknown || Displayed in menus. Useful for large images that would extend beyond the menu boxes otherwise/
 +
 +
|-
 +
| {{text anchor|SKELETON}} || Unknown || Decayed remains of the creature.{{verify}}
 +
 +
|-
 +
| {{text anchor|SKELETON_WITH_SKULL}} || Unknown || Decayed remains of the creature with a skull.{{verify}}
 +
|}
 +
 +
 +
Special Conditions for {{token|VERMIN|c}} creature graphics:
 +
{| {{prettytable}}
 +
|- bgcolor="#dddddd"
 +
! Condition
 +
! Description
 +
|-
 +
| {{text anchor|VERMIN}} || Necessary for defining graphics that use the tokens below.{{verify}}
 +
 +
|-
 +
| {{text anchor|VERMIN_ALT}} || Image cycles every 1 second.
 +
 +
|-
 +
| {{text anchor|SWARM_SMALL}} || For swarming vermin like [[fly|flies]] and [[fairy|fairies]] in small groups.
 +
 +
|-
 +
| {{text anchor|SWARM_MEDIUM}} || For swarming vermin like [[fly|flies]] and [[fairy|fairies]] in medium-sized groups.
 +
 +
|-
 +
| {{text anchor|SWARM_LARGE}} || For swarming vermin like [[fly|flies]] and [[fairy|fairies]] in large groups.
 +
 +
|-
 +
| {{text anchor|LIGHT_VERMIN}} || For [[firefly|fireflies]] etc. Does not replace {{token|VERMIN|g}}.
 +
 +
|-
 +
| {{text anchor|LIGHT_VERMIN_ALT}} || Like {{token|VERMIN_ALT|g}} for [[firefly|fireflies]] etc.
 +
 +
|-
 +
| {{text anchor|LIGHT_SWARM_SMALL}} || Like {{token|SWARM_SMALL|g}} for [[firefly|fireflies]] etc in small groups.
 +
 +
|-
 +
| {{text anchor|LIGHT_SWARM_MEDIUM}} || Like {{token|SWARM_LARGE|g}} for [[firefly|fireflies]] etc in large groups.
 +
 +
|-
 +
| {{text anchor|LIGHT_SWARM_LARGE}} || Like {{token|SWARM_LARGE|g}} for [[firefly|fireflies]] etc.
 +
 +
|-
 +
| {{text anchor|REMAINS}} || Vermin corpses.
 +
 +
|-
 +
| {{text anchor|HIVE}} || Vermin hives.
 +
|}
  
 
== Item Graphics ==
 
== Item Graphics ==

Revision as of 18:43, 6 January 2023

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


The [OBJECT:GRAPHICS] token defines the use of various tile-based graphics in the game. As of version 50.01, graphics tokens have been greatly expanded to accommodate the release of the Steam & Itch premium version. These tokens, and explanations on how to use them, are listed below; the list will expand as the tokens are discovered and understood.

Making custom graphics requires multiple interacting files to function:

  1. An 8bit RGBA (sometimes called 32bit) "imagename.png" in the \<mod_id>\graphics\images folder
  2. A "tile_page_name.txt" in the \<mod_id>\graphics folder
  3. A "graphics_type_name.txt" in the \<mod_id>\graphics folder

Mods can reuse any graphics loaded ahead of them (including vanilla) by using the same tile page token.

Tile Page

Tile pages link image files to a tile page token so they can be referenced by the graphics file. Just like all other Raw files, Tile Pages must be defined from within a properly named "tile_page_<name>.txt" file and follow:

tile_page_<name>

[OBJECT:TILE_PAGE]

After the object type is defined as above, any number of tile pages can be defined according to the format below.

  [TILE_PAGE:<tile page identifier>]
     [FILE:images/imagename.png]
     [TILE_DIM:<tile x dim>:<tile y dim>]
     [PAGE_DIM_PIXELS:<page x dim>:<page y dim>]
  • tile page identifier: The Internal ID being created for the image.
  • imagename.png: The file name of the 8bit RGBA (sometimes called 32bit) in the \graphics\images folder of the mod.
  • tile x dim: The width of each tile in pixels (usually 32).
  • tile y dim: The height of each tile in pixels (usually 32).
  • page x dim: The width of the image file in pixels.
  • page y dim: The height of the image file in pixels.

Known issues:

  • Currently it is only recommended to use [TILE_DIM:32:32] as only the upper left 32x32 pixels are displayed on tiles defined larger, and smaller tiles are displayed starting from the upper left of each in-game square (individually by tile with large graphics) rather than centered and bottom justified as might be expected.
  • It is important that the [PAGE_DIM_PIXELS:<x dim>:<y dim>] matches the size of the referenced image exactly - as the game will stretch tile pages with a dimension larger than the actual image by inserting blank lines, and a tile page smaller than the image will cause a crash to desktop.


Creature Graphics

Creature graphics are found within graphics_creature_x files (such as graphics_creature_domestic or graphics_creature_layered). All graphics files must begin with the file name, followed by the [OBJECT:GRAPHICS] token that tells the game that the file contains graphics definitions.


Basic Graphics

The most basic form of creature graphics is a single tile, defined below:

[CREATURE_GRAPHICS:<creature id>]
   [<condition>:<tile page identifier>:<x position>:<y position>:<color type>:<secondary condition>]
  • condition: The condition the creature needs to be in for this image to be displayed. Use DEFAULT for generic graphics.
  • creature id: The Creature ID of the creature the graphics represent.
  • tile page identifier: The Internal ID of the image defined in the Tile Page.
  • x position: The x position of the graphic to be displayed in tiles counting from 0 (left→right).
  • y position: The y position of the graphic to be displayed in tiles counting from 0 (top→bottom).
  • color type: (optional) Frequently replaced with AS_IS in vanilla RAWs. ColorTypeEnum[1]
  • secondary condition: (optional) An additional condition that must be satisfied for the image to be displayed.

When the condition [DEFAULT] is used, this graphic will be displayed for the creature in all conditions unless additional, more specific conditions are also defined.


Caste Graphics

Creature caste graphics allow a simple alternative to Layered Graphics to represent males and females of a creature with a different image.

[CREATURE_CASTE_GRAPHICS:<creature id>:<caste id>]
   [<condition>:<tile page identifier>:<x position>:<y position>:<color type>:<secondary condition>]
  • caste id: The Caste ID of the caste whose graphics are being specifically defined.

Creature caste graphics only accept MALE and FEMALE as caste id's even in custom creatures that have more than two castes.


Large Graphics

The only difference between graphics for large creatures and small creatures is the addition of LARGE_IMAGE and additional coordinates to the line below:

   [<condition>:<tile page identifier>:LARGE_IMAGE:<x1>:<y1>:<x2>:<y2>:<color type>:<secondary condition>]
  • LARGE_IMAGE: This tag allows a rectangular image with multiple tiles to be defined by its upper left and lower right tiles. Valid for 1x1 - 3x2 tiles.
  • x1: The x position of the upper left tile counting from 0 from the left of the tile page.
  • y1: The y position of the upper left tile counting from 0 from the top of the tile page.
  • x2: The x position of the lower right tile.
  • y2: The y position of the lower right tile.

Large images and small images can be used within the same CREATURE_GRAPHICS or CREATURE_CASTE_GRAPHICS definition, and in fact it is often useful to include a single tile image to act as a [LIST_ICON] for menus.


Statue Graphics

Statue graphics are the generic images placed on top of a pedestal whenever a creature is the primary subject of a statue. The image is implied to occupy multiple tiles, and all examples in vanilla are 1x2 vertical rectangles. Statue graphics are defined as below:

[STATUE_CREATURE_GRAPHICS:<creature id>]
       [DEFAULT:STATUES_LAYERED:<x1>:<y1>:<x2>:<y2>]
  • creature id: The Creature ID the graphics represent.
  • x1: The x position of the upper left tile counting from 0 from the left of the tile page.
  • y1: The y position of the upper left tile counting from 0 from the top of the tile page.
  • x2: The x position of the lower right tile.
  • y2: The y position of the lower right tile.


Layered Graphics

Layered graphics are a method for displaying overlapping body parts, equipment, clothing, professions, hairstyles.. etc. They allow much more freedom in conditions than normal Creature Graphics, and they allow combinations of many graphical variations within the same creature to give your graphics more personality and display more information about the individuals. All layered graphics started as shown below:

[CREATURE_GRAPHICS:<creature id>]
	[LAYER_SET:<condition>]
  • creature id: The Creature ID of the creature the graphics represent.
  • condition: The condition the creature needs to be in for this set of layers to be displayed.

Once you start defining a Layer Set, you can begin adding individual layers from the bottom up to create your final image. For example, if you want to draw a helmet being worn on a head, you would define the head layer first, then define the helmet layer. Layers are defined according to this format:

[LAYER:<layer name>:<tile page id>:<x position>:<y position>:<color type>]
  • layer name: The internal name of the layer. Only one layer with the same name is displayed at a time.[Verify]
  • tile page identifier: The Internal ID of the image defined in the Tile Page.
  • x position: The x position of the graphic to be displayed in tiles counting from 0 (left→right).
  • y position: The y position of the graphic to be displayed in tiles counting from 0 (top→bottom).
  • LARGE_IMAGE:x1:y1:x2:y2: (optional) Allows a multiple tile image to be displayed. Replaces <x position>:<y position>.
  • color type: (optional) Frequently replaced with AS_IS in vanilla RAWs. ColorTypeEnum[2]


Layered Conditons

Layers aren't very useful on their own, so they come with a set of conditions to define how when they are displayed and how they interact.

Token Arguments Type Description
LAYER_GROUP Layer
Group
Begins defining a layer group. Current effect unknown.[Verify]
END_LAYER_GROUP Layer
Group
marks the end of a layer group. Current effect unknown.[Verify]
CONDITION_ITEM_WORN Armor
Wieldables
Defines a clothing or armor graphic by the specific part it is equipped to, the type of armor it is, and the internal id of that item.

For example, a condition representing a right handed mitten or glove would be defined as: [CONDITION_ITEM_WORN:BY_TOKEN:RH:GLOVES:ITEM_GLOVES_GLOVES:ITEM:GLOVES:MITTENS]

SHUT_OFF_IF_ITEM_PRESENT Armor Causes the current layer to not be rendered if the creature has one of the items worn or equipped. Also accepts the input WIELD:WEAPON:ANY.
CONDITION_DYE
  • dye color
Armor Should represent which color the clothing is dyed. Currently nonfunctional.v50.05
CONDITION_NOT_DYED Armor Should check if the clothing is dyed. Currently nonfunctional.v50.05
CONDITION_MATERIAL_FLAG
  • material flag
Material Changes graphics based on the material an equipped item is made of. Valid material flags include:
  • WOVEN_ITEM
  • ANY_WOOD_MATERIAL
  • ANY_BONE_MATERIAL
  • ANY_SHELL_MATERIAL
  • ANY_PLANT_MATERIAL
  • ANY_SILK_MATERIAL
  • ANY_YARN_MATERIAL
  • IS_DIVINE_MATERIAL
  • IS_CRAFTED_ARTIFACT
CONDITION_MATERIAL_TYPE
  • material token
Material Changes graphics based on the material an equipped item is made of. Valid material types take the form METAL:COPPER where copper can be replaced with any weapons-grade metal. Initial testing has shown that some material tokens are not functional. [CONDITION_MATERIAL_FLAG] is a better option for any material condition other than metal.
CONDITION_PROFESSION_CATEGORY General Checks the profession of the creature to act as a condition. Multiple profession tokens can be chained together.
CONDITION_RANDOM_PART_INDEX
  • body part
  • integer index
  • integer range
General Chooses a random layer within the same group of body parts. Index is which option this condition is, out of Range number of options. Ex:

[CONDITION_RANDOM_PART_INDEX:HEAD:3:4] Is the third possible random head out of four total options. One of these random conditions each will be put into a set of four slightly different heads to add some random variation in the appearance of the creature's head.

CONDITION_HAUL_COUNT_MIN
  • integer
General Counts how many items the creature is hauling. Used for [PACK_ANIMAL]s in vanilla.
CONDITION_HAUL_COUNT_MAX
  • integer
General Counts how many items the creature is hauling. Used for [PACK_ANIMAL]s in vanilla.
CONDITION_CHILD General Checks if the creature is a child.
CONDITION_NOT_CHILD General Checks if the creature is an adult.
CONDITION_GHOST General Checks if the creature is a ghost.
CONDITION_SYN_CLASS Syndrome Changes graphics based on any syndromes the creature is affected by. Valid values include:
  • ZOMBIE
  • NECROMANCER
  • VAMPCURSE
  • RAISED_UNDEAD
  • GHOUL

As well as any mod-defined Syndrome Classes.[Verify]

CONDITION_TISSUE_LAYER Tissue Selects a tissue layer to use for checking other conditions. Ex:

[CONDITION_TISSUE_LAYER:BY_CATEGORY:ALL:SKIN]

TISSUE_MIN_LENGTH
  • integer
Tissue Checks the current [CONDITION_TISSUE_LAYER]'s LENGTH appearance modifier. Is true if the LENGTH is greater than the integer input.
TISSUE_MAX_LENGTH
  • integer
Tissue Checks the current [CONDITION_TISSUE_LAYER]'s LENGTH appearance modifier. Is true if the LENGTH is less than the integer input.
TISSUE_MAY_HAVE_COLOR Tissue Checks the selected tissue's color. Accepts multiple color tokens, and is true if the any of the colors is present in the selected tissues.
TISSUE_MAY_HAVE_SHAPING
  • styling token
Tissue Checks the current [CONDITION_TISSUE_LAYER]'s shaping (hairstyle). Valid tokens are NEATLY_COMBED, BRAIDED, DOUBLE_BRAIDS, PONY_TAILS, CLEAN_SHAVEN and STANDARD_HAIR/BEARD/MOUSTACHE/SIDEBURNS_SHAPINGS.[Verify]
TISSUE_NOT_SHAPED Tissue Checks the current [CONDITION_TISSUE_LAYER]'s color. Accepts multiple color tokens, and is true if the any of the colors is present in the selected tissues.
TISSUE_SWAP
  • IF_MIN_CURLY
  • integer
  • tile page id
  • x position
  • y position
Tissue Checks if a tissue is sufficiently curly, and if so swaps to display a different image. The new image is defined by the tile page ID, x position, and y position.

This condition should be within a [LAYER:... ] that has a similar graphic to the on in the TISSUE_SWAP. The current [CONDITION_TISSUE_LAYER] group must also include a [TISSUE_MIN_LENGTH].


Forgotten Beast Graphics

Forgotten beast graphics define layered graphics based on which body parts are present in each procedurally-generated forgotten beast.

   [TILE_GRAPHICS_RECTANGLE:<tile page id>:<x1>:<y1>:<x2>:<y2>:<beast body token>]
  • tile page identifier: Internal ID of the image defined in Tile Page.
  • x1: The x position of the upper left tile counting from 0 from the left of the tile page.
  • y1: The y position of the upper left tile counting from 0 from the top of the tile page.
  • x2: X position of the lower right tile.
  • y2: Y position of the lower right tile.
  • beast body token: The internal ID of generated forgotten beast body types and body parts.

The TILE_GRAPHICS_RECTANGLE token displays a large image with the upper left corner being defined by <x1>, <y1> and the lower right corner defined by <x2>, <y2>. The <beast body token> is a conditional token that causes the graphics for each layer to be displayed only when the forgotten beast has that particular body type or part.[Verify]

There is not currently a way to use procedurally defined graphics like this for non-[FEATURE_BEAST] creatures.[Verify]


Conditions

Different graphics can be defined for the same creature based on some properties about it. Below is a list of all conditions that can be used for creature graphics that accept a condition token.

Condition Accepts
Secondary
Description
DEFAULT No The default condition that will be displayed unless overwritten by a more specific one below.
CHILD Yes Will only be displayed if the creature has a [CHILD] or [BABY] and is younger than one of those ages.
ANIMATED Yes Displayed if the creature is risen from the dead (has [NOT_LIVING] or [OPPOSED_TO_LIFE])[Verify]
CORPSE Yes Displayed as soon as the creature dies.
TRAINED_HUNTER Yes Shown for hunting-trained versions of this creature.
TRAINED_WAR Yes Shown for war-trained versions of this creature.
LIST_ICON Unknown Displayed in menus. Useful for large images that would extend beyond the menu boxes otherwise/
SKELETON Unknown Decayed remains of the creature.[Verify]
SKELETON_WITH_SKULL Unknown Decayed remains of the creature with a skull.[Verify]


Special Conditions for [VERMIN] creature graphics:

Condition Description
VERMIN Necessary for defining graphics that use the tokens below.[Verify]
VERMIN_ALT Image cycles every 1 second.
SWARM_SMALL For swarming vermin like flies and fairies in small groups.
SWARM_MEDIUM For swarming vermin like flies and fairies in medium-sized groups.
SWARM_LARGE For swarming vermin like flies and fairies in large groups.
LIGHT_VERMIN For fireflies etc. Does not replace [VERMIN].
LIGHT_VERMIN_ALT Like [VERMIN_ALT] for fireflies etc.
LIGHT_SWARM_SMALL Like [SWARM_SMALL] for fireflies etc in small groups.
LIGHT_SWARM_MEDIUM Like [SWARM_LARGE] for fireflies etc in large groups.
LIGHT_SWARM_LARGE Like [SWARM_LARGE] for fireflies etc.
REMAINS Vermin corpses.
HIVE Vermin hives.

Item Graphics

Item graphics can also be defined, but are mostly hardcoded. This section of the wiki needs to be fleshed out.


See Also