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

<div class="post-metadata">

**Author:** ![Maddremor](https://avatars.discourse-cdn.com/v4/letter/m/85e7bf/32.png) [@Maddremor](https://discourse.cataclysmdda.org/u/Maddremor)\
**Post date:** [May 18, 2017, 10:46am UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/101 "2017-05-18T10:46:41Z")

</div>

Another question: How do you make an item with multiple “use\_action” promt the user with a menu to select the action? Currently, I have the following:

```auto
"use_action": [
      {
        "target": "abm_belt_cloth_shot_unfinished",
        "msg": "You adjust the belt to house shotshells.",
        "menu_text": "Adjust for shotshells",
        "type": "transform"
      },
      {
        "target": "abm_belt_cloth_50_unfinished",
        "msg": "You adjust the belt to house .50 bullets.",
        "menu_text": "Adjust for .50",
        "type": "transform"
      }
    ],
```

It defaults to the first option when activated. Is it possible to have the user choose?

---

<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:** [May 18, 2017, 5:54pm UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/102 "2017-05-18T17:54:07Z")

</div>

[quote=“Maddremor, post:101, topic:12858”]Another question: How do you make an item with multiple “use\_action” promt the user with a menu to select the action? Currently, I have the following:

```auto
"use_action": [
      {
        "target": "abm_belt_cloth_shot_unfinished",
        "msg": "You adjust the belt to house shotshells.",
        "menu_text": "Adjust for shotshells",
        "type": "transform"
      },
      {
        "target": "abm_belt_cloth_50_unfinished",
        "msg": "You adjust the belt to house .50 bullets.",
        "menu_text": "Adjust for .50",
        "type": "transform"
      }
    ],
```

It defaults to the first option when activated. Is it possible to have the user choose?[/quote]

I believe you need to create several copies of your item with `transform` actions with different `target`, like this:

```auto
  {
    "id": "candle_smoke",
    "copy-from": "candle",
    "type": "GENERIC",
    "name": "smoking candle",
    "description": "A candle in every respect, but designed to produce a thin stream of smoke. Often used in ceremonies or to add an air of 'ambient mystery', but could likely be used to reduce scent by windows and doors it is placed next to.",
    "emits": ["emit_smoke_flare"],
    "use_action": {
      "target": "candle_smoke_lit",
      "msg": "You light the smoking candle.",
      "active": true,
      "need_fire": 1,
      "menu_text": "Light",
      "type": "transform"
    }
  },
  {
    "id": "candle_smoke_lit",
    "type": "TOOL",
    "name": "smoking candle (lit)",
    "name_plural": "smoking candles (lit)",
    "copy-from": "candle_lit",
    "description": "This smoking candle is lit, providing both aeromatic smoke and light.",
    "emits": ["emit_smoke_flare"],
    "use_action": {
      "target": "candle_smoke",
      "msg": "The candle winks out.",
      "menu_text": "Extinguish",
      "type": "transform"
    },
    "flags": ["LIGHT_8", "TRADER_AVOID"]
  }
```

So it will go like this:

candle\_smoke\_lit -\> candle\_smoke -\> candle\_smoke\_lit

---

<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:** [May 18, 2017, 6:04pm UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/103 "2017-05-18T18:04:23Z")

</div>

If Im understanding the question, you want to be able to take an item and make several ‘branches’ of items from it. Transform should only honor the last transform option input.

- You can try to create a 6 second recipe that is accessed from the crafting menu.
- You could also make them all rotate. i.e. ammo\_shot\_belt goes to ammo\_50\_belt goes to ammo\_unused\_belt goes to ammo\_shot\_belt. By this method the player only needs to be aware this function exists.
- You could make the player define its ammo as they create the item i.e. they dont craft the generic version.

---

<div class="post-metadata">

**Author:** ![africalinguist](https://avatars.discourse-cdn.com/v4/letter/a/eb9ed0/32.png) [@africalinguist](https://discourse.cataclysmdda.org/u/africalinguist)\
**Post date:** [May 19, 2017, 1:25am UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/104 "2017-05-19T01:25:06Z")

</div>

i am making a mod that adds more energy weapons but when the world loads it says “result: c-23 in recipe c-23 is not valid” or something like that

---

<div class="post-metadata">

**Author:** ![Alec\_White](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/alec_white/32/509_2.png) [@Alec\_White](https://discourse.cataclysmdda.org/u/Alec_White)\
**Post date:** [May 19, 2017, 1:28am UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/105 "2017-05-19T01:28:20Z")

</div>

> [@africalinguist](#):
>
> i am making a mod that adds more energy weapons but when the world loads it says “result: c-23 in recipe c-23 is not valid” or something like that

You probably have a recipe that has the wrong item ID as result.

---

<div class="post-metadata">

**Author:** ![africalinguist](https://avatars.discourse-cdn.com/v4/letter/a/eb9ed0/32.png) [@africalinguist](https://discourse.cataclysmdda.org/u/africalinguist)\
**Post date:** [May 19, 2017, 1:59am UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/106 "2017-05-19T01:59:27Z")

</div>

thanks alec white yes you were right. the item id was s-23 not c-23 😛

---

<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:** [May 25, 2017, 9:56pm UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/107 "2017-05-25T21:56:23Z")

</div>

Anyone know why my custom lighter can start overworld fires but wont spark a cigar?

{  
“id”: “ref\_lighter\_string”,  
“type”: “TOOL\_ARMOR”,  
“name”: “wearable lighter”,  
“copy-from”: “lighter”,  
“description”: “A lighter with a bit of string and taping to allow it to be worn about the neck like a lanyard. A bit fumbly to get a hold of, but perfectly servicable.”,  
“weight”: 25,  
“volume”: 0,  
“price”: 3000,  
“material”: “aluminum”,  
“symbol”: “,”,  
“color”: “light\_gray”,  
“coverage”: 1,  
“encumbrance”: 0,  
“storage”: 0,  
“warmth”: 0,  
“material\_thickness”: 1,  
“ammo”: “gasoline”,  
“max\_charges”: 50,  
“rand\_charges”: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 5, 7, 11, 13, 17, 21, 27],  
“charges\_per\_use”: 1,  
“use\_action”: [  
{  
“type”: “firestarter”,  
“moves”: 60,  
“moves\_slow”: 600  
}  
]  
},

---

<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:** [May 26, 2017, 2:42pm UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/108 "2017-05-26T14:42:56Z")

</div>

[quote=“pisskop, post:107, topic:12858”]Anyone know why my custom lighter can start overworld fires but wont spark a cigar?

{  
“id”: “ref\_lighter\_string”,  
“type”: “TOOL\_ARMOR”,  
“name”: “wearable lighter”,  
“copy-from”: “lighter”,  
“description”: “A lighter with a bit of string and taping to allow it to be worn about the neck like a lanyard. A bit fumbly to get a hold of, but perfectly servicable.”,  
“weight”: 25,  
“volume”: 0,  
“price”: 3000,  
“material”: “aluminum”,  
“symbol”: “,”,  
“color”: “light\_gray”,  
“coverage”: 1,  
“encumbrance”: 0,  
“storage”: 0,  
“warmth”: 0,  
“material\_thickness”: 1,  
“ammo”: “gasoline”,  
“max\_charges”: 50,  
“rand\_charges”: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 5, 7, 11, 13, 17, 21, 27],  
“charges\_per\_use”: 1,  
“use\_action”: [  
{  
“type”: “firestarter”,  
“moves”: 60,  
“moves\_slow”: 600  
}  
]  
},[/quote]

> <https://github.com/CleverRaven/Cataclysm-DDA/blob/4bcc67a9d0b5dc3d2b8844fb3705e4b524fdcb23/src/iuse.cpp#L397-L409>

```auto
int iuse::smoking(player *p, item *it, bool, const tripoint&)
{
    bool hasFire = (p->has_charges("fire", 1));

    // make sure we're not already smoking something
    if( !check_litcig( *p ) ) {
        return 0;
    }

    if (!hasFire) {
        p->add_msg_if_player(m_info, _("You don't have anything to light it with!"));
        return 0;
}
```

* * *

ref\_lighter\_on = refillable lighter (lit) also does not provide fire for cigarettes.

You can check this in LUA console by this command:

game.add\_msg(tostring(player:has\_charges(“fire”,1)))

* * *

Probably same issue as described in [https://github.com/CleverRaven/Cataclysm-DDA/issues/21005](https://github.com/CleverRaven/Cataclysm-DDA/issues/21005)

---

<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:** [May 26, 2017, 4:09pm UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/109 "2017-05-26T16:09:23Z")

</div>

oh hey, thanks for the update edit.

I was doing my own doodadaling with the jsons and came to the conclusion that it must be a hardcode somewhere?

---

<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:** [August 3, 2017, 10:57pm UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/110 "2017-08-03T22:57:02Z")

</div>

how do I reduce the number of mandatory overmap specials in More Locations and Z-Level Buildings mod?

---

<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:** [August 3, 2017, 11:33pm UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/111 "2017-08-03T23:33:40Z")

</div>

Inside the overmap special.json file there are tags for [occurances].

You mod those two bracketed numbers.

Numbers range from [-1,-1] to … … whatever.

-1 means 'no limit’  
0 means 'none’  
A number represents its contemporary quantity.

The first number is a minimal amount. the second a max.

… and for the record, Id shy away from using -1. it scares the game.

---

<div class="post-metadata">

**Author:** ![DeWolf](https://avatars.discourse-cdn.com/v4/letter/d/df705f/32.png) [@DeWolf](https://discourse.cataclysmdda.org/u/DeWolf)\
**Post date:** [August 22, 2017, 8:59pm UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/112 "2017-08-22T20:59:26Z")

</div>

So is there anything in the Jason’s for the latest experimental s that determines how much engine power a combustion engine has or is this something that is hard coded now?

---

<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:** [September 1, 2017, 5:01pm UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/113 "2017-09-01T17:01:09Z")

</div>

Is it possible to get a turret to run off battery charge any longer?

---

<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:** [September 2, 2017, 7:05am UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/114 "2017-09-02T07:05:21Z")

</div>

> [@DeWolf](#):
>
> So is there anything in the Jason’s for the latest experimental s that determines how much engine power a combustion engine has or is this something that is hard coded now?

It needs to be declared in its item definition Json now.

> [@pisskop](#):
>
> Is it possible to get a turret to run off battery charge any longer?

It should be. If not, it’s probably a bug. Provide an example though - I’m not sure what kind of battery powering do you have in mind. Battery as magazine, vehicle battery, battery-using-gun specified to use UPS not working or what?

---

<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:** [September 2, 2017, 1:29pm UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/115 "2017-09-02T13:29:21Z")

</div>

Well, I have a gun that uses battery to fire. A tesla coil, if you will.

The gun was originally intended to be too unwieldy to use by hand, but could be mounted. Back when car batteries could be charged via standard batteries it worked fine when mounted, drawing 100 charge per shot, doing minimal damage per shot, but stunning, lighting up, and bouncing off enemies.

The gun, Ive been informed, will still require batteries when mounted, due to the new turret mechanics.

Anywho, the issue may be the ups version of the gun not drawing power at all from ups.  
Which is another issue entirely, but this shockcannon is incompatible with a ups conversion kit. I got around that by making an actual ups powered version, but it will not draw power from ups, making it an infinite ammo gun.

---

<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:** [September 3, 2017, 10:20am UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/116 "2017-09-03T10:20:22Z")

</div>

Weapons may have problems consuming electricity directly, if ammo is specified to be battery, as there is no instance of this happening in core game.  
If you want to use it that way, report it, but it may later bitrot again for as long as there is no turret in the core that works this way.

The UPS part however is an obvious bug. UPS weapons are supposed to properly draw power from vehicle storage.

---

<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:** [September 3, 2017, 2:04pm UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/117 "2017-09-03T14:04:30Z")

</div>

it actually works now, with some tweaking. thanks!

needed some adjusting, but i do think if battery is an ammo than conversation kits should work on any type of item that could accept them

---

<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:** [September 5, 2017, 1:25am UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/118 "2017-09-05T01:25:10Z")

</div>

How do I add in a custom monster? Not looking to have it naturally spawn yet, just want a custom monster I can spawn through debug menu for now.

---

<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:** [September 5, 2017, 2:03am UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/119 "2017-09-05T02:03:06Z")

</div>

Look at monsters.json and copy the entry that most matches your monster in question. Then modify it and slap the file with that bit of code in a mod.

---

<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:** [September 5, 2017, 2:05am UTC](https://discourse.cataclysmdda.org/t/the-minor-json-questions-thread/12858/120 "2017-09-05T02:05:21Z")

</div>

easiest way is to copy one from

/data/json/monsters

and give it a new id. if you felt like it you could give all the monsters exactly identical stats. except the id. id has to differ.

try to take a mon that is somrwhat similar to your own idea.

p:. you evil ninja

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

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