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.

DF2014 Talk:Creature token

From Dwarf Fortress Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

APPLY_CREATURE_VARIATION versus APPLY_CURRENT_CREATURE_VARIATION

Based on testing, APPLY_CREATURE_VARIATION has instant effect (in reverse order, as noted elsewhere), whereas APPLY_CURRENT_CREATURE_VARIATION is used to manually apply any creature variation tags, such as CV_ADD_TAG or CV_REMOVE_TAG, that have been manually added to the creature definition instead of being defined in a creature variation. In other words, APPLY_CURRENT_CREATURE_VARIATION has no effect if you are simply using APPLY_CREATURE_VARIATION to load creature variations. Think of a creature variation defined in an OBJECT:CREATURE_VARIATION file as a "template", which is applied with APPLY_CREATURE_VARIATION. Think of a "current creature variation" as any manually-defined creature variations that have been added to the creature definition itself, which must be applied to the creature with APPLY_CURRENT_CREATURE_VARIATION after you have made all of the necessary modifications.

For example, the following is a use of APPLY_CREATURE_VARIATION, which takes instantaneous effect without any need for APPLY_CURRENT_CREATURE_VARIATION.:

	[APPLY_CREATURE_VARIATION:REMOVE_STUB_ARMS]

This is an example of the use of APPLY_CURRENT_CREATURE_VARIATION:

	[COPY_TAGS_FROM:MY_CREATURE]
	[CV_REMOVE_TAG:TISSUE_LAYER_UNDER]
	[TISSUE_LAYER_UNDER:BY_CATEGORY:BODY:GAS]
	[TISSUE_LAYER_UNDER:BY_CATEGORY:WING:GAS]
	[APPLY_CURRENT_CREATURE_VARIATION]

--JT (talk) 05:43, 13 August 2014 (UTC)

Littersize Creature Token

I just tested the [LITTERSIZE] token and it still works, just a note for those interested.

[LOCAL_POPS_CONTROLLABLE] and [LOCAL_POPS_PRODUCE_HEROES] prevent trading creature

Specifically this prevents Elves from adding the creature as a trade-able (tame) caged creature to caravans. This is notable as they can currently trade pets that have [CAN_LEARN] and [CAN_SPEAK] enabled. Found this by save scumming an incoming Elven caravan while testing out creature addition and removal from a civilization using populate.rb

[FREQUENCY] affects how often creature appears in trade caravans

I found that by setting [FREQUENCY:5] on a creature that the local Elves could trade, and save scumming an incoming caravan. The rate of the creature appearing in the caravan dropped to 1/40 caravans (not truly 1/20 as it had to compete with roughly 100 other creatures with varying frequency settings). By setting it to [FREQUENCY:100] it now appears in roughly 1/6 caravans. (I'd test it more thoroughly if loading worlds took less time on my PC)

[COPY_TAGS_FROM] does not copy caste tags applied to a creature

Wanted to note this here, as I've seen Giant versions of pack animals without the [PACK_ANIMAL] flag set in creature_raws[creature_index].caste[caste_index].flags.PACK_ANIMAL as viewed through DFHack. As the [PACK_ANIMAL] flag CAN be set on the entire animal, and then pushed onto the male/female/whatever castes. It is still a caste flag, and does not get copied when using [COPY_TAGS_FROM]. Which only appears to copy creature wide tags.

SLOW_LEARNER doesn't apply CAN_LEARN

The SLOW_LEARNER token both sets all skill learn rates for a caste, and sets a special SLOW_LEARNER flag in its caste (which in turn gives the creature itself the HAS_ANY_SLOW_LEARNER flag). It doesn't change the INTELLIGENT_LEARNS flag of a caste (the one set by the CAN_LEARN token that enables the creature to learn). You'll see in troll's raws that CAN_LEARN is added alongside SLOW_LEARNER to make trolls able to learn.

You can make a caste that has the SLOW_LEARNER flag while still having standard skill rates by simply including [SKILL_LEARN_RATES:100] afterwards to override the extra changes to learn rates. I don't know if the system that checks for giving goblins access to creatures like trolls simply checks for the SLOW_LEARNER flag (well, presumably the HAS_ANY_SLOW_LEARNER of the creature), the skill learn rates, or a combination of both, but I'd guess (without testing) that it's likely that they just check for the flag.

This was all tested with some raw modding + digging through structures in DFhack.

Re COPY_TAGS_FROM: “Copies creature tags, but not caste tags”

The table entry for [COPY_TAGS_FROM] currently reads: “Copies creature tags, but not caste tags, from another specified creature.” What is the source of this assertion? Is it accurate?

I notice that animal people with [COPY_TAGS_FROM:BIRD_x] (such as BLUEJAY_MAN) generally end up with “[FEMALE][LAYS_EGGS]” in the computed raws. But by usage, and per the table, [LAYS_EGGS] is a caste tag, and therefore shouldn't be found on the new creature. Is the entry wrong, or have I misunderstood something?

οɼѕаk 20:51, 4 February 2021 (UTC)

Where are you obtaining the "computed raws" from? If it's from DF2014:Bluejay_man/raw, that is generated with the DFRawFunctions extension, which is a reimplementation of DF's logic that could potentially have bugs. —Lethosor (talk) 01:57, 6 February 2021 (UTC)
If DFRawFunctions is how DFHack does it, then yes, that's what I mean by “computed raws.” But I investigated this after finding that a modded-in Bluejay man civilization (using a tweaked version of the original creature) produces offspring during worldgen, but not during gameplay. Pregnancies created via DFHack (using the same process as catsplosion) even count down to zero with birth never occurring. After I added CV_REMOVE_TAG:LAYS_EGGS to the modded Bluejay man creature, births (forced and otherwise) occur as expected. οɼѕаk 16:39, 6 February 2021 (UTC)
To be more specific, this is the line I entered into the dfhack console (with a bluejay man selected):
  • :lua (function () for _,v in pairs(df.creature_raw.find(dfhack.gui.getSelectedUnit().race).raws) do print(v.value) end end)()
    οɼѕаk 16:47, 6 February 2021 (UTC)
Oh, DFHack does not use DFRawFunctions - DFHack is showing you the actual in-game data computed by DF, while DFRawFunctions is only used on the wiki (and is written in PHP, so it couldn't run under DFHack anyway). I didn't realize that the "raws" vector contained the computed raws in-game, but that's good to know! (You don't strictly need the enclosing function, by the way - just :lua for _,v in pairs(df.creature_raw.find(dfhack.gui.getSelectedUnit().race).raws) do print(v.value) end will work.)
From an initial inspection, it looks like COPY_TAGS_FROM is copying caste tags and intended to do so. Other animal men that I checked, including chipmunk man and lizard man, don't specify [MALE] or [FEMALE] for the relevant castes, but they are in the computed raws, as they should be. Note that it's possible that something else I don't understand is adding these tags. I checked APPLY_CREATURE_VARIATION, but I don't think the ANIMAL_PERSON variation is doing anything to the MALE/FEMALE tags.
Short version: could be a mistake in the article, but I'm not really sure. People on the modding forum might have a better idea. —Lethosor (talk) 01:05, 7 February 2021 (UTC)
I'm used to enclosing snippets in anonymous functions just to keep from polluting the global environment. I haven't read the docs or the internals religiously, so I wouldn't be surprised if they do something to keep that from happening anyway. It just helps me sleep at night. οɼѕаk 14:17, 7 February 2021 (UTC)
Well, I haven't used the forums in a long time—I've forgotten my old login and then created a new one so many times—but maybe I'll ask around. Thanks for giving it a look, though. οɼѕаk 14:32, 7 February 2021 (UTC)

Caste token?

Should Caste be linked here as token ? --Jan (talk) 22:41, 1 February 2022 (UTC)

questions about our table syntax

SELECT_MATERIAL Creature Selects a locally defined material. Can be ALL.
SELECT_TISSUE Creature
  • tissue token
Selects a tissue for editing.
  1. Is there any significance to the angular brackets surrounding the 'material token' link?
  2. Any reason why 'tissue token' (or any other token argument we document) should be linked i.e. tissue token?

--Jan (talk) 14:56, 2 February 2022 (UTC)

Please understand; this is just my best guess - if either of these answers are wrong, someone more knowledgeable should be around ASAP for insight or correction.


1. No?
2. For reference, at least. (in the case of the ones already linked, anyway). Silverwing235 (talk) 10:40, 10 February 2022 (UTC)
1. What is the preferred syntax i.e. should we remove them or add them everywhere?
2. Yeah. It was suppose to be "should not" (was in hurry) i.e. why aren't all the entries are linked. Since I realized that we have to two types of token entries one to define new objects (e.g. Tissue definition token) and one to reference them, the later only available for common topics and are linked here.--Jan (talk) 15:08, 10 February 2022 (UTC)

LIGHT_GEN - Possibly does nothing?

See title. Tested on fairies.

Also, it appears that light_gen is only supposed to work on vermin, which probably bears mentioning on the token. This means that giant fireflies should not 'glow in the dark' in adventure mode, despite inheriting the token from fireflies.

Verify: [VERMIN_BITE] and [SPECIALATTACK_INJECT_EXTRACT]

The trouble with these two tokens is illustrated by the fire snake's inability to melt stuff through its vermin bite.

Extensive testing yielded zero deaths from fire snake bites. While amulets made from fire snakes posed infinitely more danger to dwarves, and also notably kobolds.

Spawning giant fire snake creature variants with a [SPECIALATTACK_INJECT_EXTRACT], in place of their vermin bite, will presumably render the desirable effects of the bite interaction.