Modify individual monster spawn rate/cost

I’m trying to make a mod disabling some monster groups and change spawn rate/cost of specific monsters. I got around to blacklist groups as it’s quite straight forward. However I’m not sure how to override default spawn rate of individual monsters. Do I just write the same as inside the monstergroups.json but change to the values I want?

I believe you might be able to kind of clip the code from the options menu for spawn rates. I can’t help you too much but I think you could in theory override the options menu in world gen and change it so you have zombie spawn rate and cat spawn rate and so on so in essence you could control spawn rates and such and maybe you could make a cat apocalypse. Might work I’m not sure as I’m not very good with writing code I can read it though.

1 Like

If you’re trying to edit a specific monstergroup that already exists . . . In your mod folder, create a new JSON. Copy-paste the monster group from the default file.

Add this line

"override": true,

This should replace the existing monstergroup with yours, provided you’re using the mod. Any edits you make should override the default. This was a recent change, but I’m pretty sure that’s the line.

1 Like

Can confirm, that works. Supposedly “edit-mode” : “modify”, works for monstergroups, but I’ve had very mixed results that lead me to believe it does not. Override works best, then you know exactly what you’re gonna end up with.

1 Like

edit-mode modify is no longer necessary. If you create a monstergroup with the same name as an existing group, it will default to modifying.

At least, that’s what I was told when the change first occurred.

1 Like

But what are the rules for modifying? Can you change an existing entry or is it just appending your entries onto the end of the file? It always leads to weird behavior in my experience. And the fact that it is the default makes some weird stuff that was happening make sense.
I dislike the fact that you don’t really know what the list ends up being and you have to track across multiple files. But that could be a personal issue because I’m running every mod I can get my hands on.
I find that using override gives me much more consistent and reliable results, though it could just be my lack of understanding shining through.

Out of curiousity, where did you read this information? Is it in the doc’s somewhere? The only entry I can find for monstergroups in there just explains what the file affects and how to put it together, without going into depth on what is possible.

1 Like

That was the thread. It was a brief discussion.

Basically, when you create an entry with the same name, it throws your additions on to the end of that list (as far as I’m aware). I used an example in that thread, but this is what my addition looks like now.

{
	"type": "monstergroup",
	"name": "GROUP_ZOMBIE",
	"monsters" : [
		{ "monster" : "mon_ravlady", "freq" : 10, "cost_multiplier" : 3 },
		{ "monster" : "mon_zombie_fetus", "freq" : 10, "cost_multiplier" : 2 }
	]
  }

This edits the monster group called GROUP_ZOMBIE and adds those two monsters to that list, as though I had added them directly to the core file. This worked as of about a month ago, though I haven’t fiddled with the mod since then. I don’t see why it wouldn’t still work.

1 Like

Alright, that’s good to know. I’ll have to try again with my monstergroups. IIRC several mods had overrides for groups, so my attempts would have been doubling up the entries for mainline, skewing the whole spawncount. Thanks :smile:

Edit: @themurderunicorn
If you dig a little deeper past the thread into the PR it references, there are actual explanations of syntax and available qualifiers. It’s a shame none of that seems to have made it into the docs.

1 Like

Thank you all for the help. I think I have more than enough information :blush: