How to override default buildings?

I thought that by just the type mapgen, it would override an existing building, but it doesn’t like it. And I don’t manage to find a way to do it by what I get out of the documentation.

Is there a way to override default buildings that I’m failing to find, or there’s not such feature?

I you want to override a special or a normal building, just make a new “overmap_terrain.json” and a new “regional_settings.json” in which the required building does not appear. The new files in the mod will override the default.

So, I know this is over 2 years old, but can someone please explain this in a little more detail? Or is there a mod that does this that I can use as reference? I’m trying to change some of the loot in various locations, and obviously I could just edit the core file, but I’m currently trying to get away from that, so I don’t have to redo everything any time I update to a new nightly.

Same for monster drops… how do you modify those without modifying the core files themselves? The principle seems similar to mapgen, and I don’t really know for sure how to overwrite them in a mod file.

Actually, mapgen and items are handled differently.

You’re looking for editing item groups. So, quick rundown.

Basically, Items exist. Those items are organized into things called itemgroups. You can see itemgroups in your Cataclysm directory/data/json. There’s a folder called itemgroups and a json file called item_groups.

This is how items are organized. Items can exist in multiple itemgroups. The “id” is the name of a given group.

Now when items are spawned in locations, they’re spawned (typically, maybe always?) in that location’s .json file. IE:

"place_loot": [
        { "group": "butcher_meat", "chance": 80, "x": [ 4, 4 ], "y": [ 3, 3 ] },

That’s from the Butcher shop. It will spawn an item from the group butcher_meat at those particular coordinates with a chance of 80 (which I think is just a flat percentage chance to spawn.)

Items spawned on creatures are spawned on their death, following a similar theme. Most creatures have “death_drops” which is basically just an item group that contains all possible objects a creature might drop.

So, if you’re still with me, that’s a very, very broad overview of how items are handled. Now, as of about a month ago, there was no way to override existing itemgroups. IE: You can’t go to that butcher_meat group and overwrite it with new entries. You can, however, add things to that list.

How to create a mod file to edit itemgroups: Ugh. Look at other mods. Create a new folder in your mod directory. Copy/paste modinfo.json from another mod into the new folder. Edit the modinfo file in a text editor and give it its own name, Ident, and author. Create a new .json file in the moddirectory. Edit the .json by copy-pasting itemgroups from the core game files and add things to it. You’ll have to look up item names and things like that.

God, typing it out is super tedious and sounds confusing. If you have questions, create a new thread (this one is about mapgen stuff) and ask them. It’s mostly intuitive but we can talk you through things if you get stuck.

Actually, I’m looking for mapgen stuff, too. I know how item groups work, and how to add things to them, at least. That’s not my issue.

However, I’m looking at, say, the survivor basement mapgen file, and I’m wondering how I could add items to the list of items placed there, or how to edit the amount/probability of an item already placed there, without editing the mapgen file itself, but rather, by including a file in my mod that does so.

As for the monster drops, I can make a new topic, but similarly, what I want to know is not how to change monster drops, but rather, how to change them in a mod file, without altering the core file itself.

I see. Well, for editing monster drops it’s basically as I’ve said. You can add things to the list, but you can’t overwrite an existing itemgroup. You could, however, create a new itemgroup and assign that as the deathdrops for a particular creature, thereby ‘overwriting’ what that creature drops. I haven’t done that, but I don’t see why that wouldn’t work.

Try creating a new .json file in your modfolder, copy/paste the monster entry but change the “death_drops” to your new itemgroup. That’s how PK’s mod does it, I believe.

Anyway, to the mapgen stuff. Sorry about that, I misunderstood what you were asking.

I don’t know how to overwrite or edit a particular building. You could, however, create your own entry and increase the weight. IE: You want to make your own pawnshop. You give it the “pawn” om_terrain, which means it now has a chance to spawn anytime the game wants to spawn a pawnshop. Then, if you increase the “weight” to about 2000000 then it basically guarantees that your brand of pawnshop will spawn above all others.

Obviously that’s not great, but it’s the only way I know how to do it. PK’s mod has locations that it says are overrides, but looking at it, it’s what I’ve just described, there’s no evidence I see that actually ‘overrides’.