This is a beta version. Use at your own risk.https://github.com/expwnent/dfhack/blob/create-unit/scripts/teleport.luahttps://github.com/expwnent/dfhack/blob/create-unit/scripts/modtools/create-item.luahttps://github.com/expwnent/dfhack/blob/create-unit/scripts/modtools/create-unit.luahttps://github.com/expwnent/dfhack/blob/create-unit/scripts/modtools/equip-item.luaInstall teleport to hack/scripts and install the rest to hack/scripts/modtools. Overwrite old versions with the new ones.
Please test thoroughly and post results here.
Notes:
1.
Created units are naked. I will make a separate script for managing equipment later. Currently implemented. See modtools/equip-item.lua.
2.
If you try to make a tame hydra in vanilla you're going to have "fun". Tame dogs seem to work fine. I'm not sure whether you're supposed to add tame animals to your civ / group or not. Test it and let me know so I can document it. If you use -flagClear [ resident ] then it should work on megabeasts.
3. Invaders probably won't work properly because that requires creating a new invasion id and a few other things. I'll make a separate script for managing custom invasions later.
4. Once this script has been beta tested I will do my best to maintain backwards compatibility, but I make no promises until then.
5. I wasn't sure what unit flags to set for different circumstances so I let the user manually specify the flags. See
here for the flags you can set. You can also clear flags if DF automatically sets them and you don't want it to.
6.
Units are not named (in any useful way) by this script. Sometimes they're named something like "Dwarf -13568432", which doesn't seem to cause any other problems but it is strange and I'm not sure why it happens. As of version 0.2, use the "-name" argument to give the unit a random civilization-appropriate name. Use "-name MOUNTAIN" for dwarf names, "-name EVIL" for goblin names, etc.
7.
Units may be placed in surprising places. Use the loo(k) mode to control it manually for now. You can specify location with the "-location" argument.
Examples:
modtools/create-unit -race DWARF -caste MALE -civ_id \\LOCAL -group_id \\LOCAL
modtools/create-unit -race DWARF -caste FEMALE -civ_id \\LOCAL -group_id \\LOCAL
modtools/create-unit -race HYDRA -caste FEMALE
modtools/create-unit -race DOG caste FEMALE -civ_id \\LOCAL -group-id \\LOCAL -domesticate
modtools/create-unit -race DWARF -caste MALE -civ_id \\LOCAL -group_id \\LOCAL -flagSet [ had_mood vision_good compute_health ]
modtools/create-unit -race DWARF -caste MALE -civ_id \\LOCAL -group_id \\LOCAL -name