Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 201 202 [203] 204 205 ... 360

Author Topic: DFHack 0.43.03-r1  (Read 1079092 times)

Blind Wolf

  • Bay Watcher
  • [EXTRAVISION]
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #3030 on: September 01, 2015, 08:04:23 pm »

Hello anon >.> and you can artifake one into existence. https://github.com/maxthyme/dfstuff/blob/master/artifake.lua
I've been fiddling with that for a little while, and I can easily get an artifact slab, but how can I set it to function as a secret/necromancy slab?
Logged

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #3031 on: September 01, 2015, 09:55:45 pm »

Oh, well I went and checked, this is just using a regular createitem slab btw.

Spoiler (click to show/hide)
Logged

expwnent

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #3032 on: September 02, 2015, 08:07:24 am »

I'm having a bit of trouble with the add-syndrome script in modtools. I'll admit I'm a beginner at using dfhack in this way, so if I wanted to add a syndrome to turn my adventurer into a mist thrall/husk, how would I go about doing that?

I don't really care if you just tell me how to do it or give me a direct command to put into the console but I would really appreciate some help on this one.

Unfortunately, you can only deal with syndromes that have names using add-syndrome. Autogenerated ones like vampirism and husks don't have names.
Logged

Atomic Chicken

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #3033 on: September 02, 2015, 03:45:42 pm »

I need some help with reaction-product-trigger. I've written this script, taxidermy.lua, which is meant to be used in a reaction which takes a corpse or vermin remains and produces a statue or figurine. The script targets the corpse reagent, obtain histfig or race,caste ids from it, and then alters the statue so that the statue appears to correspond to the corpse (i.e. corpse of a cat -> statue of a cat). As it is, the script works as intended, as long as the only reagent used is the corpse. I was wondering if it is possible to use reaction-product-trigger in this way when multiple reagents are present, and if so what alterations need to be done to my own script to ensure proper functioning.

The script so far:

Code: [Select]
-- taxidermy.lua
-- by Atomic Chicken

local utils = require 'utils'

validArgs = validArgs or utils.invert({
 'corpse_id',
 'statue_id',
 'record_name',
 'help'
})
local args = utils.processArgs({...}, validArgs)

if args.help then
 print([[ taxidermy.lua
 This script is designed to work with a reaction that takes a corpse and produces one statue of any material.

 arguments:
 
 -corpse_id
The item id of the corpse you wish to "stuff".
If used in conjunction with reaction-product-trigger, this takes \\INPUT_ITEMS

 -statue_id
The item id of the statue produced in the reaction.
If used in conjunction with reaction-product-trigger, this takes \\OUTPUT_ITEMS

 -record_name
If this optional argument is included, the script will check whether the corpse was from a named historical figure,
and if so describes the statues as being "of [creature's name]" rather than "of [creature's race]".

  To use:
 
 Create a file called "onLoad.init" in Dwarf Fortress/raw if one does not already exist.
 Enter the following:
  modtools/reaction-product-trigger -reactionName YOUR_REACTION -command [ taxidermy -corpse_id \\INPUT_ITEMS -statue_id \\OUTPUT_ITEMS -record_name ]
 Replace "YOUR_REACTION" with whatever your reaction is called.
 ]])
 return
end

if not args.corpse_id then
error 'ERROR: Corpse id not specified.'
end

if not args.statue_id then
error 'ERROR: Statue id not specified.'
end

corpse = df.item.find(tonumber(args.corpse_id))
statue = df.item.find(tonumber(args.statue_id))

if corpse ~= nil and statue ~= nil then

if args.record_name
and corpse:getType() ~= df.item_type.REMAINS
and corpse.hist_figure_id ~= -1 then
unit_id = corpse.unit_id
unit = df.unit.find(unit_id)
if unit.name.has_name == true then
target_desc_name = dfhack.TranslateName(dfhack.units.getVisibleName(unit))

dfhack.timeout(1,'ticks',function()
statue.description = ''..target_desc_name..''

for _,artchunk in ipairs(df.global.world.art_image_chunks) do
if artchunk.id == statue.image.id then

statue_image = artchunk.images[statue.image.subid]
end
end

while #statue_image.elements > 0 do
statue_image.elements:erase(#statue_image.elements-1)
end

while #statue_image.properties > 0 do
statue_image.properties:erase(#statue_image.properties-1)
end

newart=df.art_image_element_creaturest:new()
statue_image.elements:insert("#",newart)

statue_image.elements[0].histfig = corpse.hist_figure_id

statue_image.mat_type = -1
statue_image.mat_index = -1
end)
end

else

raceindex = corpse.race
casteindex = corpse.caste
target_desc = df.global.world.raws.creatures.all[raceindex].caste[casteindex].caste_name[0]

dfhack.timeout(1,'ticks',function()
statue.description = 'a '..target_desc..''

for _,artchunk in ipairs(df.global.world.art_image_chunks) do
if artchunk.id == statue.image.id then
statue_image = artchunk.images[statue.image.subid]
end
end

while #statue_image.elements > 0 do
statue_image.elements:erase(#statue_image.elements-1)
end

while #statue_image.properties > 0 do
statue_image.properties:erase(#statue_image.properties-1)
end

newart=df.art_image_element_creaturest:new()
statue_image.elements:insert("#",newart)

statue_image.elements[0].race = raceindex
statue_image.elements[0].caste = casteindex
statue_image.elements[0].count = 1

statue_image.mat_type = -1
statue_image.mat_index = -1

end)
end
end

In onLoad.init:
Code: [Select]
modtools/reaction-product-trigger -reactionName TAXIDERMY -command [ taxidermy -corpse_id \\INPUT_ITEMS -statue_id \\OUTPUT_ITEMS -record_name ]
Logged
As mentioned in the previous turn, the most exciting field of battle this year will be in the Arstotzkan capitol, with plenty of close-quarter fighting and siege warfare.  Arstotzka, accordingly, spent their design phase developing a high-altitude tactical bomber. 

expwnent

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #3034 on: September 02, 2015, 07:12:10 pm »

The simplest way to do it is to have a helper script extract the first reagent and product.

Code: [Select]
modtools/reaction-product-trigger -reactionName TAXIDERMY -command [ taxidermy-helper -inputs [ \\INPUT_ITEMS ] -outputs [ \\OUTPUT_ITEMS ] -record_name ]

(note the extra brackets)

Code: [Select]
--taxidermy-helper.lua
local utils = require 'utils'

validArgs = utils.invert({
 'inputs',
 'outputs',
 'record_name'
})
local args = utils.processArgs({...}, validArgs)

--put error checking here

local commandstr = 'taxidermy -corpse_id ' .. args.inputs[1] .. ' -statue_id ' .. args.outputs[1]
if args.record_name then
  commandstr = commandstr .. ' -record_name'
end
dfhack.run_command(commandstr)

Logged

mifki

  • Bay Watcher
  • works secretly...
    • View Profile
    • mifki
Re: DFHack 0.40.24-r3
« Reply #3035 on: September 03, 2015, 05:59:59 am »

Is -r4 planned? Need to find time to submit a bunch of df structures patches before that.

PeridexisErrant

  • Bay Watcher
  • Dai stihó, Hrasht.
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #3036 on: September 03, 2015, 06:55:41 am »

Is -r4 planned? Need to find time to submit a bunch of df structures patches before that.

I would also like to know, since I'm thinking of adding Vjek's scripts.
Logged
I maintain the DF Starter Pack - over a million downloads and still counting!
 Donations here.

Atomic Chicken

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #3037 on: September 03, 2015, 07:33:25 am »

Spoiler (click to show/hide)
Thanks!
Logged
As mentioned in the previous turn, the most exciting field of battle this year will be in the Arstotzkan capitol, with plenty of close-quarter fighting and siege warfare.  Arstotzka, accordingly, spent their design phase developing a high-altitude tactical bomber. 

expwnent

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #3038 on: September 03, 2015, 08:08:40 am »

I would like to do one more release before the next DF release, yes.
Logged

expwnent

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #3039 on: September 03, 2015, 08:09:06 am »

Spoiler (click to show/hide)
Thanks!

Sure. Glad to see modtools stuff getting used.
Logged

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #3040 on: September 03, 2015, 03:23:24 pm »

Roses, the add_attack script seems to work in fort mode.  I stripped out the error-checking because it's used internally, but the guts function as intended.

Even the dwarf who was the victim of the first induced attack seemed exited to see things working so well!



Sometimes, these guys bother me.
Logged
Just got back, updating:
(0.42 & 0.43) The Earth Strikes Back! v2.15 - Pay attention...  It's a mine!  It's-a not yours!
(0.42 & 0.43) Appearance Tweaks v1.03 - Tease those hippies about their pointy ears.
(0.42 & 0.43) Accessibility Utility v1.04 - Console tools to navigate the map

TheFlame52

  • Bay Watcher
  • Master of the randomly generated
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #3041 on: September 03, 2015, 04:42:25 pm »

Is there anywhere else in a creature besides the main screen and the soul that gender/caste is stored?

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #3042 on: September 03, 2015, 04:49:37 pm »

hist fig

TheFlame52

  • Bay Watcher
  • Master of the randomly generated
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #3043 on: September 03, 2015, 04:54:29 pm »

What menu is that under? I can't find it. Is it 'hist_figure_id'?
« Last Edit: September 03, 2015, 04:57:54 pm by TheFlame52 »
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #3044 on: September 03, 2015, 05:07:52 pm »

df.historical_figure.find(hist_fig_id) will get you the hist fig given the hist_fig_id (which for a unit will be unit.hist_fig_id)
Pages: 1 ... 201 202 [203] 204 205 ... 360