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

Offline africalinguist

  • Zombie Food
  • *
  • Posts: 3
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #105 on: May 19, 2017, 02:59:27 AM »
thanks alec white yes you were right. the item id was s-23 not c-23 :P

Offline pisskop

  • Survivor
  • ***
  • Posts: 3588
  • Excitebike
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #106 on: May 25, 2017, 10:56:23 PM »
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
      }
    ]
  },

Offline Zhilkin

  • NPC
  • **
  • Posts: 205
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #107 on: May 26, 2017, 03:42:56 PM »
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
      }
    ]
  },

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

Code: [Select]
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
« Last Edit: May 26, 2017, 04:07:04 PM by Zhilkin »

Offline pisskop

  • Survivor
  • ***
  • Posts: 3588
  • Excitebike
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #108 on: May 26, 2017, 05:09:23 PM »
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?

Offline Taberone

  • NPC
  • **
  • Posts: 162
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #109 on: August 03, 2017, 11:57:02 PM »
how do I reduce the number of mandatory overmap specials in More Locations and Z-Level Buildings mod?
Something like 15:00-18:00 is good time to kill the children
This is art right here

Offline pisskop

  • Survivor
  • ***
  • Posts: 3588
  • Excitebike
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #110 on: August 04, 2017, 12:33:40 AM »
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.

Offline DeWolf

  • Survivor
  • ***
  • Posts: 968
  • STAY AWAY FROM MY PRETZELS
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #111 on: August 22, 2017, 09:59:26 PM »
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?

Offline pisskop

  • Survivor
  • ***
  • Posts: 3588
  • Excitebike
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #112 on: September 01, 2017, 06:01:09 PM »
Is it possible to get a turret to run off battery charge any longer?

Offline Coolthulhu

  • Contributor
  • Survivor
  • ****
  • Posts: 3793
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #113 on: September 02, 2017, 08:05:21 AM »
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.

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?

Offline pisskop

  • Survivor
  • ***
  • Posts: 3588
  • Excitebike
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #114 on: September 02, 2017, 02:29:21 PM »
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.

Offline Coolthulhu

  • Contributor
  • Survivor
  • ****
  • Posts: 3793
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #115 on: September 03, 2017, 11:20:22 AM »
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.

Offline pisskop

  • Survivor
  • ***
  • Posts: 3588
  • Excitebike
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #116 on: September 03, 2017, 03:04:30 PM »
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

Offline Taberone

  • NPC
  • **
  • Posts: 162
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #117 on: September 05, 2017, 02:25:10 AM »
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.
Something like 15:00-18:00 is good time to kill the children
This is art right here

Offline Noctifer

  • Survivor
  • ***
  • Posts: 2831
  • Evening Star
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #118 on: September 05, 2017, 03:03:06 AM »
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.
May mother Venus guide us all!

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

Offline pisskop

  • Survivor
  • ***
  • Posts: 3588
  • Excitebike
    • View Profile
Re: The Minor JSON Questions Thread
« Reply #119 on: September 05, 2017, 03:05:21 AM »
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