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

Offline pisskop

  • Survivor
  • ***
  • Posts: 3616
  • Excitebike
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #90 on: April 13, 2017, 10:06:03 PM »
Is it possible to confer a trait upon somebody using effects?

Lets say, for example, I gave human flesh a 1% chance of granting the cannibal mutation.  Yes, no?

Offline Coolthulhu

  • Contributor
  • Survivor
  • ****
  • Posts: 3839
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #91 on: April 13, 2017, 11:31:49 PM »
Currently no

Offline pisskop

  • Survivor
  • ***
  • Posts: 3616
  • Excitebike
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #92 on: April 20, 2017, 09:39:59 PM »
How do I add my own builtins?

I tried adding new caves; for instance it was a few minutes of work to make a 'dusk horror' cave.  but the game wont read it or I dont know how to properly add it as a builtin.

The src mentions:
mapgen_functions_big.cpp

but no such file exists?

Offline Coolthulhu

  • Contributor
  • Survivor
  • ****
  • Posts: 3839
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #93 on: April 21, 2017, 09:35:46 AM »
Nowadays it's just mapgen_functions.cpp

To add a builtin, you need to add a function in mapgen_functions.cpp and bind it to a name in init_mapgen_builtin_functions function in the same file.
Then, of course, recompile the game.

Offline MorCel 374

  • Zombie Food
  • *
  • Posts: 52
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #94 on: April 23, 2017, 05:10:32 PM »
I'm trying to add some new mutations and thresholds, and got some questions about the json's and cpp's.

What's the matter with mutation_ordering.json? It looks like it's some sort of priority order for thresholds. And where could I get the source for the new experimental? The one on the main site (http://en.cataclysmdda.com/) seems old.

Offline Coolthulhu

  • Contributor
  • Survivor
  • ****
  • Posts: 3839
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #95 on: April 23, 2017, 06:08:16 PM »
1. What's the matter with mutation_ordering.json? It looks like it's some sort of priority order for thresholds.

2. And where could I get the source for the new experimental? The one on the main site (http://en.cataclysmdda.com/) seems old.

1. It's draw order

2. https://github.com/CleverRaven/Cataclysm-DDA

Offline MorCel 374

  • Zombie Food
  • *
  • Posts: 52
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #96 on: April 23, 2017, 06:29:04 PM »
Thanks!

Offline Maddremor

  • Zombie Food
  • *
  • Posts: 32
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #97 on: May 02, 2017, 07:00:22 PM »
How do you replace the terrain tiles that make up bridges? Trying to make bridges generate as a variant of shallow water to allow boats to pass bridges.

Offline pisskop

  • Survivor
  • ***
  • Posts: 3616
  • Excitebike
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #98 on: May 02, 2017, 07:55:01 PM »
Gotta change what they are made of.

'Unfortunately, I dont think they are made of anything but pavement.  so changing them would involve altering what pavement is. Bridges are hardcoded, so you cant replace their constituent IDs, only change their properties.

Offline Zhilkin

  • NPC
  • **
  • Posts: 218
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #99 on: May 13, 2017, 09:14:44 AM »
How do you replace the terrain tiles that make up bridges? Trying to make bridges generate as a variant of shallow water to allow boats to pass bridges.
Changing JSON won't be enough.

Offline Maddremor

  • Zombie Food
  • *
  • Posts: 32
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #100 on: May 18, 2017, 11:46:41 AM »
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:

Code: [Select]
"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?

Offline Zhilkin

  • NPC
  • **
  • Posts: 218
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #101 on: May 18, 2017, 06:54:07 PM »
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:

Code: [Select]
"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?

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

Code: [Select]
  {
    "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

Offline pisskop

  • Survivor
  • ***
  • Posts: 3616
  • Excitebike
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #102 on: May 18, 2017, 07:04:23 PM »
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.

Offline africalinguist

  • Zombie Food
  • *
  • Posts: 3
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #103 on: May 19, 2017, 02:25:06 AM »
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

Offline Alec White

  • NPC
  • **
  • Posts: 215
  • I'm shy
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #104 on: May 19, 2017, 02:28:20 AM »
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.