# JSON'ing item spawns/drops

**URL:** <https://discourse.cataclysmdda.org/t/jsoning-item-spawns-drops/1961>\
**Category:** The Drawing Board\
**Created:** [June 26, 2013, 6:11pm UTC](https://discourse.cataclysmdda.org/t/jsoning-item-spawns-drops/1961 "2013-06-26T18:11:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![CIB](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/cib/32/903_2.png) [@CIB](https://discourse.cataclysmdda.org/u/CIB)\
**Post date:** [June 26, 2013, 6:11pm UTC](https://discourse.cataclysmdda.org/t/jsoning-item-spawns-drops/1961/1 "2013-06-26T18:11:30Z")

</div>

Okay, so first let me explain my poor understanding of how item spawns/drops work:

- There’s a list of “locations” or maybe “item classes”, like living room, bedroom, fridge, science etc. These contain several items.
- Monsters can define several of the “locations” as their drops with probabilities when they die. One class will be picked randomly, and from the class one item will be picked randomly.
- Likewise, the map generator uses these locations to determine what items can spawn on a tile, or what items can spawn in a container(like a fridge)

To JSONify this stuff, first we need to JSONify the locations. After that, we might be able to JSONify the monster drops.

One thing confusing me is that there’s already a data/raw/item\_groups.json. The only difference between these and locations seems to be that they can also define a chance for each item. Was this code meant to replace mapitemsdef.cpp?

---

<div class="post-metadata">

**Author:** ![kevin.granade](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/kevin.granade/32/1316_2.png) [@kevin.granade](https://discourse.cataclysmdda.org/u/kevin.granade)\
**Post date:** [June 26, 2013, 6:15pm UTC](https://discourse.cataclysmdda.org/t/jsoning-item-spawns-drops/1961/2 "2013-06-26T18:15:00Z")

</div>

Yes, I think item\_groups.json is the stub that’s supposed to replace mapitemsdef.cpp, but it hasn’t been finished.

---

<div class="post-metadata">

**Author:** ![i2amroy](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/i2amroy/32/909_2.png) [@i2amroy](https://discourse.cataclysmdda.org/u/i2amroy)\
**Post date:** [June 26, 2013, 6:16pm UTC](https://discourse.cataclysmdda.org/t/jsoning-item-spawns-drops/1961/3 "2013-06-26T18:16:01Z")

</div>

> [@Kevin Granade](#):
>
> Yes, I think item\_groups.json is the stub that’s supposed to replace mapitemsdef.cpp, but it hasn’t been finished.

Pretty much this. GlyphGryph got started on it, but didn’t have time to finish before needing to work on the kickstarter and other things.

---

<div class="post-metadata">

**Author:** ![CIB](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/cib/32/903_2.png) [@CIB](https://discourse.cataclysmdda.org/u/CIB)\
**Post date:** [June 26, 2013, 6:35pm UTC](https://discourse.cataclysmdda.org/t/jsoning-item-spawns-drops/1961/4 "2013-06-26T18:35:52Z")

</div>

Okay, I might work on finishing that then.

---

<div class="post-metadata">

**Author:** ![CIB](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/cib/32/903_2.png) [@CIB](https://discourse.cataclysmdda.org/u/CIB)\
**Post date:** [June 26, 2013, 10:41pm UTC](https://discourse.cataclysmdda.org/t/jsoning-item-spawns-drops/1961/5 "2013-06-26T22:41:03Z")

</div>

Made some progress. [https://github.com/CleverRaven/Cataclysm-DDA/issues/1776](https://github.com/CleverRaven/Cataclysm-DDA/issues/1776)

---

<div class="post-metadata">

**Author:** ![CIB](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/cib/32/903_2.png) [@CIB](https://discourse.cataclysmdda.org/u/CIB)\
**Post date:** [June 26, 2013, 11:24pm UTC](https://discourse.cataclysmdda.org/t/jsoning-item-spawns-drops/1961/6 "2013-06-26T23:24:57Z")

</div>

On a related note, I’ve noticed [http://smf.cataclysmdda.com/index.php?topic=1915.msg23856#msg23856](http://smf.cataclysmdda.com/index.php?topic=1915.msg23856#msg23856) and it seems completely different from the current implementation.
