Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 129 130 [131] 132 133 ... 137

Author Topic: [MODDING] 0.43.x QUESTIONS THREAD  (Read 204620 times)

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: [MODDING] 0.43.x QUESTIONS THREAD
« Reply #1950 on: October 15, 2017, 07:45:36 am »

Hugo_The_Dwarf

  • Bay Watcher
  • Modding Mentor
    • View Profile
    • Regeneration: Forced Evolution
Re: [MODDING] 0.43.x QUESTIONS THREAD
« Reply #1952 on: October 15, 2017, 12:28:44 pm »

Question regarding reactions - how would I make a reaction that creates a drinkable elixir of some kind and automatically puts it into a waterskin/barrel?

I have a basic idea, I just dont know how to actually make it without having the drink splatter onto the floor when the reaction is done.

This is a old reaction of mine, but you should be able to reference it as an example.

Spoiler (click to show/hide)
Logged

ZM5

  • Bay Watcher
  • Accomplished RAW Engineer
    • View Profile
    • Steam
Re: [MODDING] 0.43.x QUESTIONS THREAD
« Reply #1953 on: October 15, 2017, 12:34:51 pm »

Question regarding reactions - how would I make a reaction that creates a drinkable elixir of some kind and automatically puts it into a waterskin/barrel?

I have a basic idea, I just dont know how to actually make it without having the drink splatter onto the floor when the reaction is done.

This is a old reaction of mine, but you should be able to reference it as an example.

Spoiler (click to show/hide)
Thanks a lot, I really needed that! Still new to reaction modding.

Amostubal

  • Bay Watcher
    • View Profile
Re: [MODDING] 0.43.x QUESTIONS THREAD
« Reply #1954 on: October 26, 2017, 10:57:16 am »

alright I was working on a reaction and realized something horrible in this line:
   [REAGENT:A:10:BOULDER:NONE:INORGANIC:NONE]
      [WORTHLESS_STONE_ONLY]

Okay I've used it before for somethings that just get rid of the stone, but in the current case I want it to actually grab the the material from the reagent, for the new product, and later be able to break that product and get the boulders back... the issue is that when I do it this way, it gives me 10 random stone unless I set it in the details to the stone I want it to be.  This isn't an issue except when the first stone is say inorganic:gold , and suddenly it has converted 9 non gold stones along with it into a potential 10 stack of boulder:none:inorganic:gold.

the question is, has anyone discovered a way to get it to randomly select only one type of boulder without detail?

... or a way to force the player to choose in the details the boulder otherwise voiding the process?  I'd even consider DFHack solutions on this one, which i have a good idea of how to block it if its 10 different stones I just would rather not have the 1 additional script to keep this from "cheating" the game.
Logged
Legendary Dwarf Fortress
Legendary Discord Group
"...peering into the darkness behind the curtains, evokes visions of pixies being chased by dragons while eating cupcakes made of coral iced with liquid fire while their hearts burn out with unknown plant substances..." - a quote from the diaries of Amostubal

overseer05-15

  • Bay Watcher
  • Personal Text
    • View Profile
Re: [MODDING] 0.43.x QUESTIONS THREAD
« Reply #1955 on: October 26, 2017, 11:06:11 am »

Wouldn't you want to [GET_MATERIAL_FROM_REAGENT] instead of random stone?
Logged
adult food like, I presume, steak and potatoes and tax forms,

My game giveaway

Amostubal

  • Bay Watcher
    • View Profile
Re: [MODDING] 0.43.x QUESTIONS THREAD
« Reply #1956 on: October 26, 2017, 11:56:51 am »

Wouldn't you want to [GET_MATERIAL_FROM_REAGENT] instead of random stone?

That's the point.

Code: [Select]
[REAGENT:A:10:BOULDER:NONE:INORGANIC:NONE]
[WORTHLESS_STONE_ONLY]
[PRODUCT:100:1:TOOL:PILE_OF_STONE:GET_MATERIAL_FROM_REAGENT:A:NONE]

so this allows any 10 stones to be picked up and converted into a Pile of stone that has the material of the first random stone picked up...

then:
Code: [Select]
[REAGENT:A:1:TOOL:PILE_OF_STONE:INORGANIC:NONE]
[WORTHLESS_STONE_ONLY]
[PRODUCT:100:10:BOULDER:NONE:GET_MATERIAL_FROM_REAGENT:A:NONE]

basically breaks the Pile of stone into 10 boulders of the material of the pile of stone.

issue is that the first reaction may grab say 1 gold nuggets and 9 microline; converting them into a gold pile of stone; which then is broken into 10 gold nuggets.  I don't want that to happen, but I don't want to write an individual reaction for each boulder.  I never worried about this problem before because I only designed these to do say sell reactions that would just give a pile of gold coins instead of a pile of stone... this time I wanted to design a storage system... but this one thing is causing issues because it destroys integrity of the storage by allowing materials to be accidentally(or intentionally) converted into other materials.

I was wondering if anyone had discovered a way to force only one type of boulder to be used without breaking the ability to target any type? the detail can be set, forcing it to only grab one type, but if its not set, is there a way to enforce that all boulders be one type?
Logged
Legendary Dwarf Fortress
Legendary Discord Group
"...peering into the darkness behind the curtains, evokes visions of pixies being chased by dragons while eating cupcakes made of coral iced with liquid fire while their hearts burn out with unknown plant substances..." - a quote from the diaries of Amostubal

Hugo_The_Dwarf

  • Bay Watcher
  • Modding Mentor
    • View Profile
    • Regeneration: Forced Evolution
Re: [MODDING] 0.43.x QUESTIONS THREAD
« Reply #1957 on: October 26, 2017, 12:15:57 pm »

alright I was working on a reaction and realized something horrible in this line:
   [REAGENT:A:10:BOULDER:NONE:INORGANIC:NONE]
      [WORTHLESS_STONE_ONLY]

Okay I've used it before for somethings that just get rid of the stone, but in the current case I want it to actually grab the the material from the reagent, for the new product, and later be able to break that product and get the boulders back... the issue is that when I do it this way, it gives me 10 random stone unless I set it in the details to the stone I want it to be.  This isn't an issue except when the first stone is say inorganic:gold , and suddenly it has converted 9 non gold stones along with it into a potential 10 stack of boulder:none:inorganic:gold.

the question is, has anyone discovered a way to get it to randomly select only one type of boulder without detail?

... or a way to force the player to choose in the details the boulder otherwise voiding the process?  I'd even consider DFHack solutions on this one, which i have a good idea of how to block it if its 10 different stones I just would rather not have the 1 additional script to keep this from "cheating" the game.

Wouldn't you want to [GET_MATERIAL_FROM_REAGENT] instead of random stone?

For a reaction as generic as that, no. No way to say "From this 1 item, make sure the following ones match 1st grabbed" and to comment on overseer's suggestion in one go [GET_MATERIAL_FROM_REAGENT] is only for [PRODUCT]s in a reaction, and normally targets a reagent's UID (Unique ID) and the MATERIAL_REACTION_PRODUCT id(or NONE for the reagent's material)

If you want something like take 10 Gold containing rocks and make X that reaction will have to be geared towards that since Boulder's don't stack and even if they did you don't know if a stack of 9 gold boulders and a single stack of gabbro would be pulled in (which comes right round to your 1 to 9 other boulder issue, only with stacks)

This is something that takes designing, and if it's really complex and numerous a personal app or already designed modding tool to take a reaction template and generate the reactions for you, but more reactions means a more cluttered workshop screen however thanks to CATEGORIES this is no longer a real issue anymore

So if you want a generic reaction that does what you want, I think DF-Hack may be able to do it (I don't do anything with DF-Hack other than to use it for quality of life features)

I believe I saw you on ZM5's DF server so you can ping me in the modding area if you want more help/explanation that's more detailed

EDIT:

Apologies there is one other way that this can be done. Looping back to Overseer's comment as his works in this case

Have your reaction split the reagent from 1 call to 10 separate calls, with 1 separate products, but each product gets its material from it's corresponding reagent

EDIT2:
Oops idk why I glazed over the fact you wanted a 10:1 ratio and not a 1:1
« Last Edit: October 26, 2017, 12:39:03 pm by Hugo_The_Dwarf »
Logged

Amostubal

  • Bay Watcher
    • View Profile
Re: [MODDING] 0.43.x QUESTIONS THREAD
« Reply #1958 on: October 26, 2017, 01:56:36 pm »

a simple dfhack script that accomplishes a cancel of the job if it doesn't have details set... wont initiate until after one exits a shop and lets time flow.
Code: [Select]
-- CombineReactions
local usage = [====[

CombineReactions
==================
Script to manage onJobInitiated listener for Combining Reactions that
must have details set.  It just checks the reactions that its told to check
for when onJobInitiated and cancels it if its details are not set, this stops
it from combining items in a way that cheats the game.

Arguments::
    -register [ list of reaction names ]

As many reactions as are desired to be targetted can be added to the line
indefinitely.  list is not saved nor reloaded autmatically, so should be
called in OnMapLoad.init
]====]

local utils=require 'utils'

validArgs = validArgs or utils.invert ({
 'register'
})

local args = utils.processArgs({...}, validArgs)

local JobList = {}

if ... then
  for i,_ in ipairs(args.register) do
    JobList[_]=true
  end
else
  error("no variables")
end

CROJI = require('plugins.eventful')
CROJI.enableEvent(CROJI.eventType.JOB_INITIATED,1)
CROJI.onJobInitiated.CombineReactions_OJI = function(job)
  if JobList[job.reaction_name] and job.mat_index == -1 then
    dfhack.gui.showAnnouncement("The job: "..dfhack.job.getName(job)..", is canceled, please set details.", COLOR_RED)
    dfhack.job.removeJob(job)
  end
end

there... I just didn't want to go that far.

edit: fixed the loader part it wasn't functioning correctly.
« Last Edit: October 26, 2017, 04:18:58 pm by Amostubal »
Logged
Legendary Dwarf Fortress
Legendary Discord Group
"...peering into the darkness behind the curtains, evokes visions of pixies being chased by dragons while eating cupcakes made of coral iced with liquid fire while their hearts burn out with unknown plant substances..." - a quote from the diaries of Amostubal

ZM5

  • Bay Watcher
  • Accomplished RAW Engineer
    • View Profile
    • Steam
Re: [MODDING] 0.43.x QUESTIONS THREAD
« Reply #1959 on: October 26, 2017, 05:44:44 pm »

What would be the proper tokens for a reaction that requires a waterskin and can be made from any two plant alcohols?

Aranador

  • Bay Watcher
    • View Profile
Re: [MODDING] 0.43.x QUESTIONS THREAD
« Reply #1960 on: October 26, 2017, 06:22:20 pm »

well,  Do you want the alcohol to go into the waterskin?
« Last Edit: October 26, 2017, 06:25:04 pm by Aranador »
Logged

Hugo_The_Dwarf

  • Bay Watcher
  • Modding Mentor
    • View Profile
    • Regeneration: Forced Evolution
Re: [MODDING] 0.43.x QUESTIONS THREAD
« Reply #1961 on: October 26, 2017, 06:39:37 pm »

What would be the proper tokens for a reaction that requires a waterskin and can be made from any two plant alcohols?

Item type is FLASK (Flasks made from leather are waterskins)
If you want the reagent to be JUST waterskins (and not any metal ones aka flasks) use [ANY_LEATHER_MATERIAL]
probably want [EMPTY] as well and [PRESERVE_REAGENT]
Logged

Baffler

  • Bay Watcher
  • Caveat Lector.
    • View Profile
Re: [MODDING] 0.43.x QUESTIONS THREAD
« Reply #1962 on: October 28, 2017, 06:38:07 pm »

Does the [FREQUENCY] token work when applied to trees?
Logged
Quote from: Helgoland
Even if you found a suitable opening, I doubt it would prove all too satisfying. And it might leave some nasty wounds, depending on the moral high ground's geology.
Location subject to periodic change.
Baffler likes silver, walnut trees, the color green, tanzanite, and dogs for their loyalty. When possible he prefers to consume beef, iced tea, and cornbread. He absolutely detests ticks.

Hugo_The_Dwarf

  • Bay Watcher
  • Modding Mentor
    • View Profile
    • Regeneration: Forced Evolution
Re: [MODDING] 0.43.x QUESTIONS THREAD
« Reply #1963 on: October 28, 2017, 08:11:30 pm »

I want to say yes, and Trees are still a PLANT object. But someone else can correct me
Logged

scamtank

  • Bay Watcher
    • View Profile
Re: [MODDING] 0.43.x QUESTIONS THREAD
« Reply #1964 on: October 29, 2017, 12:14:14 am »

Does the [FREQUENCY] token work when applied to trees?

Sure does.
Logged
Pages: 1 ... 129 130 [131] 132 133 ... 137