I'm frustrated that autosyndrome ignores probability in reaction products. So, y'know, I'm fixing that, and right now I'm elbows deep in DFHack and DF memory accesses. If I don't have any distractions, then expect a report in a few hours.
Yeah, I always found that odd. I had to use funky workarounds that add many new reactions to simulate this lower percantage.
Rejoice! Funky workarounds are now a thing of the past, as we now have
probability-syndrome. This is a ruby script for DFHack, and an accompanying inorganic file that supports it. To use probability-syndromes, we just use the special INORGANIC:PROBABILITY_TABLE stone as a reaction product:
[PRODUCT:100:1:BOULDER:NONE:INORGANIC:PROBABILITY_TABLE]
Now let's say that we want there to be a 20% chance each of an an elf siege:
[PRODUCT:100:1:BOULDER:NONE:INORGANIC:PROBABILITY_TABLE]
[PRODUCT:20:1:BOULDER:NONE:INORGANIC:SIEGE_ELF]
Pretty nifty, right? It gets better; we could have a 20% chance a siege from the four great races, and a 20% chance of nothing. Only *one* of these events will trigger, so you'll never end up being double-sieged:
[PRODUCT:100:1:BOULDER:NONE:INORGANIC:PROBABILITY_TABLE]
[PRODUCT:20:1:BOULDER:NONE:INORGANIC:SIEGE_ELF]
[PRODUCT:20:1:BOULDER:NONE:INORGANIC:SIEGE_HUMAN]
[PRODUCT:20:1:BOULDER:NONE:INORGANIC:SIEGE_DWARF]
[PRODUCT:20:1:BOULDER:NONE:INORGANIC:SIEGE_DROW]
This means we can now do things like have a reaction with a 90% chance of doing something nice, and a 10% chance of doing something nasty:
[PRODUCT:100:1:BOULDER:NONE:INORGANIC:PROBABILITY_TABLE]
[PRODUCT:90:1:BOULDER:NONE:INORGANIC:SOMETHING_NICE]
[PRODUCT:10:1:BOULDER:NONE:INORGANIC:SOMETHING_NASTY]
So, I know what you're thinking... What do those inorganics actually look like?
[INORGANIC:SIEGE_ELF]
[USE_MATERIAL_TEMPLATE:STONE_VAPOR_TEMPLATE]
[SYNDROME]
[SYN_CLASS:\AUTO_SYNDROME]
[SYN_CLASS:\COMMAND]
[SYN_CLASS:probability-syndrome][SYN_CLASS:cmd]
[SYN_CLASS:force]
[SYN_CLASS:siege]
[SYN_CLASS:FOREST]
In other words, they're the DFHack command you want to run (along with arguments), but with '[SYN_CLASS:\AUTO_SYNDROME] [SYN_CLASS:\COMMAND] [SYN_CLASS:probability-syndrome] [SYN_CLASS:cmd]', at the front. This sequence of tags fires off AutoSyndrome (which we need because it cleans up the rocks for us), but delegates the command itself to probability-syndrome. The PROBABILITY_TABLE inorganic actually does the heavy lifting, as it's what inspects the reaction products and decides what to actually fire.
Currently, you can
only use probability-syndrome to run commands, and right now the \REACTION_INDEX, \WORKER_ID, and \LOCATION tags from AutoSyndrome don't work in probability-syndrome commands. There's no technical limitation stopping us there, I just haven't written the code yet. (Patches welcome!) Probability-syndrome has only been tested under DFHack r4; I don't believe that r3 has the necessary df.dfhack_run() method available.
Probability-syndrome is already part of the
Masterwork Dwarf Fortress: Studded With Patches master branch, but I'll also be bundling this up into a standalone zip which I'll post on the DF Modders' board, because I'm sure others will find this useful.
And now,
finally, I can have those orcish raids trigger sieges, without having to write an inorganic for every one.
~ T