Bay 12 Games Forum
Dwarf Fortress => DF Modding => Topic started by: Jundavr on May 06, 2021, 07:07:17 pm
-
My problem is quite simple: I want to make every creature in the game heterosexual and interested in marriage, so I can couple histfigs naturally. I'm planning to use this to make family forts and other gimmicks like coupling together any "visitors" I receive, from regular mercenaries to invading minotaurs and cyclops, and even animal creatures that I'll use a script to make join my civ. This also should make couples way more frequent in legends mode.
My first solution was to use the fix-ster script every once in a while while running the fort, but I want something permanent. Plus, the script doesn't quite work for arranging marriages as it only modifies the unit's orientations and doesn't change the histfig data.
I learned about the [ORIENTATION] tag, that make creatures generate with the desired orientation, instead of me having to edit them, so I went on to modding the raws.
The way I found to do this was by finding and replacing every single txt in the raws folder:
find "[MALE]"
replace by "[MALE] [ORIENTATION:FEMALE:0:0:100][ORIENTATION:MALE:100:0:0]"
find "[FEMALE]"
replace by "[FEMALE] [ORIENTATION:MALE:0:0:100][ORIENTATION:FEMALE:100:0:0]"
It worked perfectly, but I can't help feeling it was a very inneficient way to go about it. Hence the question: when I want to edit a specific thing about every creature (or a large specific group of them), is there a better way to do it than doing it one at a time, txt per txt?
-
There isn't a better way
This also should make couples way more frequent in legends mode.
I've tested this, actually, theoretically breeding pairs should be ~9% more frequent1 with this change but in practice I couldn't find a statistically significant difference
1first, 100/95, since only 5% of creatures are disinterested in the opposite sex by default; then, 23.75% of creatures being bisexual * 26% of those actually ending up in a homosexual relationship (cause 95% of the opposite-sex partners are interested while only 25% of same-sex ones are, and .25/.95 = 26.3%) * 90% or so who won't cheat on their lover (LUST_PROPENSITY governed) * 50% or so who will never break up or end up with a dead lover comes out to ~2.6%, all of which I ended up fudging up to 4% cause some of those numbers are suspect, though I have them in descending order of confidence here
-
For just the modify text part of the question, if you are on Windows you can use Powershell (or bash if you have windows subsystem for linux installed) to mass edit files. On Mac you can just use bash. The Powershell command would look something like
Get-ChildItem "C:\mypath" -file | %{$path=$_.FullName; (Get-Content $path).Replace('[MALE]', '[MALE][ORIENTATION:FEMALE:0:0:100][ORIENTATION:MALE:100:0:0]') | set-content $path -encoding ASCII }
Note that I have not tested that command, but it should work
-
Eh, I started using NotePad++ and it has a find/replace function that works on all opened documents. So now I just open all the files I want to edit and do the replacing, then use the save all button.
-
You could even give a directory to replace things in. (no need to open)