Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Reaction Question: use always the same bar when multiple bars are required?  (Read 944 times)

Urist McGoombaBrother

  • Bay Watcher
  • Trust the plump helmet! ♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠
    • View Profile

So there is a basic reaction requiring three bars of metal:

[REACTION:MAKE_SOMETHING]
[NAME:make metal something]
[BUILDING:METALSMITH:NONE]
[REAGENT:bar:450:BAR:NONE:INORGANIC:NONE]
[PRODUCT:100:1:TOOL:SOMETHING:GET_MATERIAL_FROM_REAGENT:bar:NONE]
[SKILL:METALCRAFT]

Usually the dwarfs go ahead and pick any three bars of metal, while the first they pick defines the material of the product. Now I do like to restrict the reaction, so dwarfs can pick any metal bar, but it has to be three times the same. That means allowed are e.g. three bars of copper or three bars of iron or three bars of gold, etc. Not allowed is one bar of copper, one bar of iron and one bar of gold or two of a kind plus one of another kind. Is it possible to make such a restriction right within the reaction?

Button

  • Bay Watcher
  • Plants Specialist
    • View Profile

Short answer: No.

Long answer: Sort of.

At the moment, the only way to do this is to create separate reactions for each different reagent. So, MAKE_COPPER_SOMETHING, MAKE_GOLD_SOMETHING, MAKE_SILVER_SOMETHING, MAKE_IRON_SOMETHING, etc.

With the new reaction menus, cluttering up the reaction menus is less of a concern, so these sorts of extremely specific reactions are now feasible.
Logged
I used to work on Modest Mod and Plant Fixes.

Always assume I'm not seriously back

sv-esk

  • Bay Watcher
  • sorry for my bad english
    • View Profile

You can make stockpile for specific type of bars and link it to workshop. Also, DFHack has reaction menu (gui/workshop-job), it is binded to Alt-A by default.
Logged

Button

  • Bay Watcher
  • Plants Specialist
    • View Profile

Although, this may be possible in 42.06, which was just released!
Logged
I used to work on Modest Mod and Plant Fixes.

Always assume I'm not seriously back

Urist McGoombaBrother

  • Bay Watcher
  • Trust the plump helmet! ♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠
    • View Profile

Thx for all your replies. Actually the background is to prevent cheating/abusing the system. Let's say you are in urgent need of steel and have only one single bar and there exists a reaction requiring 10 bars of any metal. Then you can go ahead and let it use the steel as first material and fill the other nine pieces with cheap copper, lead or any other expendable material. Still the final product will be made of steel. When you melt it down, you will end up with more steel than you had before. When all ten bars need to be the same material, there won't be any miraculous material transformation.

At the moment, the only way to do this is to create separate reactions for each different reagent. So, MAKE_COPPER_SOMETHING, MAKE_GOLD_SOMETHING, MAKE_SILVER_SOMETHING, MAKE_IRON_SOMETHING, etc.

I fear that's only feasable, when you have a handful of basic reactions. When we are talking about dozends or more basic reactions and you have to multiply them with all possible metals, stones or other materials. That will end up in hundreds or even thousands of individual reactions. And then there are still missing all materials available via mods.

Bogus

  • Bay Watcher
    • View Profile

i wrote an addon that does pretty much that, it creates reactions and the menu structure for them based on a relativly simple lua table. you can use a reaction as template and fill in wildcards like material type through the menu ingame. the thing with the bars is easy to do. it also supports submenus and multiple wildcards (like for item type). it likely at this point only works for custom workshops, if it works at all, and you have to replace the whole shop menu. ie any reactions you already have in the shop need to be registered in the lua table.

there are still a few problems with the code and i didnt work on it for a couple of month. it also ran on the last df version, i dont know if it will easily transfer to the new one. if you are interested, i can upload the code to my github and you can look at it yourself. you may even be able to run it without changing anything. needs dfhack to run.
« Last Edit: March 06, 2016, 05:52:36 am by Bogus »
Logged

IndigoFenix

  • Bay Watcher
  • All things die, but nothing dies forever.
    • View Profile
    • Boundworlds: A Browser-Based Multiverse Creation and Exploration Game

Alternatively, you can create a metal tool that uses the regular Forge (which takes metal bars of the same type), and then use that tool in the reaction.

Urist McGoombaBrother

  • Bay Watcher
  • Trust the plump helmet! ♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠♠
    • View Profile

Many thx for your help. I intended this for a mod. So it should be running on vanilla DF without DF Hack or other utilities.

When specifiying the details for a material with the implemented upgrades to work orders in DF v42.06, that seems be handled this way. However, details are currently not selectable with all custom reactions like for stone. But maybe that get's fixed as well.