# I'm way in over my head

**URL:** <https://discourse.cataclysmdda.org/t/im-way-in-over-my-head/1507>\
**Category:** The Lab\
**Created:** [May 29, 2013, 5:59pm UTC](https://discourse.cataclysmdda.org/t/im-way-in-over-my-head/1507 "2013-05-29T17:59:04Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Skates](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/skates/32/31_2.png) [@Skates](https://discourse.cataclysmdda.org/u/Skates)\
**Post date:** [May 29, 2013, 5:59pm UTC](https://discourse.cataclysmdda.org/t/im-way-in-over-my-head/1507/1 "2013-05-29T17:59:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![GlyphGryph](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/glyphgryph/32/847_2.png) [@GlyphGryph](https://discourse.cataclysmdda.org/u/GlyphGryph)\
**Post date:** [May 29, 2013, 6:08pm UTC](https://discourse.cataclysmdda.org/t/im-way-in-over-my-head/1507/2 "2013-05-29T18:08:59Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/cataclysmdda/original/1X/21b5d044e8473b25d0bf905d60477e25f6fbe0cf.png) [@system](https://discourse.cataclysmdda.org/u/system)\
**Post date:** [May 29, 2013, 8:13pm UTC](https://discourse.cataclysmdda.org/t/im-way-in-over-my-head/1507/3 "2013-05-29T20:13:42Z")

</div>

Hmmm, Json files.

I dislike Json files.

---

<div class="post-metadata">

**Author:** ![wad67](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/wad67/32/7_2.png) [@wad67](https://discourse.cataclysmdda.org/u/wad67)\
**Post date:** [May 30, 2013, 5:33am UTC](https://discourse.cataclysmdda.org/t/im-way-in-over-my-head/1507/4 "2013-05-30T05:33:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![GlyphGryph](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/glyphgryph/32/847_2.png) [@GlyphGryph](https://discourse.cataclysmdda.org/u/GlyphGryph)\
**Post date:** [May 30, 2013, 5:39am UTC](https://discourse.cataclysmdda.org/t/im-way-in-over-my-head/1507/5 "2013-05-30T05:39:39Z")

</div>

You cray cray.

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

---

<div class="post-metadata">

**Author:** ![Soron](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/soron/32/885_2.png) [@Soron](https://discourse.cataclysmdda.org/u/Soron)\
**Post date:** [May 30, 2013, 5:59am UTC](https://discourse.cataclysmdda.org/t/im-way-in-over-my-head/1507/6 "2013-05-30T05:59:03Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![Flare](https://avatars.discourse-cdn.com/v4/letter/f/c0e974/32.png) [@Flare](https://discourse.cataclysmdda.org/u/Flare)\
**Post date:** [May 30, 2013, 9:23am UTC](https://discourse.cataclysmdda.org/t/im-way-in-over-my-head/1507/7 "2013-05-30T09:23:41Z")

</div>

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++](http://notepad-plus-plus.org/download/v6.3.3.html).

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:

```auto
{
    "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
```

---

<div class="post-metadata">

**Author:** ![Skates](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/skates/32/31_2.png) [@Skates](https://discourse.cataclysmdda.org/u/Skates)\
**Post date:** [May 30, 2013, 10:30pm UTC](https://discourse.cataclysmdda.org/t/im-way-in-over-my-head/1507/8 "2013-05-30T22:30:07Z")

</div>

[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.

![](http://i.imgur.com/wxmdoCa.jpg)

{  
“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]

---

<div class="post-metadata">

**Author:** ![Soron](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/soron/32/885_2.png) [@Soron](https://discourse.cataclysmdda.org/u/Soron)\
**Post date:** [May 30, 2013, 11:01pm UTC](https://discourse.cataclysmdda.org/t/im-way-in-over-my-head/1507/9 "2013-05-30T23:01:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Skates](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/skates/32/31_2.png) [@Skates](https://discourse.cataclysmdda.org/u/Skates)\
**Post date:** [May 30, 2013, 11:22pm UTC](https://discourse.cataclysmdda.org/t/im-way-in-over-my-head/1507/10 "2013-05-30T23:22:19Z")

</div>

[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?

---

<div class="post-metadata">

**Author:** ![vultures](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/vultures/32/69_2.png) [@vultures](https://discourse.cataclysmdda.org/u/vultures)\
**Post date:** [May 30, 2013, 11:45pm UTC](https://discourse.cataclysmdda.org/t/im-way-in-over-my-head/1507/11 "2013-05-30T23:45:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![monkey](https://avatars.discourse-cdn.com/v4/letter/m/e79b87/32.png) [@monkey](https://discourse.cataclysmdda.org/u/monkey)\
**Post date:** [May 31, 2013, 1:28pm UTC](https://discourse.cataclysmdda.org/t/im-way-in-over-my-head/1507/12 "2013-05-31T13:28:13Z")

</div>

You can check your jsons with [http://jsonlint.com/](http://jsonlint.com/)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/cataclysmdda/original/1X/21b5d044e8473b25d0bf905d60477e25f6fbe0cf.png) [@system](https://discourse.cataclysmdda.org/u/system)\
**Post date:** [May 31, 2013, 4:28pm UTC](https://discourse.cataclysmdda.org/t/im-way-in-over-my-head/1507/13 "2013-05-31T16:28:32Z")

</div>

So I can modify item values without re-compiling?

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

\*Runs off to start modding on his new PC!

---

<div class="post-metadata">

**Author:** ![Williham](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/williham/32/845_2.png) [@Williham](https://discourse.cataclysmdda.org/u/Williham)\
**Post date:** [June 8, 2013, 11:55pm UTC](https://discourse.cataclysmdda.org/t/im-way-in-over-my-head/1507/14 "2013-06-08T23:55:16Z")

</div>

[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.

---

<div class="post-metadata">

**Author:** ![stone94](https://avatars.discourse-cdn.com/v4/letter/s/f9ae1b/32.png) [@stone94](https://discourse.cataclysmdda.org/u/stone94)\
**Post date:** [July 18, 2013, 8:46pm UTC](https://discourse.cataclysmdda.org/t/im-way-in-over-my-head/1507/15 "2013-07-18T20:46:08Z")

</div>

[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 😃
