How to edit monster groups?


#1

I’m trying to make a mod that edits the monster groups but I can’t get it working.

Lets for example reduce child zombies in schools and add cocroaches instead.

So I add a json file in the mod with the following contents (reduced child freq, added cocroach).

[
{
"type":"monstergroup",
"name": "GROUP_SCHOOL",
"default": "mon_null",
"//": "School monster spawns.",
"monsters": [
  { "monster": "mon_zombie_child", "freq": 50, "cost_multiplier": 1 },
  { "monster": "mon_zombie_fat", "freq": 50, "cost_multiplier": 1 },
  { "monster": "mon_zombie_tough", "freq": 50, "cost_multiplier": 1 },
  { "monster": "mon_zombie", "freq": 150, "cost_multiplier": 1 },
  { "monster": "mon_zombie_anklebiter", "freq": 5, "cost_multiplier": 5 },
  { "monster": "mon_zombie_sproglodyte", "freq": 5, "cost_multiplier": 3 },
  { "monster": "mon_zombie_shriekling", "freq": 5, "cost_multiplier": 5 },
  { "monster": "mon_zombie_creepy", "freq": 5, "cost_multiplier": 3 },
  { "monster": "mon_zombie_snotgobbler", "freq": 5, "cost_multiplier": 3 },
  { "monster": "mon_zombie_waif", "freq": 5, "cost_multiplier": 3 },
  { "monster": "mon_giant_cockroach", "freq": 610, "cost_multiplier": 1 }
  ]
}
]

And nothing changes. I also tried copying the whole monstergroups.json into the mod folder and changing the lines in it to make sure nothign was wrong with the formatting and still nothing changes.

I then just edited the monstergroups.json in its right place and then it works. But that isn’t a mod anymore so that isn’t good enough.

The mod itself works other than the monster group thing. The new item in the mod is visible in game.


#2

If you’re just adding things to an existing monster_group, add the line “edit-mode”: “modify”, to your mod file. If you’re overwriting a monstergroup that already exists, use “edit-mode”: “override”,

IE:

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

In the above example, I’ve used modify to edit the monstergroup called GROUP_ZOMBIE. I’ve added two monsters to that list. I can vouch that this works, but I’ve never used override.


#3

The override is not working for changing the already existing spawns.

Having this in the mod doesn’t add cocroaches to schools and childs still spawn in large numbers (sing modify instead of override doesn’t seem to change it).

[
{
"type":"monstergroup",
"edit-mode": "override",
"name": "GROUP_SCHOOL",
"default": "mon_null",
"//": "School monster spawns.",
"monsters": [
  { "monster": "mon_zombie_child", "freq": 50, "cost_multiplier": 1 },
  { "monster": "mon_zombie_fat", "freq": 50, "cost_multiplier": 1 },
  { "monster": "mon_zombie_tough", "freq": 50, "cost_multiplier": 1 },
  { "monster": "mon_zombie", "freq": 150, "cost_multiplier": 1 },
  { "monster": "mon_zombie_anklebiter", "freq": 5, "cost_multiplier": 5 },
  { "monster": "mon_zombie_sproglodyte", "freq": 5, "cost_multiplier": 3 },
  { "monster": "mon_zombie_shriekling", "freq": 5, "cost_multiplier": 5 },
  { "monster": "mon_zombie_creepy", "freq": 5, "cost_multiplier": 3 },
  { "monster": "mon_zombie_snotgobbler", "freq": 5, "cost_multiplier": 3 },
  { "monster": "mon_zombie_waif", "freq": 5, "cost_multiplier": 3 },
  { "monster": "mon_giant_cockroach", "freq": 610, "cost_multiplier": 1 }
  ]
}
]

But this one adds cocroaches in (also works the same with override instead):

[
{
"type":"monstergroup",
"edit-mode": "modify",
"name": "GROUP_SCHOOL",
"default": "mon_null",
"//": "School monster spawns.",
"monsters": [
  { "monster": "mon_giant_cockroach", "freq": 610, "cost_multiplier": 1 }
  ]
}
]

#4

See https://github.com/CleverRaven/Cataclysm-DDA/pull/24301#issuecomment-406717477


#5

So, I’m a bit confused. I think I get it, but can someone tell me if this is right?

Basically, if I’m modifying a monstergroup, using “edit-mode”: “modify”, still works fine.

However, if I wanted to completely reshape a monstergroup, I should NOT use edit-mode override, but I should add the line : “override”: true,

Is that correct?


#6

You don’t need modify anymore because that is default, but to redo the whole thing you use override.


#7

Using "override": true, did the trick.