During all of this current_soul searching, has anyone happened upon the values required to make a creature into a functioning member of the fort? When I use warmist's spawn-unit script to make an animal, it's fine for hostile ones but unreliable for friendly ones. Giving it the player's civ_id will make it appear "Tame" on the units list (and keep it from attacking) but "Not Tame" on the z/Animals list (which prevents it from being a pet) even if I gm-editor its training level. I recall reading that the creature can revert to hostile when the game is saved and re-loaded, but I haven't witnessed this personally.
Comparing the gm-editor screens for a natural specimen and a spawned specimen hasn't gotten me anywhere, but that's because I'm not familiar with the object model. If someone can point me to the proper attributes and values, I think I can make the Lua code changes necessary.
The immediate use of proper fort membership would be to enable war-training and such for spawned animals, and I have plans for assigning specific creatures as pets of specific dwarves in a later expansion.
And, it doesn't get said nearly often enough that DFHack and the other third-party tools are awesome and invaluable additions to the DF game and community.
Did you give it the civ_id for both unit.civ_id and unit.status.current_soul.civ_id? I was able to turn animals into tame members that appear as tame both in the units screen and the z/animals. Although this was with already existing animals, and not those spawned by the script. (I also changed all of the unit.animal tokens to -1, not sure what effect that actually has though)
I couldn't find a
civ_id attribute under
unit.status.current_soul, but I did find two attributes that fix the is-it-tame-or-not dilemma:
unit.flags1.tame = true
unit.training_level = 7The problem is that for some reason no one in this fort is adopting any pets (natural nor spawned), so I can't be sure this is everything needed. I did notice that my Starting Seven have
unit.flags1.tame = false
unit.training_level = 9Those are the default values that a spawned unit would have. Is there a way to spotcheck a creature for being an intelligent race/caste before I set these flags? It could be hacked by checking if the species matches the player's civ, but that won't be robust to multi-species forts that are just around the corner.
Edit:
Success! New test embark, and this time the spawned critter was adopted right away. Now to see what happens if I bring in a domesticated dwarf.
Edit 2: Okay, the dwarf spawned with no relationships (and thus no religion), which I expected. He doesn't have a dream, so something is unfinished there. The game is fine leaving him with no name, he's listed as Peasant (tame) on the units list, and will take labor assignments. I'm glad he didn't show up on the z/animals list
So, this is not the way to make a well-rounded citizen for your fort, but it'd be unrealistic to expect that. For now, no need to spotcheck for intelligent species since citizen forging is beyond the current version's capabilities anyway.