- 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.
Interaction token
v50.14 · v0.47.05 This article is about the current version of DF.Note that some content may still need to be updated. |
The following tokens can be used to define and use interactions.
Interaction Definitions
Token | Context | Arguments | Description |
---|---|---|---|
I_SOURCE | Global | type | Defines what things are capable of triggering this interaction. Can be specified multiple times. Valid values:
|
IS_HIST_STRING_1 | Within I_SOURCE | text | Describes what the interaction did to a historical figure. Displayed after the name of the historical figure that performed the interaction.
[IS_HIST_STRING_1: cursed ] |
IS_HIST_STRING_2 | Within I_SOURCE | text | Describes what the interaction did to a historical figure. Displayed after the name of the historical figure that was targeted by the interaction.
[IS_HIST_STRING_2: to assume the form of a lizard-like monster every full moon] |
IS_FREQUENCY | Within I_SOURCE | Number | Presumably, the probability of biome specified by [IS_REGION] to have this interaction. |
IS_NAME | Within I_SOURCE | string | Generally used with secrets, describes what the secret is about. |
IS_REGION | Within I_SOURCE:REGION | Region type | Indicates what types of regions are capable of performing this interaction. Can be specified multiple times. Valid values:
|
IS_SPHERE | Within I_SOURCE:SECRET | Sphere | Indicates the sphere to which this secret pertains. Only one sphere can be defined for each [I_SOURCE:SECRET] token, thus several [I_SOURCE:SECRET] tokens required to create a valid custom secret, which belongs to several different spheres |
IS_SECRET_GOAL | Within I_SOURCE:SECRET | Secret Goal token | Indicates why somebody would want to learn the secret. Valid values:
However, currently only immortality will result in a secret being pursued during world-gen. |
IS_SECRET | Within I_SOURCE:SECRET | Secret Flag | Indicates how the secret can be learned. Valid values:
|
IS_USAGE_HINT | Within I_SOURCE:DEITY | Usage Hint token | Indicates why a deity would choose to perform this interaction. See CDI:USAGE_HINT below for valid values - in this context, MAJOR_CURSE is the only value that makes sense. |
I_TARGET | Global | id, type | Specifies what things this interaction acts upon. Can be specified multiple times. Valid values:
|
IT_LOCATION | Within I_TARGET | Location | Narrows down exactly what the interaction targets. Valid values:
|
IT_MANUAL_INPUT | Within I_TARGET | text | Tells the player what they should be selecting. If not specified, the player will only be able to target himself. |
IT_AFFECTED_CREATURE | Within I_TARGET:CORPSE or I_TARGET:CREATURE | CREATURE:CASTE | Specifies specific creatures the interaction can target. |
IT_AFFECTED_CLASS | Within I_TARGET:CORPSE or I_TARGET:CREATURE | Creature class | Specifies creature classes the interaction can target. |
IT_IMMUNE_CREATURE | Within I_TARGET:CORPSE or I_TARGET:CREATURE | CREATURE:CASTE | Specifies specific creatures the interaction cannot target. |
IT_IMMUNE_CLASS | Within I_TARGET:CORPSE or I_TARGET:CREATURE | Creature class | Specifies creature classes the interaction cannot target. |
IT_REQUIRES | Within I_TARGET:CORPSE or I_TARGET:CREATURE | Creature token or property | Indicates that the target must have the specified property. Valid values:
|
IT_FORBIDDEN | Within I_TARGET:CORPSE or I_TARGET:CREATURE | Creature token or property | Indicates that the target must not have the specified property. Valid values are the same as for IT_REQUIRES. |
IT_CANNOT_TARGET_IF_ALREADY_AFFECTED | Within I_TARGET:CORPSE or I_TARGET:CREATURE | Prevents the interaction from targeting a creature that's already under the effect of the same interaction. | |
IT_CANNOT_HAVE_SYNDROME_CLASS | Within I_TARGET:CORPSE or I_TARGET:CREATURE | Syndrome class | Prevents the interaction from targeting a creature under the effects of a syndrome having the specified SYN_CLASS value. |
IT_MATERIAL | Within I_TARGET:MATERIAL | Type | Specifies the type of material the interaction targets. Valid values:
|
I_EFFECT | Global | type | Specifies what the interaction does to the targets. Can be specified multiple times. Valid values:
|
IE_TARGET | Within I_EFFECT | ID | Specifies which I_TARGET this effect will be applied to |
IE_INTERMITTENT | Within I_EFFECT | Frequency | Indicates that the effect happens intermittently and specifies roughly how often. Valid values:
note: DAILY and YEARLY also exist in the string dump but haven't been tested fully. |
IE_IMMEDIATE | Within I_EFFECT | Indicates that the effect happens immediately. | |
IE_LOCATION | Within I_EFFECT | Location Hint | Indicates where the effect can take place. Valid values:
|
IE_ARENA_NAME | Within I_EFFECT | text | Allows the interaction to be applied to newly-spawned creatures in Arena mode. |
IE_GRIME_LEVEL | Within I_EFFECT:CLEAN | amount? | [IE_GRIME_LEVEL:2] appears in the default cleaning interaction, and may indicate amount of grime cleaned. |
IE_SYNDROME_TAG | Within I_EFFECT:CLEAN | Syndrome flag | Indicates that cleaning off materials will activate their syndromes if they have this flag. |
GENERATED | Global | Indicates that this is a generated interaction. Cannot be specified in user-defined raws. |
Interaction Usage
In order to actually use an interaction, add the creature token [CAN_DO_INTERACTION:NAME] followed by a series of [CDI:...] tokens. Interactions can also be granted through syndromes using the token [CE_CAN_DO_INTERACTION] (plus the same series of CDI tokens).
The following CDI tokens can be specified:
Token | Arguments | Description |
---|---|---|
INTERACTION | id | Specifies which interaction can be performed. Only to be used with syndromes, since CE_CAN_DO_INTERACTION does not allow specifying the interaction ID directly. |
TARGET | target ID, target types | Specifies how the creature chooses what to target. Target ID refers to an I_TARGET defined in the interaction itself. Multiple target types can be specified. If no target is specified, creature will target any available target within range, even through walls. Valid target types:
|
TARGET_RANGE | target ID, range | Specifies how far away the target can be, in tiles. For SOLID_GLOB, LIQUID_GLOB and FIREBALL breath attacks, also determines how far the projectiles will fly before falling to the ground. |
LOCATION_HINT | Location Hint (see above) | ? |
USAGE_HINT | Usage hint token | Indicates when and how CPU-controlled creatures will use the interaction. If no hint is specified, the interaction will be used whenever a valid target is available. Valid values:
|
ADV_NAME | text | Specifies the interaction's name when used in Adventurer mode. |
MAX_TARGET_NUMBER | ID, number | Specifies the maximum number of things that can be selected for a particular I_TARGET. |
WAIT_PERIOD | number | Controls how often the interaction can be used. |
VERBAL | Only creatures that can speak will be able to use the interaction. Might also be needed for VERBAL_SPEECH. | |
VERBAL_SPEECH | filename | Specifies what the creature says when they perform the interaction. Filename path is relative to /data/speech. |
CAN_BE_MUTUAL | Presumably, allows two creatures with this same interaction to use it on each other simultaneously, for example cats cleaning each other. | |
FREE_ACTION | Indicates that performing the interaction doesn't take any time. | |
VERB | self:other:mutual | When a creature uses the interaction, a message will display, describing the source as doing this. |
VERB_REVERSE | ? | ? |
TARGET_VERB | self:other | When a creature uses the interaction, a message will display, describing the target as doing this. |
BP_REQUIRED | Body part criteria | Indicates that a particular body part must be present in order to perform the interaction. Criteria are BY_CATEGORY:category, BY_TYPE:type, or BY_TOKEN:token. |
FLOW | Breath attack token | Causes the interaction to create an effect not made of any material. Only makes sense for FIREBALL, FIREJET, or DRAGONFIRE. |
MATERIAL | Material token:Breath attack token | Causes the interaction to create an effect made of a specific material. Doesn't make sense for FIREBALL, FIREJET, or DRAGONFIRE. |
Breath attacks
Breath attacks are controlled by the MATERIAL_EMISSION interaction, like so:
[CAN_DO_INTERACTION:MATERIAL_EMISSION] [CDI:ADV_NAME:Breath custom material] [CDI:USAGE_HINT:ATTACK] [CDI:BP_REQUIRED:BY_CATEGORY:MOUTH] [CDI:MATERIAL:LOCAL_CREATURE_MAT:CUSTOMMATERIAL:TRAILING_VAPOR_FLOW] [CDI:TARGET:C:LINE_OF_SIGHT] [CDI:TARGET_RANGE:C:15] [CDI:MAX_TARGET_NUMBER:C:1] [CDI:WAIT_PERIOD:50]
The most important part is this line:
[CDI:MATERIAL:LOCAL_CREATURE_MAT:CUSTOMMATERIAL:TRAILING_VAPOR_FLOW]
The CDI refers to CAN_DO_INTERACTION; the MATERIAL states that this line shows what the material is. LOCAL_CREATURE_MAT:CUSTOMMATERIAL is your material, and TRAILING_VAPOR_FLOW refers to the breath attack type. Other types are seen below. Also important is this line:
[CDI:TARGET:C:LINE_OF_SIGHT]
LINE_OF_SIGHT refers to where the target C may be; others include SELF_ALLOWED (presumably like LINE_OF_SIGHT, but with the creature allowed to target itself), SELF_ONLY (preferable for undirected attacks and TOUCHABLE (for up-close attacks, as trailing flows tend to be).
Breath Attack Types
Token | Description |
---|---|
TRAILING_DUST_FLOW | Lets out a cloud of solid dust. Appears to use cave-in dust physics, causing this to fling around anything it comes in contact with, making it capable of smashing creatures into the ground and flinging them over walls. Creature will attack as normal. |
TRAILING_VAPOR_FLOW | Shoots a trail of liquid mist at the target which can condense and trigger contact syndromes. Creature will attack as normal. |
TRAILING_GAS_FLOW | Shoots a trail of gas substance at the creature which can be inhaled. Creature will attack as normal. |
TRAILING_ITEM_FLOW:item token | Shoots a "cloud" of items at the target, leaving piles of this item on the floor. Note that this does not create the actual items or use falling item mechanics (meaning no flying daggers or Touhou-style barrages, unfortunately). Instead, this token acts as TRAILING_GAS_FLOW, except that the material will use its normal temperature - for example, a breath attack of steel anvils will envelop the target in a "burst of steel". Creature will attack as normal. |
SOLID_GLOB | Shoots a solid glob of spinning substance at the creature, leaving symbols similar to broken arrows. Essentially a projectile weapon. If the cooldown rate is short enough, some creatures with this breath attack will not move, preferring instead to stay and shoot globs at you, even when you are literally right next to them. |
LIQUID_GLOB | Shoots a liquid glob of substance at the creature. Contact syndromes will take effect if the glob hits the target's exposed skin. |
SPATTER_POWDER | Creates a pile of powder at the specified location. |
SPATTER_LIQUID | Creates a pool of liquid at the specified location. |
UNDIRECTED_GAS | Creature occasionally releases a cloud of gas substance. Similar to TRAILING_GAS_FLOW, but undirected, thus affecting a larger area but losing the distance. Creature will attack as normal. |
UNDIRECTED_VAPOR | Creature occasionally releases a cloud of liquid mist. Similar to TRAILING_VAPOR_FLOW, but undirected, thus affecting a larger area but losing the distance. Creature will attack as normal. |
UNDIRECTED_DUST | Creature occasionally releases a cloud of solid dust, which will spread and dissipate. Similar to TRAILING_DUST_FLOW, but undirected, thus affecting a larger area but losing the distance - range is roughly the same as that of a cave-in. Creature will attack as normal. |
UNDIRECTED_ITEM_CLOUD:item token | Creature occasionally releases a "cloud" of items at the target, leaving piles of this item on the floor. The same comments apply as TRAILING_ITEM_FLOW. Creature will attack as normal. |
WEB_SPRAY | Emits a burst of webs that entangle target creatures. |
DRAGONFIRE | Emits a wide cone of dragon fire that burns target creatures at a scorching 50000 °U . For this you want FLOW instead of a material. |
FIREJET | Emits a narrow cone of fire that burns target creatures at 11000 °U . For this you want FLOW instead of a material. |
FIREBALL | Emits a fireball that burns the target creature. For this you want FLOW instead of a material. |
WEATHER_CREEPING_GAS | Creates a cloud of gas that appears at the edge of the map and slowly creeps across the map. Not usable by creatures. |
WEATHER_CREEPING_VAPOR | Creates a cloud of creeping vapor. Not usable by creatures. |
WEATHER_CREEPING_DUST | Creates a cloud of creeping dust. Not usable by creatures. |
WEATHER_FALLING_MATERIAL | Causes it to start raining a particular material. If the material is solid at the outdoor temperatures, it will snow the material instead. Regardless of the nature of the material, being caught in it will give dwarves the bad thought of being 'caught in freakish weather lately'. Not usable by creatures. |
Keep in mind that you can use multiple breath attacks, which appears to make the creature choose between them at random. Creatures cannot use the WEATHER effects, these being reserved for regional interactions.
One major difference between GAS, VAPOR, and DUST is that if the material cannot exist in the specified state at the current temperature, it will automatically be created at a temperature allowing it to exist. So if you create a vapor spray that uses rock or metal as a material, that spray will be created at the material's melting point, setting everything it touches on fire. You can also create a freezing spray by using a custom material that has extremely low melting and/or boiling points.
If you give a creature a material breath attack, be aware that it will be caught in the attack more frequently than its targets. Make sure to make your creatures immune to their own breath weapons!