Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: I'm a noob and I need some beginner advice on Modding DF  (Read 1102 times)

DaveLawson

  • Bay Watcher
    • View Profile
I'm a noob and I need some beginner advice on Modding DF
« on: January 11, 2009, 10:21:01 pm »

Hey folks.
I'm taking my first steps into modding and I have more questions than anything.  I've read through what I can find on the wiki with regards to modding (which isn't a whole lot), and I'm still left with questions.  I've spent the last perhaps 3 hours looking up what I can on this here forum, and I still have plenty of questions.

For starters, I'm doing that same thing everyone else has: guns.  Sure, it's nothing new to y'all, but it is to me!  Hopefully someone here has ironed out the problems with fire arms.

Here's what I've managed to do:
Added a 'Pistol' weapon to the game, replacing Mace.
Added an ammo type '9mm round' to the game.
Associated the two, and actually be able to have a dwarf fire off his pistol at some invading deer.

Here's where I'm confused (and perhaps overly hopeful):

Equipping New Weapons.  The only way I found to equip a dwarf with the new weapon, was to replace one of the 6 basic weapons.  Are these slots (in the m->w screen) necessarily hardcoded to particular weapon classes?

Building Ranged Ammo.  Rounds seem to be build at the crafter workshop, which is fine, however, they are built using bone and wood.  This doesn't make a lot of sense to me, and I want to prohibit it.  Is there any way to remove these crafting options?

Building Ranged Weapons.  It seems pistols are built in the same way as crossbows: at a bowyer.  Using wood and bones again.  This one doesn't bother me all that much, since I can disable the bowyer job entirely to circumvent it.  Is this the only way?

Quivers.  Dwarves, after picking up a Pistol, refuse to pick up a quiver.  Is there a work around for this?  I would like to have my dwarves carry spare magazines with them.  Is there a raw somewhere that associates quivers to crossbows?  Can I create a new ammo container 'magazine' to do the same thing for firearms?

Reactions.  I've only touched the surface here in order to make sure I at least vaguely understood the concept.  What I would like to know, is whether or not I can add reactions to non-smelter buildings?  And what freedom do I have in specifying both reagents and products of the reaction?  Could I require shell-casings and gunpowder as a reaction that produces 9mm rounds, for instance?

Stack sizes.  Have I any control over how many of a particular item gets built?  For instance, if my gunsmith cooks up 'shot-gun shells' I would like to produce only 6 at a time, whereas for '9mm round' I would like to have 20 made.

Build costs.  If I create a new weapon in the raws, is it possible to assign it a particular manufacturing cost?  Say comparing a knife with a claymore.  Obviously the claymore should take more metal.  Something like this already exists for armour, obviously, but is it flexible enough to apply to weapons, as well?

Thanks for any help you might be able to throw my way!
Logged

Karlito

  • Bay Watcher
    • View Profile
Re: I'm a noob and I need some beginner advice on Modding DF
« Reply #1 on: January 11, 2009, 10:51:39 pm »

Almost every problem you have is the result of certain behaviors hardcoded into the game and as such they are unable to be changed.  I'm not exactly sure why they aren't picking up quivers because they should be using them.  Reactions can have basically any components for reagents and products and they can only be at the smelter.  You have to mess around with item definitions though, which can get pretty messy.
Logged
This sentence contains exactly threee erors.

webadict

  • Bay Watcher
  • Former King of the Mafia
    • View Profile
Re: I'm a noob and I need some beginner advice on Modding DF
« Reply #2 on: January 11, 2009, 10:54:13 pm »

Here's what I've managed to do:
Added a 'Pistol' weapon to the game, replacing Mace.
Added an ammo type '9mm round' to the game.
Associated the two, and actually be able to have a dwarf fire off his pistol at some invading deer.
Quite nice. You've done pretty well. I'm assuming you did something like this:
Code: [Select]
[ITEM_WEAPON:ITEM_WEAPON_MACE]
[NAME:pistol:pistols]
[DAMAGE:120:BLUDGEON]
[WEIGHT:40]
[SKILL:MACE]
[RANGED:CROSSBOW:BULLET]
[TWO_HANDED:4]
[MINIMUM_SIZE:4]
[MATERIAL_SIZE:3]

Here's where I'm confused (and perhaps overly hopeful):

Equipping New Weapons.  The only way I found to equip a dwarf with the new weapon, was to replace one of the 6 basic weapons.  Are these slots (in the m->w screen) necessarily hardcoded to particular weapon classes?
They are (kinda?) not. They can be changed in the entity files. You can add certain job types to the entity files, like LASHER, or BOWMAN, then change the weapon type to WHIP. Same with bow, as well.

If there is a way to add other weapon types other than that, I'm not sure.

Building Ranged Ammo.  Rounds seem to be build at the crafter workshop, which is fine, however, they are built using bone and wood.  This doesn't make a lot of sense to me, and I want to prohibit it.  Is there any way to remove these crafting options?
I think that this is hardcoded into the game. I don't think there is anything you can do about it.

Building Ranged Weapons.  It seems pistols are built in the same way as crossbows: at a bowyer.  Using wood and bones again.  This one doesn't bother me all that much, since I can disable the bowyer job entirely to circumvent it.  Is this the only way?
Likely the same thing as the ammo. I think it's hardcoded.

Quivers.  Dwarves, after picking up a Pistol, refuse to pick up a quiver.  Is there a work around for this?  I would like to have my dwarves carry spare magazines with them.  Is there a raw somewhere that associates quivers to crossbows?  Can I create a new ammo container 'magazine' to do the same thing for firearms?
No. Maybe a fix with bows might change this.

Reactions.  I've only touched the surface here in order to make sure I at least vaguely understood the concept.  What I would like to know, is whether or not I can add reactions to non-smelter buildings?  And what freedom do I have in specifying both reagents and products of the reaction?  Could I require shell-casings and gunpowder as a reaction that produces 9mm rounds, for instance?
This is very possible. The Reactions raw is very changeable. You can have these be crafts and then smelt them in the Smelter to make the ammo. The only problem is that it might be hard to specify certain products for this.

Stack sizes.  Have I any control over how many of a particular item gets built?  For instance, if my gunsmith cooks up 'shot-gun shells' I would like to produce only 6 at a time, whereas for '9mm round' I would like to have 20 made.
Only if there was a smelter reaction for it. Otherwise no.

Build costs.  If I create a new weapon in the raws, is it possible to assign it a particular manufacturing cost?  Say comparing a knife with a claymore.  Obviously the claymore should take more metal.  Something like this already exists for armour, obviously, but is it flexible enough to apply to weapons, as well?
Yes, I think this is [MATERIAL_SIZE]
The wiki says that Material Size follows this pattern:
"Material size >= 9 requires 3 metal bars
Material size >= 6 requires 2 metal bars
Material size < 6 requires 1 metal bar"

Thanks for any help you might be able to throw my way!
No prob.
Logged

DaveLawson

  • Bay Watcher
    • View Profile
Re: I'm a noob and I need some beginner advice on Modding DF
« Reply #3 on: January 12, 2009, 12:05:29 am »

As for quivers.  I've delved a little deeper.  It seems that any weapon using the crossbow skill results in the user carrying a quiver.  Now I just have to test having multiple weapons that make use of the same skill, and see what happens.

EDIT:
OK.  Easy enough.  I've now got crossbows and pistols both using the same skill, and both making use of quivers, in the same game.  Now to much with the smelter reactions.

I'm having a tough time identifying the fully qualified class name for weapons.
for instance you have
[BAR:NO_SUBTYPE:COAL:COKE] to specify a bar of coke
So far I've been  unable to guess a correct class name for my newly created ammunition, assuming the notion is even valid, that is.
I had expected something like
[?:?:ITEM_AMMO:ITEM_AMMO_PISTOL], but I'm grasping at straws to figure out those two ?'s.  Any ideas?
« Last Edit: January 12, 2009, 12:20:45 am by DaveLawson »
Logged

webadict

  • Bay Watcher
  • Former King of the Mafia
    • View Profile
Re: I'm a noob and I need some beginner advice on Modding DF
« Reply #4 on: January 12, 2009, 09:17:45 am »

You've actually got it mixed up:

[(some other stuff):TYPE:SUBTYPE:MATERIAL:MATGLOSS] is what you want.

Your TYPE is actually AMMO, with the SUBTYPE being ITEM_AMMO_PISTOL (or whatever it's called)

However, this is where I said things would be weird. You'll have to specify the type of ammo you want to produce. So, if you wanted iron bullets, it would be:

[PRODUCT:100:(You can actually make large stacks of bullets with this number):AMMO:ITEM_AMMO_PISTOL:METAL:IRON]

If you need more help with smelter reactions, visit the wiki.
Logged

Deon

  • Bay Watcher
  • 💀 💀 💀 💀 💀
    • View Profile
Re: I'm a noob and I need some beginner advice on Modding DF
« Reply #5 on: January 12, 2009, 10:49:54 am »

Why do you want to replace a mace with it? Won't it be nice to have the same "marksdwarf" skill for both crossbows and pistols? And remember that there're other maces, not just a single one, so you should remove them all. I'd better add just another weapon using the crossbow skill than remove existing ones.
Logged
▬(ஜ۩۞۩ஜ)▬
✫ DF Wanderer ✫ - the adventure mode crafting and tweaks
✫ Cartographer's Lounge ✫ - a custom worldgen repository

webadict

  • Bay Watcher
  • Former King of the Mafia
    • View Profile
Re: I'm a noob and I need some beginner advice on Modding DF
« Reply #6 on: January 12, 2009, 11:13:41 am »

Why do you want to replace a mace with it? Won't it be nice to have the same "marksdwarf" skill for both crossbows and pistols? And remember that there're other maces, not just a single one, so you should remove them all. I'd better add just another weapon using the crossbow skill than remove existing ones.
That's actually what he did. He was just wondering if he could add in another job.
Logged

DaveLawson

  • Bay Watcher
    • View Profile
Re: I'm a noob and I need some beginner advice on Modding DF
« Reply #7 on: January 12, 2009, 12:39:50 pm »

Yes, well ideally I would have liked to create a new skill altogether, but I foresee difficulty in making my dwarves equip such new weapons.  So, as you suggest, everything requiring a quiver will be making use of the crossbow skill.  Beggars can't be choosers, ya know?

Gonna test making those other smelter reactions now that I have a break between classes.

EDIT:
Okay, so I tested the theory regarding class paths, and apparently got it wrong.
I attempted two guesses:
[PRODUCT:100:1:ITEM:ITEM_AMMO_PISTOL:METAL:IRON]
and
[PRODUCT:100:1:ITEM_AMMO:ITEM_AMMO_PISTOL:METAL:IRON]

Also, both reactions have an addition 'safe' product, which was cut and pasted from the defaults:
[PRODUCT:100:3:BAR:NO_SUBTYPE:COAL:COKE]
which appears after the product I'm trying to test.

When I perform the operation at the smelter, I'm left with 3 bars of coke each time, and nothing else.  Same results for both versions of the reaction.

Any ideas?

EDIT2:
Okay.  I found the problem.  It resided somewhere between the keyboard and the chair, and above the collar.  I was using ITEM as my token, instead of AMMO.  Duh.
« Last Edit: January 12, 2009, 01:31:09 pm by DaveLawson »
Logged