Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Modding in gunpowder  (Read 660 times)

Rat Of Wisdom

  • Bay Watcher
    • View Profile
Modding in gunpowder
« on: February 02, 2010, 02:18:46 am »

So, I've got some saltpeter, I can make charcoal anytime, and I'm currently trolling my dolomite layers for pockets of brimstone in gypsum. But, like dwarven nuclear reactors, the best I can do is a pretty little mock-up of a black powder device.

My question: how would I go about editing the game files to make "gunpowder" a substance producible in discrete units from an Alchemist's laboratory from, say, 5 saltpeter, 2 charcoal and 1 brimstone? (Naturally, this would be a similar operation to smelting alloys; ie. with 8 input stones it would return 8 bars (or bags or whatever) of powder.)

Furthermore, could I then cause this substance to react explosively to fire, like booze apparently does but which I've been fortunate enough not to see do so firsthand?

(This may lead to later questions on modding and constructing a fuse, but we'll burn and blow up that bridge when we come to it. Also, of course the question of whether or not black powder should ever make it to a main version is still open to discussion but not necessarily relevant.)
Logged
Evidently, Dorf Philosopher Uristmedes only figured out the Uristmedes screw. And he ran around naked and covered in water, blood, and vomit all the time, so any discoveries made in his 4/7 bathtub went unnoticed by dorf science.

Huin

  • Bay Watcher
    • View Profile
Re: Modding in gunpowder
« Reply #1 on: February 02, 2010, 03:19:18 am »

This sounds like a question for the modding forum :)
Logged

Rat Of Wisdom

  • Bay Watcher
    • View Profile
Re: Modding in gunpowder
« Reply #2 on: February 02, 2010, 03:38:59 am »

A durr hurr. Moving now.

Rat O'Wisdom cancels Move Topic: Sleep
Logged
Evidently, Dorf Philosopher Uristmedes only figured out the Uristmedes screw. And he ran around naked and covered in water, blood, and vomit all the time, so any discoveries made in his 4/7 bathtub went unnoticed by dorf science.

Footkerchief

  • Bay Watcher
  • The Juffo-Wup is strong in this place.
    • View Profile
Re: Modding in gunpowder
« Reply #3 on: February 02, 2010, 04:13:33 am »

My question: how would I go about editing the game files to make "gunpowder" a substance producible in discrete units from an Alchemist's laboratory from, say, 5 saltpeter, 2 charcoal and 1 brimstone? (Naturally, this would be a similar operation to smelting alloys; ie. with 8 input stones it would return 8 bars (or bags or whatever) of powder.)

You're going to need two things:
1) A gunpowder material, probably implemented as a stone with no geological occurrence.  Open up /raw/objects/matgloss_stone_layer.txt and look over one of the stones, using the wiki article on stone tokens to decipher stuff.  Alternately you could implement the material as a metal, in matgloss_metal.txt.
2) A reaction to produce the gunpowder "stone" (or bars).

Also, you can only do this at the smelter right now.

Furthermore, could I then cause this substance to react explosively to fire, like booze apparently does but which I've been fortunate enough not to see do so firsthand?

Nope.  Nothing in the game explodes right now, the booze thing is unfortunately a myth (people saw it boiling into vapor and, due to the nasty burns that hot gases used to inflict, assumed it was exploding).

The upcoming version (due out in ~1 month) will allow you to produce gunpowder as an actual powder that goes in bags/barrels, and you'll be able to do it at the alchemist's shop (or a custom shop of your own design), but it still won't explode.
« Last Edit: February 02, 2010, 04:17:25 am by Footkerchief »
Logged

Rat Of Wisdom

  • Bay Watcher
    • View Profile
Re: Modding in gunpowder
« Reply #4 on: February 02, 2010, 04:25:57 am »

Ah, that's exactly what I needed to know. Many thanks.

It appears that you're required to use the smelter for any funky modded reactions :( Fortunate, because I don't have any glass with which to build an Alchemist's lab, but not very realistic. You ninja'd my observation!

Bummer about the booze too :( But I could presumably give the new material the same "ignites" token as bit.coal and lignite? I'll have a look at that.

I do hope Toady implements explosives... I don't need to see handguns or anything (hardly necessary, with good marksdwarves, although perhaps more cost-effective versus things without organs depending on how it's implemented) but the possibilities for demolitions, landmines, explosive siege ammo, cannons, blowing oneself up accidentally and suchlike are sufficiently dwarfy. But yeah that's probably a discussion for another board ;)
Logged
Evidently, Dorf Philosopher Uristmedes only figured out the Uristmedes screw. And he ran around naked and covered in water, blood, and vomit all the time, so any discoveries made in his 4/7 bathtub went unnoticed by dorf science.

sunshaker

  • Bay Watcher
    • View Profile
Re: Modding in gunpowder
« Reply #5 on: February 02, 2010, 06:37:07 am »

Your other option is to go the weapon route.

Code: [Select]
[ITEM_WEAPON:ITEM_WEAPON_RIFLE]
[NAME:rifle:rifles]
[DAMAGE:50:BLUDGEON] or 70 SLASH if it has a bayonet
[WEIGHT:40]
[SKILL:HAMMER] or spear if it has a bayonet
[RANGED:CROSSBOW:BULLET]
[TWO_HANDED:5]
[MINIMUM_SIZE:5]
[MATERIAL_SIZE:3]
Put this in the entity list and weapons file.

[ITEM_AMMO:ITEM_AMMO_BULLET]
[NAME:bullet:bullet]
[CLASS:BULLET]
[DAMAGE:100:BLUDGEON]
Do not put this in the entity list, if you do they will make it out of wood, but it does need to be in the ammo file. You can alter it so that the type is pierce and that is does more than 100 damage.

[REACTION:GUNPOWDER]
[NAME:make gunpowder]
[SMELTER]
[REAGENT:5:STONE:NO_SUBTYPE:STONE:SALTPETER]
[REAGENT:1:STONE:NO_SUBTYPE:STONE:BRIMSTONE]
[REAGENT:2:BAR:NO_SUBTYPE:COAL:COKE]
[PRODUCT:100:8:BAR:NO_SUBTYPE:METAL:GUNPOWDER]
You will need to add a brittle metal called gunpowder to the metal file, use bismuth, change the names, add a low ignite point.

[REACTION:BULLET_RIFLE]
[NAME:make bullets]
[SMELTER]
[REAGENT:1:BAR:NO_SUBTYPE:METAL:GUNPOWDER]
[REAGENT:1:BAR:NO_SUBTYPE:METAL:BRASS]
[REAGENT:1:BAR:NO_SUBTYPE:METAL:LEAD]
[PRODUCT:100:50:AMMO:ITEM_AMMO_BULLET:METAL:LEAD]
Bullets are small so you can carry more of them than you can of bolts which is why the reaction makes stacks of 50. An other option is alter the product so it makes something like GUNMETAL bullets which does more damage (lead does 50% damage).

Repeat for every firearm you want in the game.
« Last Edit: February 03, 2010, 08:56:20 am by sunshaker »
Logged

Eagle0600

  • Bay Watcher
  • Highly Confused
    • View Profile
Re: Modding in gunpowder
« Reply #6 on: February 03, 2010, 04:45:24 am »

My first thought upon seeing that you wanted it to explode was to make it boil at similar temperatures to booze.

Seriously, boiling is close enough to an explosion that it barely matters.
Logged
GENERATION 21:The first time you see this, copy it into your sig on any forum and add 1 to the generation. Social experiment.

Shade-o

  • Bay Watcher
  • It's my greatest creation yet!
    • View Profile
Re: Modding in gunpowder
« Reply #7 on: February 04, 2010, 10:21:36 pm »

What I've done is this:

Reactions create plants with no uses from Brimstone and Saltpeter rock. These products are then combined with Charcoal and Lead or Iron bars to form small stacks of whichever shot. However, to both prevent the shot from being 'M'elted down, and to make Lead shot more useful than Iron, the ammo produced is not actually made of the metal, but a stone called the same thing. Further, each stone is a different actual ammo type, so 'Lead Shot' has a higher damage than 'Iron Shot'.

It seems overly convoluted now.
Logged
Apparently having a redundant creature entry causes the game to say, "Oh, look, it's crazy world now. Nothing makes sense! Alligators live in houses!"