# The Minor JSON Questions Thread

**URL:** <https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858>\
**Category:** The Toolbox\
**Created:** [November 3, 2016, 1:29am UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858 "2016-11-03T01:29:38Z")\
**Posts on this page:** 20\
**Page:** 3

<div class="post-metadata">

**Author:** ![mGibson](https://avatars.discourse-cdn.com/v4/letter/m/3da27b/32.png) [@mGibson](https://discourse.cataclysmdda.org/u/mGibson)\
**Post date:** [January 31, 2017, 4:12am UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/41 "2017-01-31T04:12:49Z")

</div>

Is it possible to make a fruit jelly that can be sealed in a small jar? It’s strange that the only fruit spread available is in a three-liter jar and can only be found, not made.

Seems easy enough but looking at comestibles.json and recipe\_food.json in Notepad is overwhelming.

This is what I tried for jelly, jam, and preserves:

[spoiler][tt]{  
“type” : “COMESTIBLE”,  
“id” : “jelly\_fruit”,  
“name” : “fruit jelly”,  
“weight” : 250,  
“color” : “red”,  
“spoils\_in” : 240,  
“container” : “jar\_glass”,  
“comestible\_type” : “FOOD”,  
“symbol” : “~”,  
“nutrition” : 10,  
“description” : “A fruity gel made from reducing fruit juice with sugar and straining to remove particles.”,  
“price” : 80,  
“material” : “fruit”,  
“volume” : 1,  
“phase” : “liquid”,  
“charges” : 4,  
“fun” : 10,  
“flags” : [“USE\_EAT\_VERB”]  
}

{  
“type” : “COMESTIBLE”,  
“id” : “jam\_fruit”,  
“name” : “fruit jam”,  
“weight” : 250,  
“color” : “red”,  
“spoils\_in” : 240,  
“container” : “jar\_glass”,  
“comestible\_type” : “FOOD”,  
“symbol” : “~”,  
“nutrition” : 10,  
“description” : “Fresh fruits cooked with sugar to make them last longer.”,  
“price” : 80,  
“material” : “fruit”,  
“volume” : 1,  
“phase” : “liquid”,  
“charges” : 4,  
“fun” : 10,  
“flags” : [“USE\_EAT\_VERB”]  
}

{  
“type” : “COMESTIBLE”,  
“id” : “preserve\_fruit”,  
“name” : “fruit preserves”,  
“weight” : 250,  
“color” : “red”,  
“spoils\_in” : 240,  
“container” : “jar\_glass”,  
“comestible\_type” : “FOOD”,  
“symbol” : “~”,  
“nutrition” : 10,  
“description” : “Chunks of fruit suspended in jelly. Delicious on biscuits.”,  
“price” : 80,  
“material” : “fruit”,  
“volume” : 1,  
“phase” : “liquid”,  
“charges” : 4,  
“fun” : 14,  
“flags” : [“USE\_EAT\_VERB”]  
}[/tt][/spoiler]

And this is my attempt at a recipe for a jar of fruit jelly:

[tt]{  
“type” : “recipe”,  
“result”: “fruit jelly”,  
“id\_suffix” : “jarred”,  
“container”: “jar\_glass\_sealed”,  
“category”: “CC\_FOOD”,  
“subcategory”: “CSC\_FOOD\_DRINKS”,  
“skill\_used”: “cooking”,  
“skills\_required”: [“mechanics”,1],  
“difficulty”: 3,  
“time”: 30000,  
“autolearn”: true,  
“batch\_time\_factors”:[80, 4],  
“qualities”:[  
{“id”:“COOK”,“level”:3}  
], “tools”: [  
[  
[“hotplate”, 2],  
[“char\_smoker”, 2],  
[“toolset”, 2],  
[“fire”, -1]  
],  
[  
[“vac\_sealer”, 10],  
[“makeshift\_sealer”, 20]  
]  
],  
“components”: [  
[  
[“jar\_glass”, 1]  
[“rag”, 1]  
[“juice\_fruit”, 4]],  
[  
[“apple”, 2],  
[“apple\_canned”, 2],  
[“apple\_vac”, 2],  
[“apricot”, 2],  
[“blackberries”, 4],  
[“blueberries”, 4],  
[“cherries”, 4],  
[“cranberries”, 8],  
[“dry\_fruit”, 4],  
[“grapefruit”, 2],  
[“grapes”, 8],  
[“irradiated\_apple”, 2],  
[“irradiated\_apricot”, 2],  
[“irradiated\_blackberries”, 4],  
[“irradiated\_blueberries”, 4],  
[“irradiated\_cherries”, 4],  
[“irradiated\_cranberries”, 8],  
[“irradiated\_grapefruit”, 2],  
[“irradiated\_grapes”, 8],  
[“irradiated\_kiwi”, 2],  
[“irradiated\_lemon”, 2],  
[“irradiated\_mango”, 2],  
[“irradiated\_melon”, 4],  
[“irradiated\_orange”, 2],  
[“irradiated\_papaya”, 2],  
[“irradiated\_peach”, 2],  
[“irradiated\_pear”, 2],  
[“irradiated\_pineapple”, 2],  
[“irradiated\_plums”, 2],  
[“irradiated\_pomegranate”, 2],  
[“irradiated\_raspberries”, 4],  
[“irradiated\_rhubarb”, 4],  
[“irradiated\_strawberries”, 4],  
[“irradiated\_watermelon”, 2],  
[“kiwi”, 2],  
[“lemon”, 2],  
[“mango”, 2],  
[“melon”, 4],  
[“orange”, 2],  
[“papaya”, 2],  
[“peach”, 2],  
[“pear”, 2],  
[“pineapple”, 2],  
[“plums”, 2],  
[“pomegranate”, 2],  
[“raspberries”, 4],  
[“rhubarb”, 4],  
[“strawberries”, 4],  
[“watermelon”, 2]  
],  
[  
[“sugar”, 4]  
],  
[  
[“water”, 6],  
[“water\_clean”, 6]  
]  
]  
}[/tt]

Basically what I want to do is a separate entry for jelly (fruit juice and sugar strained through a rag, no fruit bits) preserves (fruit chunks suspended in jelly) and jam (chopped/crushed fruit and sugar) as well as a way to preserve them in jars. Am I on the right track? If this works, I’d like to try adding more recipes for foods without many recipes like hickory nuts.

---

<div class="post-metadata">

**Author:** ![pisskop](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/pisskop/32/1327_2.png) [@pisskop](https://discourse.cataclysmdda.org/u/pisskop)\
**Post date:** [January 31, 2017, 1:27pm UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/42 "2017-01-31T13:27:48Z")

</div>

i think yoy can either look at the sealed/pickles meat recipes or make a seriee of recipes t make jam.

jam should be 100% possible postapoc but im mobile rn

---

<div class="post-metadata">

**Author:** ![Wyzack](https://avatars.discourse-cdn.com/v4/letter/w/7bcc69/32.png) [@Wyzack](https://discourse.cataclysmdda.org/u/Wyzack)\
**Post date:** [February 13, 2017, 3:23am UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/43 "2017-02-13T03:23:51Z")

</div>

How do i make it so that a profession has an item inside a container on game start? And where is the json for lye powder? I am looking to make a tanner profession for a small mod I am making and want him to have a waterskin or bladder full of lye powder for curing hides

---

<div class="post-metadata">

**Author:** ![pisskop](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/pisskop/32/1327_2.png) [@pisskop](https://discourse.cataclysmdda.org/u/pisskop)\
**Post date:** [February 13, 2017, 4:13pm UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/44 "2017-02-13T16:13:04Z")

</div>

> [@Wyzack](#):
>
> How do i make it so that a profession has an item inside a container on game start? And where is the json for lye powder? I am looking to make a tanner profession for a small mod I am making and want him to have a waterskin or bladder full of lye powder for curing hides

You have to either use or make an item id that has a default container. you can also use the relatively new system of inlaying items into items. examples of ammo/guns/holsters:

```
    ],
    "entries": [
      { "item": "m1911", "ammo-item": "45_jhp", "charges": 7, "contents-item": "brass_catcher", "container-item": "holster" },
      { "item": "45_jhp", "charges": 7, "container-item": "m1911mag" },
      { "item": "45_jhp", "charges": 16 },
      { "item": "ithaca_doom", "ammo-item": "shot_00", "charges": 12, "container-item": "megaarmor_torso_1" },
      { "item": "shot_00", "charges": 8 }

```

]

It should also work with things like batteries or cardboard boxes, but i havent tested it. Look [here](https://github.com/pisskop/PKs_Rebalancing/blob/master/pk_professions.json) at my git for the source of my example.

---

<div class="post-metadata">

**Author:** ![Wyzack](https://avatars.discourse-cdn.com/v4/letter/w/7bcc69/32.png) [@Wyzack](https://discourse.cataclysmdda.org/u/Wyzack)\
**Post date:** [February 13, 2017, 4:43pm UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/45 "2017-02-13T16:43:13Z")

</div>

Thanks a million pisskop. Once upon a time i tried making a doom mod for the game, and gave up once i found out what a chore it would be to modify ranged attacks from the few preexisting defaults. I have to say you did a pretty amazing job

---

<div class="post-metadata">

**Author:** ![Wyzack](https://avatars.discourse-cdn.com/v4/letter/w/7bcc69/32.png) [@Wyzack](https://discourse.cataclysmdda.org/u/Wyzack)\
**Post date:** [February 15, 2017, 3:44pm UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/46 "2017-02-15T15:44:40Z")

</div>

I feel like i am going to end up posting here quite a lot as i continue to work on my shit

I am working on a sort of primitive medical system and want to code a draught or potion that has a decent change of activating an antibiotic effect, but also causes pain and disorientation.

Looking at the code for antibiotics they call on a use\_action called ANTIBIOTIC. Is it possible to make an item call on multiple use\_actions or will i need to make my own use\_action that combines the infection fighting property with the other effects i want? Is it possible to make it only call on use\_action ANTIBIOTIC 75 percent of the time to simulate its unreliable nature?

Also where is the actual code for these use\_action s stored? I found ANTIBIOTIC in item\_actions.json but all it has is a name and an ID with no indications of its actual functions

---

<div class="post-metadata">

**Author:** ![pisskop](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/pisskop/32/1327_2.png) [@pisskop](https://discourse.cataclysmdda.org/u/pisskop)\
**Post date:** [February 15, 2017, 4:04pm UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/47 "2017-02-15T16:04:19Z")

</div>

I think the best you can do is guarantee to cure infection by removing the effect itself with another effect and then add in some guaranteed negatives like disorientation or w.e.

Take an example:

{  
“type”: “effect\_type”,  
“id”: “gauze”,  
“removes\_effects”: [“bite”],  
“base\_mods”: {  
“h\_mod\_min”: [1],  
“h\_mod\_chance”: [200]  
}  
},

From [Here](https://github.com/pisskop/PKs_Rebalancing/blob/master/pk_effects.json)

that will remove the blue bite effect and grant some other bonuses. Make them maluses instead.

Or

{  
“type” : “COMESTIBLE”,  
“id” : “fertilizer\_chelated”,  
“copy-from” :“fungicide”,  
“sub”: “fertilizer\_commercial”,  
“name” : “aquarium fertilizer”,  
“name\_plural” : “aquarium fertilizer”,  
“color” : “ltred”,  
“nutrition”: 4,  
“stim” : -2,  
“healthy” : -2,  
“fun” : -15,  
“charges” : 40,  
“stack\_size” : 50,  
“description” : “Agricultural grade, ionically-treated fertilizer for cleansing minerals from aquariums. Could remove radiation from the body in a pinch.”,  
“price” : 1500,  
“use\_action” : {  
“type” : “consume\_drug”,  
“activation\_message” : “You consume a helping of the %s.”,  
“effects” : [{ “id” : “chelated\_iron”, “duration” : 1200 }, { “id” : “chelated\_iron”, “duration” : 800 }, { “id” : “chelated\_iron”, “duration” : 600 }, { “id” : “rad\_reduce”, “duration” : 1200 }, { “id” : “rad\_reduce”, “duration” : 800 }, { “id” : “rad\_reduce”, “duration” : 600 }],  
“vitamins”: [  
[“iron”, 36, 48]  
]  
},  
“flags”: [“USE\_ON\_NPC”, “NPC\_SAFE”]  
},

From [Here](https://github.com/pisskop/PKs_Rebalancing/blob/master/items/comestible.json)

Where I add multiple effects to an item. This item will reduce the amount of radiation, but then has other effects that make you more likely to vomit.

* * *

the issue with adding multiple hardcoded effects is that the game allows the player to choose with one to activate at any given use. if somebody has a solution or a way to make it a split, random chance Id love to hear it.

---

<div class="post-metadata">

**Author:** ![Wyzack](https://avatars.discourse-cdn.com/v4/letter/w/7bcc69/32.png) [@Wyzack](https://discourse.cataclysmdda.org/u/Wyzack)\
**Post date:** [February 15, 2017, 4:32pm UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/48 "2017-02-15T16:32:21Z")

</div>

Alright i figured there may be issues. I am certainly fine with having it be a guaranteed chance of a cure with a stat penalty.

In the gauze example you posted it has the “removes\_effects” bit which seems easy enough to port. What exactly does the h\_mod\_min and h\_mod\_chance bit do? How would i go about making a similar effect type that removes an effect and also imposes penalties on say strength and dexterity?

EDIT: After looking at the code for stimpacks in that same file i feel i may have figured it out, will attempt and post results

---

<div class="post-metadata">

**Author:** ![pisskop](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/pisskop/32/1327_2.png) [@pisskop](https://discourse.cataclysmdda.org/u/pisskop)\
**Post date:** [February 15, 2017, 4:43pm UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/49 "2017-02-15T16:43:45Z")

</div>

> <https://github.com/CleverRaven/Cataclysm-DDA/blob/master/doc/EFFECTS_JSON.md>

This will explain how the effects system works under the hood

---

<div class="post-metadata">

**Author:** ![Wyzack](https://avatars.discourse-cdn.com/v4/letter/w/7bcc69/32.png) [@Wyzack](https://discourse.cataclysmdda.org/u/Wyzack)\
**Post date:** [February 15, 2017, 4:47pm UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/50 "2017-02-15T16:47:54Z")

</div>

this is amazing, thank you

---

<div class="post-metadata">

**Author:** ![Wyzack](https://avatars.discourse-cdn.com/v4/letter/w/7bcc69/32.png) [@Wyzack](https://discourse.cataclysmdda.org/u/Wyzack)\
**Post date:** [February 15, 2017, 6:03pm UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/51 "2017-02-15T18:03:21Z")

</div>

Last question on this i think, what are the units for “duration”? I want to make the effect last roughly 24 hours but i have no idea what the units are on the number that follows the duration tag

---

<div class="post-metadata">

**Author:** ![pisskop](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/pisskop/32/1327_2.png) [@pisskop](https://discourse.cataclysmdda.org/u/pisskop)\
**Post date:** [February 15, 2017, 6:56pm UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/52 "2017-02-15T18:56:43Z")

</div>

It seems that they are ‘combat turns’.

I.E. each is a point 6 second window.

600 is about an hour, give or take.

One thing I dislike in the code is how vague the units of measurements are, and how they change from context to context.

---

<div class="post-metadata">

**Author:** ![Wyzack](https://avatars.discourse-cdn.com/v4/letter/w/7bcc69/32.png) [@Wyzack](https://discourse.cataclysmdda.org/u/Wyzack)\
**Post date:** [February 15, 2017, 7:04pm UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/53 "2017-02-15T19:04:25Z")

</div>

Okay so, i have coded an effect using your gauze entry as a template, as well as coding a new liquid medicine that calls that effect with use\_action. When i try running the game with the mod active i get an error along the lines of “received unrecognised iuse function”, and if i hit space to continue the game crashes rather than simply exiting to main menu.

Code for the item:

{  
“id” : “tonic”,  
“type” : “COMESTIBLE”,  
“comestible\_type” : “MED”,  
“name” : “health tonic”,  
“name\_plural” : “health tonic”,  
“description” : “A potent and foul smelling concoction of medicinal plants and chemicals. Famed for its fast action and horrific side effects.”,  
“weight” : 48,  
“volume” : 1,  
“price” : 3000,  
“charges” : 5,  
“symbol” : “~”,  
“color” : “green”,  
“phase” : “liquid”,  
“container” : “bottle\_glass”,  
“use\_action” : “tonicuse”,  
“flags” : “NPC\_SAFE”  
}

Code for the effect

{  
“type”: “effect\_type”,  
“id”: “tonicuse”,  
“duration”: [60],  
“apply\_message”: “You are wracked with pain, weakness and nausea as the medicine takes hold.”,  
“remove\_message”: “You recover from the effects of the tonic”,  
“removes\_effects”: [“infected”],  
“base\_mods”: {  
“str\_mod”: [-4],  
“dex\_mod”: [-4],  
“pain\_amount”: [25],  
“vomit\_chance”: [25],  
“vomit\_tick”: [10]  
}  
}

Am i missing a needed flag somewhere or is there another file i need to define to make this work?

---

<div class="post-metadata">

**Author:** ![pisskop](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/pisskop/32/1327_2.png) [@pisskop](https://discourse.cataclysmdda.org/u/pisskop)\
**Post date:** [February 15, 2017, 7:19pm UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/54 "2017-02-15T19:19:07Z")

</div>

I think you need to

add\_effect: tonicuse

not use\_action: tonic use

you defined an effect not a use\_action

---

<div class="post-metadata">

**Author:** ![pisskop](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/pisskop/32/1327_2.png) [@pisskop](https://discourse.cataclysmdda.org/u/pisskop)\
**Post date:** [February 15, 2017, 7:20pm UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/55 "2017-02-15T19:20:42Z")

</div>

```
"use_action" : {
  "type" : "consume_drug",
  "activation_message" : "You consume a helping of the %s.",
  "effects" : [{ "id" : "chelated_iron", "duration" : 1200 }, { "id" : "chelated_iron", "duration" : 800 }, { "id" : "chelated_iron", "duration" : 600 }, { "id" : "rad_reduce", "duration" : 1200 }, { "id" : "rad_reduce", "duration" : 800 }, { "id" : "rad_reduce", "duration" : 600 }],

```

this kind of thing

---

<div class="post-metadata">

**Author:** ![Wyzack](https://avatars.discourse-cdn.com/v4/letter/w/7bcc69/32.png) [@Wyzack](https://discourse.cataclysmdda.org/u/Wyzack)\
**Post date:** [February 15, 2017, 7:23pm UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/56 "2017-02-15T19:23:02Z")

</div>

So i switched the syntax from use\_action to add\_effect. The game compiles and runs properly and without error but when i debug in my tonic and drink some nothing happens. Should i define a use\_action as well using the example below and have tonicuse under “effects” ?

---

<div class="post-metadata">

**Author:** ![pisskop](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/pisskop/32/1327_2.png) [@pisskop](https://discourse.cataclysmdda.org/u/pisskop)\
**Post date:** [February 15, 2017, 7:45pm UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/57 "2017-02-15T19:45:46Z")

</div>

Yes. Its a drug. use the code I have here, delete my effects, and add your own. make sure you specify a duration.

---

<div class="post-metadata">

**Author:** ![Wyzack](https://avatars.discourse-cdn.com/v4/letter/w/7bcc69/32.png) [@Wyzack](https://discourse.cataclysmdda.org/u/Wyzack)\
**Post date:** [February 15, 2017, 8:21pm UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/58 "2017-02-15T20:21:49Z")

</div>

Hahah it worked! Thanks a million!

---

<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:** [February 15, 2017, 9:00pm UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/59 "2017-02-15T21:00:45Z")

</div>

> [@pisskop](#):
>
> One thing I dislike in the code is how vague the units of measurements are, and how they change from context to context.

It’s hard to use a unified system because multiple systems want different granularities.  
It would, however, be possible to have some sort of parsing system that would understand “100 moves”, “100 turns”, “100 seconds”, “100 minutes” etc.

---

<div class="post-metadata">

**Author:** ![hatcher](https://avatars.discourse-cdn.com/v4/letter/h/f14d63/32.png) [@hatcher](https://discourse.cataclysmdda.org/u/hatcher)\
**Post date:** [February 19, 2017, 4:27pm UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/60 "2017-02-19T16:27:13Z")

</div>

Food in cata is EVERYWHERE. You litterally can’t die from starvation even in worst circumstances. I wanna SUFFER from lacking food, but i don’t want to play with 0.1 item spawn rate. So, i wonder, is possible to decrease food spawn without touching other items? Is there’s any way, besides going into every mapgen .json which could contain food and decreasing every chance value?

Readed docs for modding. Hmm. How to force decrease probability of whole food category?

[Previous page](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858.md?page=2)

[Next page](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858.md?page=4)
