Mod Incorporating Additions to C++ Source?

I’m currently trying to create a mod that adds further evolutions (upgrades) to existing monsters in the game. As a part of making these additional creatures more difficult than their previous forms, I want to incorporate new monster specials / death functions that buff the challenge of handling them.

For example, I want to give bloated zombies an upgrade to, essentially, a huge bloated zombie – in the same way a boomer becomes a huge boomer. Slightly tougher, greater area of effect with gas on death. The gas death function doesn’t seem to have an argument for size/area, so I’d have to create a new one for the bigger monster.

I dug around mondeath.cpp and monattack.cpp. I’ve managed to code up the .json that inherits the original monster definition and adds the new line for an upgrade to another monster, and it seems to work just fine. The real issue I’ve encountered is that, unless I’ve missed something, there doesn’t seem to be a way to add new specials (the ones found hard-coded in /src) with the basic .json modding process.

What I don’t want to have to do is create a local branch to add these new specials/death functions to the base game via PR, and exclude them by default unless the mod is enabled. This is the only solution I’ve come up with on my own time. I would prefer to have the whole package external to the source.

Any ideas / suggestions / questions / blows over the head pointing out obvious oversights are greatly appreciated.

1 Like

Sadly there’s no way to have C++ additions/changes be nicely tied up into a mod package, and short of PRing a change that moves specials to be defined in the .json, you’ll not be able to create new specials in a mod with only .json.

There’s some good news though, monster attacks specifically can be created in LUA! If you want it to all be an external package, go ahead and check out some of the LUA stuffs chillin’ around for examples, as well as the LUA support source doc.

Why not just add the monster death functions to the source code, and then they’re just dead code if the mod isn’t enabled? That’s how we handle boat parts, for instance: all the support code for boats is in the mainline repo, but the boat parts themselves are in a mod.

1 Like

Good to know!! I’ll definitely see about this.

Mostly just afraid that my code won’t be tidy enough to add to the src. I’m still very much a fledgling at cpp. This is also my first time modding anything, ever. I just am apprehensive about making changes in that way.

I’ll look into using github and make a local branch. If I’m confident enough after enough testing to really pursue pushing this to the master, maybe that will be what happens.

2 Likes

We’re not monsters, and amateur C++ coders submit code all the time. Just give it a try.

1 Like