# JSON, misadventures in Modding and tears. \[please help...\]

**URL:** <https://discourse.cataclysmdda.org/t/json-misadventures-in-modding-and-tears-please-help/13554>\
**Category:** The Toolbox\
**Created:** [March 27, 2017, 8:16pm UTC](https://discourse.cataclysmdda.org/t/json-misadventures-in-modding-and-tears-please-help/13554 "2017-03-27T20:16:19Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wulfle](https://avatars.discourse-cdn.com/v4/letter/w/8491ac/32.png) [@Wulfle](https://discourse.cataclysmdda.org/u/Wulfle)\
**Post date:** [March 27, 2017, 8:16pm UTC](https://discourse.cataclysmdda.org/t/json-misadventures-in-modding-and-tears-please-help/13554/1 "2017-03-27T20:16:19Z")

</div>

I am at the point of tears. I have done everything I can think of, I’ve combed though every line of code ten times but, whatever the problem is, I can’t find it.

Background: I like this game and have been playing it for some years. I’ve watched it from the humble beginnings all the way to now. I also like Warhammer 40,000. So, naturally, I decided to put the two together.

Now, I’m not saying that I’ll be making a mod that encompasses the 40K universe. Right now I just want to make a proof of concept and to see if I like doing this (I probably will because code is a puzzle and i really like puzzles.).

Problem: The console loads fine and every mod loads just great. The compile is fine. When I select my mod and load a world it goes though the DDA files and then stalls when attempting to load the mod. The debugger will not display, however, compounding the problems and exponentially expanding my frustration.

Anyway, I put my code in spoilers so as not to nom the the page. If there’s something I’ve missed, let me know. If there’s a step involved that I’m not getting, refer to the previous line.

gun.json

[  
{  
“id”: “Godwin\_Bolter”,  
“type”: “GUN”,  
“name”: “Godwin Pattern Bolter”,  
“name\_plural” : “Godwin Pattern Bolters”,  
“description”: “A massive handheld rifle that fires rounds the size of beer cans.”,  
“weight”: 20,  
“volume”: 4,  
“price”: 6000000,  
“to\_hit”: -2,  
“bashing”: 14,  
“ranged\_damage” : 3,  
“material”: “steel”,  
“symbol” : “(”  
“color”: “light\_gray”,  
“ammo”: “bolt”,  
“dispersion”: 40,  
“durability”: 10,  
“loudness” : 30,  
“reload” : 180,  
“barrel\_length” : 1,  
“magazines”:[[ “bolt”, [ “BolterSickleMag\_30”, [ BolterSickleMag\_25, [ BolterSickleMag\_20,] ] ] ]  
}  
]

ammo.json

[  
{  
“id”: “bolt”,  
“type”: “AMMO”,  
“name”: “.75 Bolt”,  
“name\_plural”: “.75 Bolts”,  
“description”: “Case of standard Boltgun rounds. A Mass-reactive charge inside the round explodes when hitting a solid mass.”,  
“weight”: 20,  
“volume”: 3,  
“price”: 250000,  
“material”: [“brass”, “powder”, “steel”],  
“symbol”: “=”,  
“color”: “green”,  
“bashing” : 1,  
“cutting” : 0,  
“to\_hit” : 0,  
“ammo\_type”: “bolt”,  
“damage” : 60,  
“pierce” : 10,  
“range” : 24,  
“dispersion” : 30,  
“recoil” : 750,  
“count” : 50,  
“stack\_size”: 35,  
“effects”: [“COOKOFF”, “EXPLOSIVE”, “MUZZLE\_SMOKE”, “SMOKE”, “FRAG”, “FLASHBANG”]

}  
]

magazine.json

[  
{  
“id”: “BoltPistolMag\_9”,  
“type”: “MAGAZINE”,  
“name”: “Bolt Pistol Magazine”,  
“description”: “A 9-round magazine for a Bolt Pistol.”,  
“Weight”: 100,  
“Volume”: 2,  
“Price”: 10000,  
“material” : “steel”,  
“symbol” : “#”  
“color” : “light\_gray”,  
“ammo\_type”: “bolt”,  
“capacity”: 9  
"reliability" : 10  
"reload\_time" : 120  
},  
{  
“id”: “BolterSickleMag\_20”,  
“type”: “MAGAZINE”,  
“name”: “20-Round Bolter MAGAZINE”,  
“description”: “A 20 round sickle magazine for the holy Bolter.”,  
“Volume”: 2,  
“Price”: 10000,  
“material” : “steel”,  
“symbol” : “#”  
“color” : “light\_gray”,  
“capacity” : 20,  
“weight”: 160,  
“ammo\_type”: “bolt”  
“reliability” : 10  
"reload\_time" : 200   
},  
{  
“id”: “BolterSickleMag\_25”,  
“type”: “MAGAZINE”,  
“name”: “25-Round Bolter MAGAZINE”,  
“description”: “A 25 round sickle magazine for the holy Bolter.”,  
“Volume”: 2,  
“Price”: 10000,  
“material” : “steel”,  
“symbol” : “#”  
“color” : “light\_gray”,  
“capacity” : 25,  
“weight”: 180,  
“ammo\_type”: “bolt”  
“reliability” : 10  
"reload\_time" : 250  
},  
{  
“id”: “BolterSickleMag\_30”,  
“type”: “MAGAZINE”,  
“name”: “30-Round Bolter MAGAZINE”,  
“description”: “A 30 round sickle magazine for the holy Bolter.”,  
“weight”: 200,  
“Volume”: 2,  
“Price”: 10000,  
“material” : “steel”,  
“symbol” : “#”  
“color” : “light\_gray”,  
“capacity” : 30,  
“ammo\_type”: “bolt”  
“reliability” : 10  
"reload\_time" : 280

```
}

```

]

ammo\_types.json

[  
{  
“id”: “bolt”,  
“name”: “.75mm Bolt”,  
“default”: “bolt”,  
“type”: “ammunition\_type”  
}  
]

---

<div class="post-metadata">

**Author:** ![Coolthulhu](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/coolthulhu/32/2446_2.png) [@Coolthulhu](https://discourse.cataclysmdda.org/u/Coolthulhu)\
**Post date:** [March 27, 2017, 8:51pm UTC](https://discourse.cataclysmdda.org/t/json-misadventures-in-modding-and-tears-please-help/13554/2 "2017-03-27T20:51:53Z")

</div>

What is the problem here?  
I mean, some error that prevents loading, items not working or what?

---

<div class="post-metadata">

**Author:** ![Wulfle](https://avatars.discourse-cdn.com/v4/letter/w/8491ac/32.png) [@Wulfle](https://discourse.cataclysmdda.org/u/Wulfle)\
**Post date:** [March 27, 2017, 9:15pm UTC](https://discourse.cataclysmdda.org/t/json-misadventures-in-modding-and-tears-please-help/13554/3 "2017-03-27T21:15:24Z")

</div>

[quote=“Coolthulhu, post:2, topic:13554”]What is the problem here?  
I mean, some error that prevents loading, items not working or what?[/quote]  
(Coolthulu replied to my post! Alright, don’t freak out.)  
“Hi.” (Crap…)

Sorry. Fixed it in the main description.

Anyway, the main problem is that I don’t know. The debugger isn’t displaying anything at all.

There’s clearly an error, however because I push “I” when it’s stalled at my mod when loading the world and boots me to the main menu.

---

<div class="post-metadata">

**Author:** ![StopSignal](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/stopsignal/32/1923_2.png) [@StopSignal](https://discourse.cataclysmdda.org/u/StopSignal)\
**Post date:** [March 27, 2017, 9:21pm UTC](https://discourse.cataclysmdda.org/t/json-misadventures-in-modding-and-tears-please-help/13554/4 "2017-03-27T21:21:40Z")

</div>

Have you turned off debug mode?

---

<div class="post-metadata">

**Author:** ![Wulfle](https://avatars.discourse-cdn.com/v4/letter/w/8491ac/32.png) [@Wulfle](https://discourse.cataclysmdda.org/u/Wulfle)\
**Post date:** [March 27, 2017, 9:22pm UTC](https://discourse.cataclysmdda.org/t/json-misadventures-in-modding-and-tears-please-help/13554/5 "2017-03-27T21:22:56Z")

</div>

> [@StopSignal](#):
>
> Have you turned off debug mode?

It’s a fresh compile. Should I turn it on?

That was a stupid question. I’ll turn it on and report back on what it says.

---

<div class="post-metadata">

**Author:** ![Wulfle](https://avatars.discourse-cdn.com/v4/letter/w/8491ac/32.png) [@Wulfle](https://discourse.cataclysmdda.org/u/Wulfle)\
**Post date:** [March 27, 2017, 9:30pm UTC](https://discourse.cataclysmdda.org/t/json-misadventures-in-modding-and-tears-please-help/13554/6 "2017-03-27T21:30:04Z")

</div>

Right well, no debug messages show in console or in Code::Blocks. All it does is stall and refuse to load when it gets to “Please wait while the world data loads… Loading content (40K)”

Edit: Just ran it though the CB debugger again and it threw this error.

In \_\_cxa\_throw () ()  
#1 0x007adc38 in JsonIn::error (this=this@entry=0x13f6886c, message=…, offset=1) at C:\Users[b]REDACTED[/b]\Downloads\CataDDAGit\src\json.cpp:1513  
C:\Users[b]REDACTED[/b]\Downloads\CataDDAGit\src\json.cpp:1513:33711:beg:0x7adc38  
At C:\Users[b]REDACTED[/b]\Downloads\CataDDAGit\src\json.cpp:1513

---

<div class="post-metadata">

**Author:** ![Zhilkin](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/zhilkin/32/3749_2.png) [@Zhilkin](https://discourse.cataclysmdda.org/u/Zhilkin)\
**Post date:** [March 27, 2017, 9:39pm UTC](https://discourse.cataclysmdda.org/t/json-misadventures-in-modding-and-tears-please-help/13554/7 "2017-03-27T21:39:59Z")

</div>

You have invalid content in gun.json:

“magazines”:[[ “bolt”, [ “BolterSickleMag\_30”, [ BolterSickleMag\_25, [ BolterSickleMag\_20,] ] ] ]

Should be probably like this:

“magazines”:[[ “bolt”, [ “BolterSickleMag\_30”, “BolterSickleMag\_25”, “BolterSickleMag\_20”] ] ]

* * *

Also multiple commas are missing which makes json syntax bad.

---

<div class="post-metadata">

**Author:** ![Wulfle](https://avatars.discourse-cdn.com/v4/letter/w/8491ac/32.png) [@Wulfle](https://discourse.cataclysmdda.org/u/Wulfle)\
**Post date:** [March 27, 2017, 9:45pm UTC](https://discourse.cataclysmdda.org/t/json-misadventures-in-modding-and-tears-please-help/13554/8 "2017-03-27T21:45:25Z")

</div>

[quote=“Zhilkin, post:7, topic:13554”]You have invalid content in gun.json:

“magazines”:[[ “bolt”, [ “BolterSickleMag\_30”, [ BolterSickleMag\_25, [ BolterSickleMag\_20,] ] ] ]

Should be probably like this:

“magazines”:[[ “bolt”, [ “BolterSickleMag\_30”, “BolterSickleMag\_25”, “BolterSickleMag\_20”] ] ][/quote]

This has taught me a valuable lesson; Always read the code one more time.

I’m compiling now and then we’ll see if that fixes it. Honestly, thank you so much. I never expected this much help or support! I’ll be back when CB is done munching and let you know.

---

<div class="post-metadata">

**Author:** ![Zhilkin](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/zhilkin/32/3749_2.png) [@Zhilkin](https://discourse.cataclysmdda.org/u/Zhilkin)\
**Post date:** [March 27, 2017, 9:50pm UTC](https://discourse.cataclysmdda.org/t/json-misadventures-in-modding-and-tears-please-help/13554/9 "2017-03-27T21:50:34Z")

</div>

You don’t need to recompile, just put updated json to game folder.

---

<div class="post-metadata">

**Author:** ![Wulfle](https://avatars.discourse-cdn.com/v4/letter/w/8491ac/32.png) [@Wulfle](https://discourse.cataclysmdda.org/u/Wulfle)\
**Post date:** [March 27, 2017, 9:56pm UTC](https://discourse.cataclysmdda.org/t/json-misadventures-in-modding-and-tears-please-help/13554/10 "2017-03-27T21:56:37Z")

</div>

> [@Zhilkin](#):
>
> You don’t need to recompile, just put updated json to game folder.

It threw this error in the debugger.

[http://imgur.com/a/AcBN2](http://imgur.com/a/AcBN2)

---

<div class="post-metadata">

**Author:** ![Zhilkin](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/zhilkin/32/3749_2.png) [@Zhilkin](https://discourse.cataclysmdda.org/u/Zhilkin)\
**Post date:** [March 27, 2017, 10:03pm UTC](https://discourse.cataclysmdda.org/t/json-misadventures-in-modding-and-tears-please-help/13554/11 "2017-03-27T22:03:02Z")

</div>

No, you don’t need to recompile - JSON is not compiled. It is read and interpreted by the game. Restarting/reloading the game is usually enough to apply changes to JSON. Here are updated files packed into mod: [https://www.dropbox.com/s/0cvisdci7m3wm7c/WH40KGuns.zip?dl=0](https://www.dropbox.com/s/0cvisdci7m3wm7c/WH40KGuns.zip?dl=0). Just unzip it into mod folder and add mod to world settings.

The gun works, but it only can be spawned via debug menu, so you will need to add or update some item groups to have gun, magazines and ammo spawn somewhere.

The explosion is rather big, though it could be okay for WH40K.

---

<div class="post-metadata">

**Author:** ![Wulfle](https://avatars.discourse-cdn.com/v4/letter/w/8491ac/32.png) [@Wulfle](https://discourse.cataclysmdda.org/u/Wulfle)\
**Post date:** [March 27, 2017, 10:09pm UTC](https://discourse.cataclysmdda.org/t/json-misadventures-in-modding-and-tears-please-help/13554/12 "2017-03-27T22:09:40Z")

</div>

[quote=“Zhilkin, post:11, topic:13554”]No, you don’t need to recompile - JSON is not compiled. It is read and interpreted by the game. Restarting/reloading the game is usually enough to apply changes to JSON. Here are updated files packed into mod: [https://www.dropbox.com/s/0cvisdci7m3wm7c/WH40KGuns.zip?dl=0](https://www.dropbox.com/s/0cvisdci7m3wm7c/WH40KGuns.zip?dl=0). Just unzip it into mod folder and add mod to world settings.

The gun works, but it only can be spawned via debug menu, so you will need to add or update some item groups to have gun, magazines and ammo spawn somewhere.

The explosion is rather big, though it could be okay for WH40K.[/quote]

How the hell did you get that to work? I must learn from the strange codeamancy that you practice.

Seriously, what was I missing?

---

<div class="post-metadata">

**Author:** ![Zhilkin](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/zhilkin/32/3749_2.png) [@Zhilkin](https://discourse.cataclysmdda.org/u/Zhilkin)\
**Post date:** [March 27, 2017, 10:42pm UTC](https://discourse.cataclysmdda.org/t/json-misadventures-in-modding-and-tears-please-help/13554/13 "2017-03-27T22:42:24Z")

</div>

Json syntax was incorrect: missing commas, missing parenthesis, missing quotation marks.

You can compare files in some text compare tool to see what was changed.

---

<div class="post-metadata">

**Author:** ![Coolthulhu](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/coolthulhu/32/2446_2.png) [@Coolthulhu](https://discourse.cataclysmdda.org/u/Coolthulhu)\
**Post date:** [March 27, 2017, 10:52pm UTC](https://discourse.cataclysmdda.org/t/json-misadventures-in-modding-and-tears-please-help/13554/14 "2017-03-27T22:52:55Z")

</div>

> [@Wulfle](#):
>
> Anyway, the main problem is that I don’t know. The debugger isn’t displaying anything at all.

If you’re only changing jsons (and not sources), test it on a downloaded tiles build.  
The windows curses build has some known problems, such as not displaying the errors and not going fast (less than half the FPS).

---

<div class="post-metadata">

**Author:** ![Wulfle](https://avatars.discourse-cdn.com/v4/letter/w/8491ac/32.png) [@Wulfle](https://discourse.cataclysmdda.org/u/Wulfle)\
**Post date:** [March 27, 2017, 10:56pm UTC](https://discourse.cataclysmdda.org/t/json-misadventures-in-modding-and-tears-please-help/13554/15 "2017-03-27T22:56:34Z")

</div>

[quote=“Zhilkin, post:13, topic:13554”]Json syntax was incorrect: missing commas, missing parenthesis, missing quotation marks.

You can compare files in some text compare tool to see what was changed.[/quote]

Thank you, thank you, thank you! you’ve made me so much more confident in doing JSON now! [quote=“Coolthulhu, post:14, topic:13554”][quote=“Wulfle, post:3, topic:13554”]Anyway, the main problem is that I don’t know. The debugger isn’t displaying anything at all.[/quote]

If you’re only changing jsons (and not sources), test it on a downloaded tiles build.  
The windows curses build has some known problems, such as not displaying the errors and not going fast (less than half the FPS).[/quote]

Thank you both so much! This has made me so much more eager to do this now! I can’t wait to start on other weapons, rounds and factions. I’m very exited now. The support and help that I’ve received here has only made me love this game even more.

---

<div class="post-metadata">

**Author:** ![Zhilkin](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/zhilkin/32/3749_2.png) [@Zhilkin](https://discourse.cataclysmdda.org/u/Zhilkin)\
**Post date:** [March 27, 2017, 11:07pm UTC](https://discourse.cataclysmdda.org/t/json-misadventures-in-modding-and-tears-please-help/13554/16 "2017-03-27T23:07:09Z")

</div>

Don’t be so excited - I’ve heard factions are broken. 🙂

---

<div class="post-metadata">

**Author:** ![Wulfle](https://avatars.discourse-cdn.com/v4/letter/w/8491ac/32.png) [@Wulfle](https://discourse.cataclysmdda.org/u/Wulfle)\
**Post date:** [March 27, 2017, 11:54pm UTC](https://discourse.cataclysmdda.org/t/json-misadventures-in-modding-and-tears-please-help/13554/17 "2017-03-27T23:54:20Z")

</div>

> [@Zhilkin](#):
>
> Don’t be so excited - I’ve heard factions are broken. 🙂

Yeah but I think that nids would add to the experance. Not Chaos Marines or Eldar or anything like that yet but a few bolters, a chainsword, some diffrent types of rounds and Power Armor. If I can get that, I’ll work on balance. After that, I’ll add more stuff. Maybe Sorotas or Imperial Guard things. Then the cycle of add-ballance will begin again.

Also, yeah, the explosion is WAY to big. I removed the explosion flag and am just using the frag now.

---

<div class="post-metadata">

**Author:** ![BorkBorkGoesTheCode](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/borkborkgoesthecode/32/2343_2.png) [@BorkBorkGoesTheCode](https://discourse.cataclysmdda.org/u/BorkBorkGoesTheCode)\
**Post date:** [March 28, 2017, 12:41am UTC](https://discourse.cataclysmdda.org/t/json-misadventures-in-modding-and-tears-please-help/13554/18 "2017-03-28T00:41:11Z")

</div>

You can create custom explosions.

---

<div class="post-metadata">

**Author:** ![StopSignal](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/stopsignal/32/1923_2.png) [@StopSignal](https://discourse.cataclysmdda.org/u/StopSignal)\
**Post date:** [March 28, 2017, 1:54am UTC](https://discourse.cataclysmdda.org/t/json-misadventures-in-modding-and-tears-please-help/13554/19 "2017-03-28T01:54:33Z")

</div>

After coming from programming class, seeing how eager you are makes me inspired. Head on, pal!

---

<div class="post-metadata">

**Author:** ![Wulfle](https://avatars.discourse-cdn.com/v4/letter/w/8491ac/32.png) [@Wulfle](https://discourse.cataclysmdda.org/u/Wulfle)\
**Post date:** [March 28, 2017, 3:34am UTC](https://discourse.cataclysmdda.org/t/json-misadventures-in-modding-and-tears-please-help/13554/20 "2017-03-28T03:34:54Z")

</div>

> [@BorkBorkGoesTheCode](#):
>
> You can create custom explosions.

I dunno haow…! _cries_

> [@StopSignal](#):
>
> After coming from programming class, seeing how eager you are makes me inspired. Head on, pal!

I’m rather self-taught. I started learning on RUBY and did a bit of Python and Java as well as some rudimentary C and C# but nothing really noteworthy. I’m glad that I inspired you!

[Next page](https://discourse.cataclysmdda.org/t/json-misadventures-in-modding-and-tears-please-help/13554.md?page=2)
