Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: [Custom reaction] Reagents don't end up as product  (Read 560 times)

Whitefang

  • Escaped Lunatic
  • [PREFSTRING:lazy nature]
    • View Profile
[Custom reaction] Reagents don't end up as product
« on: April 06, 2018, 03:46:55 am »

Code: [Select]
[REACTION:EXTRACT_BLOOD]
[NAME:Extract blood from meat]
[BUILDING:BLOODFORGE:CUSTOM_E]
[REAGENT:A:5:MEAT:NONE:NONE:NONE][UNROTTEN]
[REAGENT:B:1:SMALLGEM:NO_SUBTYPE:INORGANIC:ENERGY_GEM]
[REAGENT:barrel:1:NONE:NONE:NONE:NONE][FOOD_STORAGE_CONTAINER]
[EMPTY]
[PRESERVE_REAGENT]
[DOES_NOT_DETERMINE_PRODUCT_AMOUNT]
[PRODUCT:100:600:LIQUID_MISC:NONE:GET_MATERIAL_FROM_REAGENT:A:BLOOD]
[PRODUCT_TO_CONTAINER:barrel]
[PRODUCT_DIMENSION:600]
[SKILL:ALCHEMY]

Note: The BLOODFORGE is a custom workshop, and the ENERGY_GEM is a custom gem required for all reactions using the blood forge (it must be cut, hence SMALLGEM), and both are working properly.

The idea behind this reaction is that a dwarf is supposed to bring five units of meat/prepared organs, a barrel, and a cut crystallized energy gem to the blood forge for extraction, resulting in only a barrel filled with four units of blood.

I've fiddled around with it a lot, though, and I can't seem to get it working properly. A dwarf with the alchemy labor enabled will bring the meat, barrel, and gem to the blood forge as they should, they'll begin working, but once they finish, I'll inspect the workshop with [t] and notice that all the reagents are still there. It does not result in a barrel of four units of blood. I'm a bit stumped; reactions are still something I'm a tad bit unfamiliar with, and I've not much time left tonight to test numerous fixes and/or breakages. Perhaps there's something simple I'm overlooking with this. I'm pretty much positive it's something to do with the [PRODUCT:whatever:whatever:who cares:blah] part, since that's the part giving me problems, but I'm not sure what is the problem.

Either way, I'd like to get this sorted out and find out what it is I've done wrong. Reactions are something I'm still learning.
« Last Edit: April 06, 2018, 03:50:55 am by Whitefang »
Logged

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: [Custom reaction] Reagents don't end up as product
« Reply #1 on: April 06, 2018, 06:37:43 pm »

There are at least 2 problems:

1. GET_MATERIAL_FROM_REAGENT doesn't know how to link a creature's "muscle" material to its "blood" material - in order to do that, you need to edit all of the various meat/organ material templates and add "[MATERIAL_REACTION_PRODUCT:BLOOD_MAT:LOCAL_CREATURE_MAT:BLOOD]" (and change your PRODUCT to reference "BLOOD_MAT" instead of "BLOOD").
2. Your PRODUCT is trying to produce 2400 units of liquid, which is definitely wrong - you want the PRODUCT's item count to be 4 (e.g. "[PRODUCT:100:4:etc]") and the PRODUCT_DIMENSION to be 150.

There's also the fact that your reaction will be able to take meat from up to 5 different types of creatures, but it will only produce blood corresponding to one of them, but I'm guessing you already know about that.
Logged
P.S. If you don't get this note, let me know and I'll write you another.
It's amazing how dwarves can make a stack of bones completely waterproof and magmaproof.
It's amazing how they can make an entire floodgate out of the bones of 2 cats.

Whitefang

  • Escaped Lunatic
  • [PREFSTRING:lazy nature]
    • View Profile
Re: [Custom reaction] Reagents don't end up as product
« Reply #2 on: April 06, 2018, 08:52:00 pm »

2400 units? Ouch. Yeah, that's definitely not right at all. I thought since one unit of liquid is 150, I'd have to quadruple it to make four units. That's my bad.

And yeah, I knew about the thing with it taking meat from up to 5 different creatures and only outputting blood from one of them, but I don't really mind. If it starts to bug me, I can just make some little tweaks.

What you told me did the trick, my reaction is doing just as it should, which is great! But after I added "[MATERIAL_REACTION_PRODUCT:BLOOD_MAT:LOCAL_CREATURE_MAT:BLOOD]" to all the meat and organ materials, I noticed DF spat all this http://www.mediafire.com/file/h3g7xz85ensxkth/errorlog.txt out at me in the errorlog, which worries me. It doesn't seem to cause a crash (I think, I haven't really tested it all that long), but it does lag the game.

The borked creatures mostly (all?) seem to be ones with ichor and other things like goo rather than regular blood. I assume the forgotten beasts and clowns brought up in the errorlog have ichor/other stuff too, but I have compressed saves turned on, so I can't exactly poke at their raws to check.
« Last Edit: April 06, 2018, 08:57:29 pm by Whitefang »
Logged