The Minor JSON Questions Thread

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.

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.

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=“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.

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

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

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],

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.

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.

i try to limit what is and isnt mandatory

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.

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

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)

Thats not. its a fixed percentage based on hardcode.

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

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]

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.

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

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

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.

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

[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 dont really like to break immersion. guess Ill hold on until I find a workaround about it, I played too much cdda these days anyway.