Scripts for Modders¶
modtools/*
scripts provide tools for modders, often with changes
to the raw files, and are not intended to be called manually by end-users.
These scripts are mostly useful for raw modders and scripters. They all have
standard arguments: arguments are of the form tool -argName1 argVal1
-argName2 argVal2
. This is equivalent to tool -argName2 argVal2 -argName1
argVal1
. It is not necessary to provide a value to an argument name: tool
-argName3
is fine. Supplying the same argument name multiple times will
result in an error. Argument names are preceded with a dash. The -help
argument will print a descriptive usage string describing the nature of the
arguments. For multiple word argument values, brackets must be used: tool
-argName4 [ sadf1 sadf2 sadf3 ]
. In order to allow passing literal braces as
part of the argument, backslashes are used: tool -argName4 [ \] asdf \foo ]
sets argName4
to \] asdf foo
. The *-trigger
scripts have a similar
policy with backslashes.
Any of these scripts can be called with -help
for more information.
Contents
- Scripts for Modders
- modtools/add-syndrome
- modtools/anonymous-script
- modtools/create-item
- modtools/create-unit
- modtools/equip-item
- modtools/force
- modtools/interaction-trigger
- modtools/invader-item-destroyer
- modtools/item-trigger
- modtools/moddable-gods
- modtools/outside-only
- modtools/projectile-trigger
- modtools/random-trigger
- modtools/raw-lint
- modtools/reaction-product-trigger
- modtools/reaction-trigger
- modtools/reaction-trigger-transition
- modtools/skill-change
- modtools/spawn-flow
- modtools/syndrome-trigger
- modtools/transform-unit
modtools/add-syndrome¶
This allows adding and removing syndromes from units.
modtools/anonymous-script¶
This allows running a short simple Lua script passed as an argument instead of running a script from a file. This is useful when you want to do something too complicated to make with the existing modtools, but too simple to be worth its own script file. Example:
anonymous-script "print(args[1])" arg1 arg2
# prints "arg1"
modtools/create-item¶
Replaces the createitem plugin, with standard arguments. The other versions will be phased out in a later version.
modtools/create-unit¶
Creates a unit. Use modtools/create-unit -help
for more info.
modtools/equip-item¶
Force a unit to equip an item with a particular body part; useful in
conjunction with the create
scripts above. See also forceequip.
modtools/force¶
This tool triggers events like megabeasts, caravans, invaders, and migrants.
modtools/interaction-trigger¶
This triggers events when a unit uses an interaction on another. It works by scanning the announcements for the correct attack verb, so the attack verb must be specified in the interaction. It includes an option to suppress this announcement after it finds it.
modtools/invader-item-destroyer¶
This tool configurably destroys invader items to prevent clutter or to prevent the player from getting tools exclusive to certain races.
modtools/item-trigger¶
This powerful tool triggers DFHack commands when a unit equips, unequips, or attacks another unit with specified item types, specified item materials, or specified item contaminants.
modtools/moddable-gods¶
This is a standardized version of Putnam’s moddableGods script. It allows you to create gods on the command-line.
modtools/outside-only¶
This allows you to specify certain custom buildings as outside only, or inside only. If the player attempts to build a building in an inappropriate location, the building will be destroyed.
modtools/projectile-trigger¶
This triggers dfhack commands when projectiles hit their targets.
modtools/random-trigger¶
This triggers random dfhack commands with specified probabilities. Register a few scripts, then tell it to “go” and it will pick one based on the probability weights you specified. Outcomes are mutually exclusive. To make independent random events, call the script multiple times.
modtools/raw-lint¶
Checks for simple issues with raw files. Can be run automatically.
modtools/reaction-product-trigger¶
This triggers dfhack commands when reaction products are produced, once per product.
modtools/reaction-trigger¶
Triggers dfhack commands when custom reactions complete, regardless of whether
it produced anything, once per completion. Use the -help
command
for more information.
modtools/reaction-trigger-transition¶
Scans raw files and creates a file to help modders transition from autoSyndrome to reaction-trigger.
Prints useful things to the console and a file to help modders transition from autoSyndrome to reaction-trigger. This script is basically an apology for breaking backward compatibiility, and will be removed eventually.
modtools/skill-change¶
Sets or modifies a skill of a unit. Args:
-help: | print the help message |
---|---|
-skill skillName: | |
set the skill that we’re talking about | |
-mode (add/set): | |
are we adding experience/levels or setting them? | |
-granularity (experience/level): | |
direct experience, or experience levels? | |
-unit id: | id of the target unit |
-value amount: | how much to set/add |
modtools/spawn-flow¶
Creates flows at the specified location.
modtools/syndrome-trigger¶
Triggers dfhack commands when syndromes are applied to units.
modtools/transform-unit¶
Transforms a unit into another unit type, possibly permanently. Warning: this will crash arena mode if you view the unit on the same tick that it transforms. If you wait until later, it will be fine.