# 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:** 4

<div class="post-metadata">

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

</div>

Is there a way to stop getting “There are too many overmap specials” when playing with both PK’s and Cata++ by editing a file somewhere? I vaugely remember a solution someone offered to “too many overmap specials” that involved that.

---

<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 20, 2017, 2:41am UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/62 "2017-02-20T02:41:42Z")

</div>

> [@hatcher](#):
>
> Is there’s any way, besides going into every mapgen .json which could contain food and decreasing every chance value?

I think there is a way to do it with a complex lua script.  
You’d have to have it access every item group, find food items, decrease their probabilities and pad the resulting group with “none”.  
That wouldn’t be easy, though.

> [@Taberone](#):
>
> Is there a way to stop getting “There are too many overmap specials” when playing with both PK’s and Cata++ by editing a file somewhere? I vaugely remember a solution someone offered to “too many overmap specials” that involved that.

You need to find the file where specials are declared and decrease the mandatory occurrences. You can brute force text search the mod directories for “occurrences” - the files with strings like

> "occurrences" : [0, 10],

 are the relevant ones. First number is mandatory occurrences - this is the one you want to change. Lowering the second one can help with more varied worlds, but isn't mandatory.

---

<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 20, 2017, 12:21pm UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/63 "2017-02-20T12:21:26Z")

</div>

[quote=“Coolthulhu, post:62, topic:12858”]I think there is a way to do it with a complex lua script.  
You’d have to have it access every item group, find food items, decrease their probabilities and pad the resulting group with “none”.  
That wouldn’t be easy, though.[/quote]

Welp, im completelly newbie in LUA, i could just stole somewhat code and modify it, but not write it by myself. And also, i don’t know, where to find all those beautiful functions.  
In the samples there’s good, imo, base:

[code]local milk = game.get\_comestible\_type(“milk”)

milk.volume = milk.volume / 2[/code]

I think, if change comestible\_type for category\_food and somehow decrease probability by modificator that will work. But i’ve no idea what it should be, coz i don’t know these functions, which game is using.  
I dunno, ` game.get_category("food")`  
or

`game.get_item_category("food")
food.probability = food.probability / 10`?

Don’t laugh hard pls, its just a guess by a fool.

---

<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 20, 2017, 3:31pm UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/64 "2017-02-20T15:31:57Z")

</div>

> [@hatcher](#):
>
> Welp, im completelly newbie in LUA, i could just stole somewhat code and modify it, but not write it by myself. And also, i don’t know, where to find all those beautiful functions.

In the source distribution on git, there are directories with sample lua mods and there is class\_definitions.lua which has all the usable functions.

But no, probability is not a field of item because each item can have multiple different probabilities.  
That’s the whole problem: you have to access the item groups (not sure if it can be done right now, but if someone really cared we could open them up to lua), go through all of the item groups, find item IDs that represent items which are food, decrease probabilities there and then pad the remaining item group properly (padding is not necessary, just makes it work better).  
Item groups are nested, but you wouldn’t want to recurse, just go through all of them “flat”.

---

<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 20, 2017, 4:05pm UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/65 "2017-02-20T16:05:06Z")

</div>

[quote=“Coolthulhu, post:64, topic:12858”]But no, probability is not a field of item because each item can have multiple different probabilities.  
That’s the whole problem: you have to access the item groups (not sure if it can be done right now, but if someone really cared we could open them up to lua), go through all of the item groups, find item IDs that represent items which are food, decrease probabilities there and then pad the remaining item group properly (padding is not necessary, just makes it work better).  
Item groups are nested, but you wouldn’t want to recurse, just go through all of them “flat”.[/quote]

Sounds very complicated for me. Btw, I found this:

```auto

```

But if probability can not be decreased while loot spawn for whole item category and your solution is the most simple, then better just go through every mapgen json and decrease probability there, really.  
Item groups with food very often contains other stuff which must be not affected. Example under the spoiler.  
P.S. `"repeat": [1, 3] ` – 1, 3 means from 1 to 3 spawn cycles am i right?

[Spoiler]

```
"type" : "item_group",
"id" : "livingroom",
"items":[
  ["rootbeer", 65],
  ["mag_computer", 35],
  ["purple_drink", 35],
  ["creamsoda", 35],
  ["lemonlime", 35],
  ["orangesoda", 20],
  ["crispycran", 20],
  ["colamdew", 35],
  ["television", 30],
  ["clock", 10],
  ["cola", 70],
  ["choc_drink", 10],
  ["cig", 90],
  ["chaw", 20],
  ["cigar", 5],
  ["ecig", 10],
  ["advanced_ecig", 8],
  ["nicotine_liquid", 8],
  ["pipe_tobacco", 5],
  ["tobacco", 5],
  ["weed", 10],
  ["joint", 10],
  ["seed_weed", 5],
  ["rolling_paper", 5],
  ["mask_hockey", 5],
  ["mask_guy_fawkes", 5],
  ["hockey_stick", 10],
  ["news_regional", 4],
  ["many_years_old_newspaper", 2],
  ["years_old_newspaper", 2],
  ["one_year_old_newspaper", 3],
  ["months_old_newspaper", 4],
  ["weeks_old_newspaper", 5],
  ["newest_newspaper", 8],
  ["mag_bashing", 10],
  ["mag_cutting", 10],
  ["mag_stabbing", 5],
  ["child_book", 50],
  ["tall_tales", 10],
  ["story_book", 4],
  ["novel_pulp", 16],
  ["fairy_tales", 10],
  ["mag_unarmed", 10],
  ["tailor_portfolio", 1],
  ["trappers_companion", 1],
  ["puck", 5],
  ["baseball", 5],
  ["football", 5],
  ["golf_club", 10],
  ["jersey", 10],
  ["fan", 10],
  ["pipe_glass", 5],
  ["coke", 8],
  ["meth", 2],
  ["sneakers", 80],
  ["boots", 70],
  ["knee_high_boots", 10],
  ["boots_combat", 10],
  ["boots_winter", 60],
  ["boots_hiking", 10],
  ["runner_bag", 5],
  ["flip_flops", 35],
  ["lowtops", 45],
  ["dress_shoes", 50],
  ["dance_shoes", 5],
  ["heels", 50],
  ["coat_rain", 50],
  ["hood_rain", 20],
  ["jacket_windbreaker", 25],
  ["wetsuit", 2],
  ["wetsuit_spring", 2],
  ["wetsuit_gloves", 3],
  ["wetsuit_booties", 3],
  ["wetsuit_hood", 2],
  ["dive_bag", 3],
  ["poncho", 15],
  ["folding_poncho", 5],
  ["gloves_light", 35],
  ["mittens", 30],
  ["armguard_soft", 40],
  ["armguard_hard", 20],
  ["legguard_hard", 15],
  ["gloves_wool", 33],
  ["thermal_socks", 2],
  ["thermal_gloves", 2],
  ["thermal_suit", 2],
  ["thermal_mask", 2],
  ["thermal_outfit", 1],
  ["gloves_winter", 40],
  ["gloves_liner", 25],
  ["gloves_leather", 45],
  ["gloves_fingerless", 20],
  ["gloves_work", 2],
  ["bandana", 35],
  ["scarf", 45],
  ["knit_scarf", 35],
  ["long_knit_scarf", 5],
  ["scarf_long", 2],
  ["hairpin", 5],
  ["fc_hairpin", 1],
  ["barrette", 3],
  ["hat_cotton", 45],
  ["hat_knit", 25],
  ["hat_fur", 15],
  ["hat_newsboy", 20],
  ["hat_sombrero", 3],
  ["helmet_bike", 35],
  ["helmet_motor", 40],
  ["touring_suit", 15],
  ["briefcase", 2],
  ["mag_tv", 40],
  ["mag_dude", 40],
  ["mag_glam", 40],
  ["mag_beauty", 30],
  ["mag_news", 35],
  ["lighter", 60],
  ["ref_lighter", 2],
  ["matches", 60],
  ["extinguisher", 20],
  ["sm_extinguisher", 10],
  ["mp3", 18],
  ["portable_game", 8],
  ["game_watch", 2],
  ["usb_drive", 5],
  ["beer", 35],
  ["european_pilsner", 25],
  ["pale_ale", 25],
  ["india_pale_ale", 25],
  ["stout", 15],
  ["belgian_ale", 10],
  ["imperial_stout", 4],
  ["cell_phone", 50],
  ["wristwatch", 15],
  ["pocketwatch", 5],
  ["umbrella", 50],
  ["teleumbrella", 20],
  ["fish_bowl", 1],
  ["lsd", 1],
  ["laptop", 10],
  ["file", 5],
  ["eink_tablet_pc", 2],
  ["mobile_memory_card", 8],
  ["camera", 3],
  ["gum", 30],
  ["caff_gum", 3],
  ["flask_hip", 5],
  ["sm_extinguisher", 10],
  ["atomic_light", 1],
  ["atomic_lamp", 1],
  ["dog_whistle", 5],
  ["pet_carrier",2],
  ["dogfood", 10],
```

---

<div class="post-metadata">

**Author:** ![Taberone](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/taberone/32/515_2.png) [@Taberone](https://discourse.cataclysmdda.org/u/Taberone)\
**Post date:** [February 21, 2017, 3:40am UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/66 "2017-02-21T03:40:54Z")

</div>

> [@Coolthulhu](#):
>
> [quote=“Taberone, post:61, topic:12858”]Is there a way to stop getting “There are too many overmap specials” when playing with both PK’s and Cata++ by editing a file somewhere? I vaugely remember a solution someone offered to “too many overmap specials” that involved that.

You need to find the file where specials are declared and decrease the mandatory occurrences. You can brute force text search the mod directories for “occurrences” - the files with strings like

> "occurrences" : [0, 10],

 are the relevant ones. First number is mandatory occurrences - this is the one you want to change. Lowering the second one can help with more varied worlds, but isn't mandatory.[/quote]

Changing all the mandatory occurrences to 0 for PK and Cata++ worked.

---

<div class="post-metadata">

**Author:** ![Noctifer](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/noctifer/32/458_2.png) [@Noctifer](https://discourse.cataclysmdda.org/u/Noctifer)\
**Post date:** [February 21, 2017, 4:15am UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/67 "2017-02-21T04:15:49Z")

</div>

> [@Taberone](#):
>
> Changing all the mandatory occurrences to 0 for PK and Cata++ worked. Not sure why nobody else is having problems with PK and Cata++ and overmap specials.

People have had issues with it (my self included) but changing all mandatory occurrences to 0 makes it so that some of the buildings that are core to the mods have a chance to not spawn. This is currently irrelevant since even with mandatory on its a gamble if they will be choosen over other mandatory buildings.

---

<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 21, 2017, 8:15pm UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/68 "2017-02-21T20:15:17Z")

</div>

i try to limit what is and isnt mandatory

coregame thinks anything that has a c++ component is mandatory.

---

<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 22, 2017, 4:42am UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/69 "2017-02-22T04:42:43Z")

</div>

> [@pisskop](#):
>
> coregame thinks anything that has a c++ component is mandatory.

Some of those can be cut down.  
If you think there are non-essential spawns that could be dropped out of mandatory, PR it.  
Older system rolled values between mandatory and optional to get an actual count. The new one generates things for as long as it can, so setting something as totally non-mandatory will no longer decrease chance to spawn on a world where all mandatory things are generated.

---

<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 23, 2017, 1:38pm UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/70 "2017-02-23T13:38:41Z")

</div>

I’d create a little mod which overwriting some default mapgen json’s, for example grocery0 and grocery1, with decreased chances of food groups spawn and “repeat” on 1. But that stupid fucking spawn system keep filling at least half of the grocery stores with TONS of food on 1.0 item spawn. WTF?!

---

<div class="post-metadata">

**Author:** ![viggolo](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/viggolo/32/538_2.png) [@viggolo](https://discourse.cataclysmdda.org/u/viggolo)\
**Post date:** [February 27, 2017, 12:42pm UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/71 "2017-02-27T12:42:12Z")

</div>

I can’t find the part of the code that increases the encumbrance of clothes when sewing/tailoring (fitting) them with kevlar/leather. Any idea where that is?

(recent experimental version)

---

<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 27, 2017, 11:48pm UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/72 "2017-02-27T23:48:43Z")

</div>

Thats not. its a fixed percentage based on hardcode.

---

<div class="post-metadata">

**Author:** ![viggolo](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/viggolo/32/538_2.png) [@viggolo](https://discourse.cataclysmdda.org/u/viggolo)\
**Post date:** [February 28, 2017, 2:17am UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/73 "2017-02-28T02:17:34Z")

</div>

Thanks for the info. That sucks though, guess I’ll have to mod separate recipes for clothes that would have fitted bash/cut resistances without the encumbrance penalties one by one

---

<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:** [February 28, 2017, 8:15am UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/74 "2017-02-28T08:15:48Z")

</div>

> [@pisskop](#):
>
> Thats not. its a fixed percentage based on hardcode.

[https://github.com/CleverRaven/Cataclysm-DDA/blob/e53b1316b3ca31a7c784ac082835062eacf121bf/src/iuse.cpp#L2049](https://github.com/CleverRaven/Cataclysm-DDA/blob/e53b1316b3ca31a7c784ac082835062eacf121bf/src/iuse.cpp#L2049) and below

[code] // TODO: The supremely ugly block of code below looks better than 200 line boilerplate  
// that was there before, but it can probably be moved into a helper somehow

```
// TODO 2: List how much material we have and how much we need
item temp_item = modded_copy( mod, "wooled" );
// Can we perform this addition or removal
bool enab = can_add_mod( "wooled", "felt_patch" );
tmenu.addentry( 0, enab, MENU_AUTOASSIGN, _("%s (Warmth: %d->%d, Encumbrance: %d->%d)"),
    mod->item_tags.count("wooled") == 0 ? _("Line it with wool") : _("Destroy wool lining"),

```

mod-\>get\_warmth(), temp\_item.get\_warmth(), mod-\>get\_encumber(), temp\_item.get\_encumber() );[/code]

---

<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:** [March 6, 2017, 4:15pm UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/75 "2017-03-06T16:15:13Z")

</div>

i dont quite understand how the definitions for the custom attacks work.

specifically the damage dealt. let us pretend i wish to create an attack that deals a mons base damage plus 3 additional cutting damage. how do?

does max damage overwrite possible damage for an attack? say for a bite that does a max of 100 stab damage.

---

<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:** [March 6, 2017, 4:16pm UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/76 "2017-03-06T16:16:08Z")

</div>

also i want to know partially because i wish to add a new zombie attack into coregame. since its been testing well in my mod

---

<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 6, 2017, 4:39pm UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/77 "2017-03-06T16:39:14Z")

</div>

[quote=“pisskop, post:75, topic:12858”]i dont quite understand how the definitions for the custom attacks work.

specifically the damage dealt. let us pretend i wish to create an attack that deals a mons base damage plus 3 additional cutting damage. how do?

does max damage overwrite possible damage for an attack? say for a bite that does a max of 100 stab damage.[/quote]

Adding damage isn’t possible at the moment, you need to specify the exact damage for the whole attack.  
Adding damage sounds simple, but the problem is that damage also has penetration, damage multiplier and armor multiplier. This is why the attacks use this multiplier scaling thing instead of being multiplied by a number or rolled.

So if you want to deal base damage + 3 cutting damage, you need to sum of the damage as a set number and set the multiplier so that lowest multiplier \* set damage is the lowest damage and highest multiplier \* set damage is the highest damage.  
If you set damage higher, it will pierce armor better (armor is deducted before multiplier roll), if you control mostly the multiplier it will pierce armor less.

---

<div class="post-metadata">

**Author:** ![fxckenstein](https://avatars.discourse-cdn.com/v4/letter/f/eb8c5e/32.png) [@fxckenstein](https://discourse.cataclysmdda.org/u/fxckenstein)\
**Post date:** [March 9, 2017, 5:21am UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/78 "2017-03-09T05:21:12Z")

</div>

Is there a way to modify player’s hit-point without changing the source? I see the health settings are hard-coded in character.cpp and wonder if it’s possible to modify it by writing some lua code or even Json, I’d like to add a new mutation which modify player’s hp by 222.22% (200hp at 10 str), it really upset me when a single grenade fragment kills my PC in full survivor gear with full hp. I don’t think a higher health would help much with other things though, it’s usually the pain or status ailment get you first, more health will only slow down the inevitable.

---

<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 9, 2017, 1:51pm UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/79 "2017-03-09T13:51:02Z")

</div>

Currently no.  
The best you can get right now is giving self mutations that grant HP.

---

<div class="post-metadata">

**Author:** ![fxckenstein](https://avatars.discourse-cdn.com/v4/letter/f/eb8c5e/32.png) [@fxckenstein](https://discourse.cataclysmdda.org/u/fxckenstein)\
**Post date:** [March 10, 2017, 1:56am UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/80 "2017-03-10T01:56:31Z")

</div>

[quote=“Coolthulhu, post:79, topic:12858”]Currently no.  
The best you can get right now is giving self mutations that grant HP.[/quote]  
Well thanks, but I don`t really like to break immersion. guess I`ll hold on until I find a workaround about it, I played too much cdda these days anyway.

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

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