Author Topic: The Minor JSON Questions Thread  (Read 4258 times)

Offline Taberone

  • NPC
  • **
  • Posts: 153
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #60 on: February 19, 2017, 07:36:15 PM »
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.
Something like 15:00-18:00 is good time to kill the children
This is art right here

Offline Coolthulhu

  • Contributor
  • Survivor
  • ****
  • Posts: 3686
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #61 on: February 20, 2017, 02:41:42 AM »
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.

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
Quote
"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.

Offline hatcher

  • Zombie Food
  • *
  • Posts: 26
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #62 on: February 20, 2017, 12:21:26 PM »
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.


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: [Select]
local milk = game.get_comestible_type("milk")

milk.volume = milk.volume / 2

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,
Code: [Select]
game.get_category("food")or
Code: [Select]
game.get_item_category("food")
food.probability = food.probability / 10
?

Don't laugh hard pls, its just a guess by a fool.
« Last Edit: February 20, 2017, 12:25:28 PM by hatcher »

Offline Coolthulhu

  • Contributor
  • Survivor
  • ****
  • Posts: 3686
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #63 on: February 20, 2017, 03:31:57 PM »
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".

Offline hatcher

  • Zombie Food
  • *
  • Posts: 26
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #64 on: February 20, 2017, 04:05:06 PM »
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".

Sounds very complicated for me. Btw, I found this:
Code: [Select]
{ name = "is_food", rval = "bool", args = { } },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.
Code: [Select]
"repeat": [ 1, 3 ] – 1, 3 means from 1 to 3 spawn cycles am i right?

(click to show/hide)
« Last Edit: February 20, 2017, 04:33:28 PM by hatcher »

Offline Taberone

  • NPC
  • **
  • Posts: 153
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #65 on: February 21, 2017, 03:40:54 AM »
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
Quote
"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.

Changing all the mandatory occurrences to 0 for PK and Cata++ worked.
« Last Edit: February 21, 2017, 06:28:37 AM by Taberone »
Something like 15:00-18:00 is good time to kill the children
This is art right here

Offline Noctifer

  • Survivor
  • ***
  • Posts: 2656
  • Evening Star
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #66 on: February 21, 2017, 04:15:49 AM »
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.
May mother Venus guide us all!

...Noctifer's incredibly loot bloated Survivor Emcampments™...

Offline pisskop

  • Survivor
  • ***
  • Posts: 3388
  • So Noble he farts Helium
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #67 on: February 21, 2017, 08:15:17 PM »
i try to limit what is and isnt mandatory

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

Offline Coolthulhu

  • Contributor
  • Survivor
  • ****
  • Posts: 3686
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #68 on: February 22, 2017, 04:42:43 AM »
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.

Offline hatcher

  • Zombie Food
  • *
  • Posts: 26
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #69 on: February 23, 2017, 01:38:41 PM »
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?!
« Last Edit: February 23, 2017, 07:52:10 PM by hatcher »

Offline viggolo

  • Zombie Food
  • *
  • Posts: 17
    • View Profile
    • vigg's gfx archive
Re: The Minor JSON Questions Thread
« Reply #70 on: February 27, 2017, 12:42:12 PM »
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)
« Last Edit: February 27, 2017, 12:44:12 PM by viggolo »

Offline pisskop

  • Survivor
  • ***
  • Posts: 3388
  • So Noble he farts Helium
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #71 on: February 27, 2017, 11:48:43 PM »
Thats not.  its a fixed percentage based on hardcode.

Offline viggolo

  • Zombie Food
  • *
  • Posts: 17
    • View Profile
    • vigg's gfx archive
Re: The Minor JSON Questions Thread
« Reply #72 on: February 28, 2017, 02:17:34 AM »
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

Offline Zhilkin

  • NPC
  • **
  • Posts: 110
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #73 on: February 28, 2017, 08:15:48 AM »
Thats not.  its a fixed percentage based on hardcode.
https://github.com/CleverRaven/Cataclysm-DDA/blob/e53b1316b3ca31a7c784ac082835062eacf121bf/src/iuse.cpp#L2049 and below

Code: [Select]
    // 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() );

Offline pisskop

  • Survivor
  • ***
  • Posts: 3388
  • So Noble he farts Helium
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #74 on: March 06, 2017, 04:15:13 PM »
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.