I'm way in over my head

I got the cool idea of “Hey! Let’s try and mod Cataclysm DDA! It should be easy!” Whoa boy was I wrong. Basically, If anyone here has the patience to point me in the direction of the programs I will need and the BAREST most BASIC information that could help me do something incredibly simple. Let’s say add an item to the game. It’s probably a stupid venture for me to even try but I’d like to see what I can do. Thanks.

I’m fairly sure DDA uses C++ for most of its code. I’ve only ever done Java coding so C++ would be something I’d have to learn.

Adding most items can be done by adding a new entry to the item json files (data/raw/items/), and simply requires restarting the game to see the result. (It doesn’t require compiling)

Hmmm, Json files.

I dislike Json files.

I liked it when the game was harder and more obscure to mod.

You cray cray.

As someone who frequently has to “mod” it I could not be happier. :stuck_out_tongue:

Don’t worry, there’s still plenty of really hard stuff to tinker with if you want to flex your coder muscles. (including a number of things that really should not be hard, but still are because of weird design decisions)

There are 9 item files that contain within them the codes for items. It is in these 9 files that you can edit in order to make a new item.
I recommend notepad++.

They are:
ammo.json
armor.json
books.json
comestibles.json
instruments.json
melee.json
mods.json
ranged.json
tools.json

All of these are located in Cataclysm => data=> raw => items

In these files you’ll find chunks of code that looks like this:

{
    "id": "nailgun",
    "type": "GUN",
    "symbol": "(",
    "color": "light_blue",
    "name": "nail gun",
    "description": "A tool used to drive nails into wood or other material. It could also be used as a ad-hoc weapon, or to practice your handgun skill up to level 1.",
    "rarity": 12,
    "price": 100,
    "material": "IRON",
    "flags": "MODE_BURST",
    "skill": "pistol",
    "ammo": "nail",
    "weight": 22,
    "volume": 4,
    "bashing": 12,
    "cutting": 0,
    "to_hit": 1,
    "ranged_damage": 0,
    "range": 0,
    "accuracy": 20,
    "recoil": 0,
    "durability": 8,
    "burst": 5,
    "clip_size": 100,
    "reload": 450
  },

That is the first entry in range.json.

General points:
-These { } squiggles are the brackets that contain one entry.
-Spacing does not matter at all unless it’s inside a quotation. Json only cares about the sequence of symbols, not the spacing between them, unless it is instructed to notice them with the quotations. For example, “spear and shield” Json will take note of where the spaces are since they are inside the quotations.
Do not forget the commas

The rest should be self explanatory, or at least I found them self explanatory. But in any case I’ll label what I know about the terms.

"id": "nailgun", ID is the one that will be used in the background of the game, IE. administrative purposes like recipes and spawn locations. For the actual name that shows up in the game, look down to the term "name". Spaces are unfriendly since there are quotation marks here. Use underscore _ if you need to use a space.
"type": "GUN",  Generally don't change it if it's in range.json. If you want other functions in other jsons, best to copy an already working template and use the same type term.
"symbol": "(",  The symbol representing it in the game world.
"color": "light_blue", 
"name": "nail gun", The actual in-game name. Don't use this for world gen spawn, and recipes.
"description": "blah",
"rarity": 12,
"price": 100,
"material": "IRON",
"flags": "MODE_BURST",
"skill": "pistol",
"ammo": "nail",
"weight": 22,
"volume": 4,
"bashing": 12,
"cutting": 0,
"to_hit": 1,
"ranged_damage": 0, Range and damage is stacked on top of the ammo's range and damage.
"range": 0, Range and damage is stacked on top of the ammo's range and damage.
"accuracy": 20,   The higher this number is, the more inaccurate it is.
"recoil": 0,
"durability": 8,
"burst": 5,
"clip_size": 100,
"reload": 450

[center]Tried adding a book and now Cataclysm is just a black screen and the game doesn’t load. Off to a good start!

{
“type” : “BOOK”,
“id” : “novel_scifi”,
“name” : “World War Z”,
“max_level” : 0,
“description” : “A book about a ten year long zombie war. Oh the irony.”,
“weight” : 1,
“to_hit” : 1,
“color” : “orange”,
“intelligence” : 0,
“symbol” : “?”,
“material” : [“PAPER”, “NULL”],
“volume” : 1,
“bashing” : -3,
“cutting” : 0,
“time” : 150,
“fun” : 1,
“skill” : “none”,
“rarity” : 20,
“price” : 30,
“required_level” : 0
}
[/center]

[center]EDIT : As a side note I tried adding some clothing before and was yelled at for the price, rarity and encumbrance not being numerical and when I spawned the item in game I noticed all of its numerical values were 0.

{
“type” : “ARMOR”,
“id” : “junk_armor_chest”,
“name” : “junk chest piece”,
“description” : “A crudely built piece of armor that covers the torso.”,
“weight” : 10
"colour" : “green”
“price” : 1000,
“material” : [“IRON”, “NULL”],
“volume” : 8,
“cutting” : 0,
“warmth” : 0,
“phase” : “solid”,
“enviromental_protection” : 0,
“to_hit” : 1,
“power_armor” : false,
“storage” : 0,
“rarity” : 0,
“encumberance” : 2,
“bashing” : 1,
“symbol” : “[”,
},
[/center]

[center]EDIT 2 : I should probably be trying to figure this out myself and kind of get a feel of the SIMPLEST form of debugging their possibly could be but I feel I’ve missed something so stupid. Also thanks to those who posted namely Flare and Gryph.[/center]

As Flare said, “Do not forget the commas”. You forgot the commas in the junk chest piece definition.

As for the book: you’re probably missing the trailing comma after that closing “}”, from the look of it.

[quote=“Soron, post:9, topic:1507”]As Flare said, “Do not forget the commas”. You forgot the commas in the junk chest piece definition.

As for the book: you’re probably missing the trailing comma after that closing “}”, from the look of it.[/quote]

Awesome, that fixed it! Thank you and now onto my next question. I appear to get a syntax error regarding the last character in the .json file. The “]” apparently is causing trouble even though I check it and it appears to be connected to the “]” at the top. Any ideas?

Actually, this topic contains some of the most useful information I’ve read on this board.
A big thanx to the coders and alike (!)

You can check your jsons with http://jsonlint.com/

So I can modify item values without re-compiling?

[size=12pt]Mother of god.[/size]

*Runs off to start modding on his new PC!

[quote=“gtaguy, post:3, topic:1507”]Hmmm, Json files.

I dislike Json files.[/quote]

[quote=“gtaguy, post:13, topic:1507”]So I can modify item values without re-compiling?

[size=12pt]Mother of god.[/size]

*Runs off to start modding on his new PC![/quote]

Well, that escalated quickly.

[quote=“Skates, post:10, topic:1507”][quote=“Soron, post:9, topic:1507”]As Flare said, “Do not forget the commas”. You forgot the commas in the junk chest piece definition.

As for the book: you’re probably missing the trailing comma after that closing “}”, from the look of it.[/quote]

Awesome, that fixed it! Thank you and now onto my next question. I appear to get a syntax error regarding the last character in the .json file. The “]” apparently is causing trouble even though I check it and it appears to be connected to the “]” at the top. Any ideas?[/quote]

for the book, theres already an id named book_scifi so its causing an error, change it to book_scifi2 of something :smiley: