I’ve been spending time learning the ins and outs of modding in cdda with JSON’s, specifically adding custom mutation lines for roleplay purposes. There are a fair amount of lines that can be added to mutations that are documented, but traits and mutations with specific abilities such as Nightvision I don’t understand. Traits that give infrared vision can use the [ INFRARED ] tag to grant that ability, but no such thing exists for other effects that I can tell. I guess specifically I’m wondering how the game sees a trait, such as nightvision or nightvision2, and applies its effect? The same question goes for traits like large, as the trait itself doesnt define an increase in height, and yet it increases height. I know it must be hardcoded into the game itself to recognize these traits, but that question is then can these effects be changed in the scope of a mod? Can i add a new trait that also gives a level of nightvision without having to reuse an existing nightvision trait? Is my monkey brain stuck with existing unique traits and their strengths?
If some trait is hardcoded and you want to do something similar but different in a mod, you basically have two options:
- Rewrite the C++ code support for the trait to add additional parameters in JSON (this is the preferred method)
- Add C++ code support for your new trait that does the thing you want.
But if thing you want to do can’t currently be done in JSON, you’ll need to change the C++ code one way or another.
Ok, thank you, I see I have a lot more learning to do now. I’m looking inside of the cpp’s now to see how things were done. Those cant be patched by a mod though right?
Well, technically you could write a mod that patches the exe file with your changes… and technically this can be done during runtime…
But it can’t be done just with JSON files and the currently implemented mod loader, no.
And if you’re going so far to write a whole system to patch the exe file, you’ll probably be better off to just push your code changes directly to GitHub anyway.
Yeah figures, thanks. I’ll have to live with what I’ve got then i suppose. Not comfortable with messing with the github or anything, but it’s not a huge problem. I might mess with it for fun though.
It’s perfectly acceptable to have C++ code that is only used by a mod. Much of the magic system is dead code unless you’re using the Magiclysm mod, and there’s at least one monster special attack that had to be hard coded but only supports the Dark Skies Above.
 Well, I’m probably going to rewrite it to use JSON parameters at some point, but that’s a lot of work and I wanted to get some widespread testing of the basic logic first.