Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 2 [3] 4

Author Topic: More Ways to Enjoy Corpses  (Read 10226 times)

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: More Ways to Enjoy Corpses
« Reply #30 on: August 31, 2015, 01:36:04 pm »

Bad news:

Code: [Select]
...sktop\The Shire\Dwarf Fortress Shire\hack\lua\dfhack.lua:454: ...he Shire\Dwarf Fortress Shire/hack/scripts/taxidermy.lua:110: <eof> expected near 'end'
stack traceback:
        [C]: in function 'error'
        ...sktop\The Shire\Dwarf Fortress Shire\hack\lua\dfhack.lua:454: in function <...sktop\The Shire\Dwarf Fortress Shire\hack\lua\dfhack.lua:425>
        (...tail calls...)
        [C]: in function 'runCommand'
        ...sktop\The Shire\Dwarf Fortress Shire\hack\lua\dfhack.lua:479: in function '_run_command'
        ...sktop\The Shire\Dwarf Fortress Shire\hack\lua\dfhack.lua:494: in function 'run_command'
        ...Shire/hack/scripts/modtools/reaction-product-trigger.lua:63: in function 'afterProduce'
        ...Shire/hack/scripts/modtools/reaction-product-trigger.lua:76: in function <...Shire/hack/scripts/modtools/reaction-product-trigger.lua:67>
[DFHack]#

This is using the new script you posted.

Reaction:
Code: [Select]
[REACTION:TAXIDERMY]
[NAME:stuff a corpse (statue)]
[BUILDING:CRAFTSMAN:CUSTOM_SHIFT_T]
[REAGENT:corpse:1:CORPSE:NONE:NONE:NONE][USE_BODY_COMPONENT]
[PRODUCT:100:1:STATUE:NONE:GET_MATERIAL_FROM_REAGENT:corpse:NONE]
[SKILL:TANNER]

Onload.init:
Code: [Select]
modtools/reaction-product-trigger -reactionName TAXIDERMY -command [ taxidermy -corpse_id \\INPUT_ITEMS -statue_id \\OUTPUT_ITEMS -record_name ]
As a side note: The material used is "muscle". I used a ram corpse and got "This is a sliced muscle statue of Tax, the deity of wealth and trading."

Corpses of civ-members are not used at all, which is normal DF behaviour, since they are not valid items for reactions, they can only be buried. The same holds true for itemcorpses, if your dwarf dies and leaves a statue as itemcorpse, the statue is buried.
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

Atomic Chicken

  • Bay Watcher
    • View Profile
Re: More Ways to Enjoy Corpses
« Reply #31 on: September 01, 2015, 03:11:39 am »

Code: [Select]
...sktop\The Shire\Dwarf Fortress Shire\hack\lua\dfhack.lua:454: ...he Shire\Dwarf Fortress Shire/hack/scripts/taxidermy.lua:110: <eof> expected near 'end'

Wooops, I guess I uploaded the wrong version; the only problem here was that I'd forgotten to remove the last two "end" statements. Fixed, try again.

As a side note: The material used is "muscle". I used a ram corpse and got "This is a sliced muscle statue of Tax, the deity of wealth and trading."
That's interesting; I simply left the product with no material to keep things simple during tests. The script does not affect statue material; that's determined by the usual reaction code. Is this a problem, or is there a particular material that you'd prefer? Setting creature materials via dfhack is possible, but is a huge hassle.

Maybe you could make a standard material be used instead of using GET_MATERIAL_FROM_REAGENT?

Corpses of civ-members are not used at all, which is normal DF behaviour, since they are not valid items for reactions, they can only be buried. The same holds true for itemcorpses, if your dwarf dies and leaves a statue as itemcorpse, the statue is buried.
Fortress citizen corpses (or perhaps all creatures of the same race as your fortress race; I'm not quite sure) have a "dead_dwarf" flag set to "true", preventing them from being used in reactions. (On a side-note, I was not aware that item-corpses were also treated in this way!) Setting the flag to "false" makes them as usable as any other corpse, however the fact that they can't be used as reagents prevents them from being specifically targeted by dfhack via reaction-product-trigger. I see two possible solutions:
i) Manually targeting a corpse via the cursor and running a script which sets the flag to "false"
ii) Having a reaction which targets all corpses on the map and ensures that the flag is set to "false" for all of them 

And please share the script in the dfhack topic; that way you can reach more people.
Will do.
« Last Edit: September 01, 2015, 03:14:11 am by Atomic Chicken »
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. 

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: More Ways to Enjoy Corpses
« Reply #32 on: September 01, 2015, 05:04:21 am »

I'll try without the end end.

Quote
That's interesting; I simply left the product with no material to keep things simple during tests. The script does not affect statue material; that's determined by the usual reaction code. Is this a problem, or is there a particular material that you'd prefer? Setting creature materials via dfhack is possible, but is a huge hassle.

Maybe you could make a standard material be used instead of using GET_MATERIAL_FROM_REAGENT?
Ok, I just use BONE, or make a TAXIDERMY inorganic called "stuffed". "This is a stuffed statue of a cow"

No worries about the civ-member corpses, I'm sure people dont want stuffed dwarves around, causing ghosts and all that. BUT... does that mean I could set the flag to true for enemies? Goblin corpses that are actually, honorably buried in coffins? Because I actually like that idea. Would be fun to designate invader corpses for burials; I'd totally put that into my mod.

EDIT: WORKS!



EDIT2: It also works with other items, not only statues. I made a figurine at well. I'll see if it works with vermin remains... because obviously they are too small for a statue, but you could make a figurine out of them.

EDIT3: Nope, only works with corpses. Remains do not count. Would be worth a consideration. I'll now make an actual workshop, reactions, one material, and bundle everything up. Will post something later today when it's finished.
« Last Edit: September 01, 2015, 05:48:00 am by Meph »
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

Atomic Chicken

  • Bay Watcher
    • View Profile
Re: More Ways to Enjoy Corpses
« Reply #33 on: September 01, 2015, 05:52:48 am »

EDIT: WORKS!



EDIT2: It also works with other items, not only statues. I made a figurine at well. I'll see if it works with vermin remains... because obviously they are too small for a statue, but you could make a figurine out of them.
Hey, that's great! :D
I completely forgot about figurines; they are basically identical to statues in all but name and size!

I actually think vermin remains (another thing I completely forgot about!) should work too; they have the same basic race and caste info that corpses do. Just no historical figure id; I'll just add an extra condition to ensure that that doesn't create problems.

Quote
The item is a image of a carp in sliced gut
Since "the item is a image of a carp in stuffed" doesn't make any sense, I'm going to make it so that the image produced doesn't display any material references.
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. 

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: More Ways to Enjoy Corpses
« Reply #34 on: September 01, 2015, 06:16:58 am »

Ok. Did you do something about multiple reagents? Can I add leather, thread, etc, or would the break things?
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

Atomic Chicken

  • Bay Watcher
    • View Profile
Re: More Ways to Enjoy Corpses
« Reply #35 on: September 01, 2015, 07:02:07 am »

Ok. Did you do something about multiple reagents? Can I add leather, thread, etc, or would the break things?
I've tried, but I'm not quite sure how to go about it. I'll ask on the dfhack topic.

On the other hand, one test fortress' worth of spawning cats on hapless flying squirrels has proved that taxidermy now works correctly with vermin. The image-material display has also been fixed.

BUT... does that mean I could set the flag to true for enemies? Goblin corpses that are actually, honorably buried in coffins? Because I actually like that idea. Would be fun to designate invader corpses for burials; I'd totally put that into my mod.
I've done some quick testing on this, and can confirm my assumptions; that flag does not seem to directly control whether a corpse is buried or not. It does, however, seem to be necessary for corpses to actually be placed in coffins, rather than being placed on the coffin's tile. My guess is that the game checks the corpse's unit id and/or historical figure id, looks up the corresponding unit/histfig, and then checks the creature's civ id. If the creature is of the same civilisation as your fortress, the corpse is designated for burial. Hence, this would require changing the unit's civ information. This could be done quite easily, though I'm not sure about any possible repercussions. I could write a script for it sometime, if you're interested in testing it.

Oh, and just in case anyone wants the ability to manually turn off the dead_dwarf flag of a selected fortress citizen corpse or body part to make it usable for reactions, here's a simple script for it:
Code: [Select]
local item = dfhack.gui.getSelectedItem()
if item then
if item.flags.dead_dwarf == true then
item.flags.dead_dwarf = false
end
end
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. 

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: More Ways to Enjoy Corpses
« Reply #36 on: September 01, 2015, 07:12:39 am »

The tiny script you posted just automatically turns all dead dwarven corpses into reaction-reagents, yes?

Quote
I could write a script for it sometime, if you're interested in testing it.
Sure. :) I'm always interested in unique content.

Don't worry about the reagent. If it costs a piece of thread or not, doesnt matter. Statues and figurines from dead things are novelty items, they are not changing the game balance.

EDIT: Works too!

« Last Edit: September 01, 2015, 07:46:55 am by Meph »
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: More Ways to Enjoy Corpses
« Reply #37 on: September 01, 2015, 08:02:04 am »

Everything in one place:

Taxidermy: mini-mod that turns corpses into statues and remains into figurines, using the original animal or creature-name. A cow corpse will be a cow statue, a demon rat will be a demon rat figurine, and Hoblutz the goblin will be a statue of Hoblutz the goblin.

All reactions done at the Tanner, no new workshop necessary. Reactions only need a corpse or remains at reagent; job is done using the Tanner skill. Items created will use the "stuffed animal" material, which you can stockpile easily.

Example:

Script: taxidermy.lua (save in hack/scripts, written by Atomic Chicken)
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

Init lines: Onload.init (add to your onload.init in /raw)
Code: [Select]
modtools/reaction-product-trigger -reactionName TAXIDERMY_STATUE -command [ taxidermy -corpse_id \\INPUT_ITEMS -statue_id \\OUTPUT_ITEMS -record_name ]
modtools/reaction-product-trigger -reactionName TAXIDERMY_FIGURINE -command [ taxidermy -corpse_id \\INPUT_ITEMS -statue_id \\OUTPUT_ITEMS -record_name ]

Entity lines: Add to your entity_default in /raw/objects
Code: [Select]
[PERMITTED_REACTION:TAXIDERMY_FIGURINE]
[PERMITTED_REACTION:TAXIDERMY_STATUE]

Reactions: reaction_taxidermy.txt (add to /raw/objects)
Code: [Select]
reaction_taxidermy

[OBJECT:REACTION]

[REACTION:TAXIDERMY_STATUE]
[NAME:stuff a corpse (statue)]
[BUILDING:TANNER:CUSTOM_SHIFT_S]
[REAGENT:corpse:1:CORPSE:NONE:NONE:NONE][USE_BODY_COMPONENT]
[PRODUCT:100:1:STATUE:NONE:INORGANIC:TAXIDERMY]
[SKILL:TANNER]

[REACTION:TAXIDERMY_FIGURINE]
[NAME:stuff remains (figurine]
[BUILDING:TANNER:CUSTOM_SHIFT_F]
[REAGENT:remains:1:REMAINS:NONE:NONE:NONE]
[PRODUCT:100:1:FIGURINE:NONE:INORGANIC:TAXIDERMY]
[SKILL:TANNER]

Inorganics: Inorganic_taxidermy (add to /raw/objects)
Code: [Select]
inorganic_taxidermy

[OBJECT:INORGANIC]

[INORGANIC:TAXIDERMY]
[USE_MATERIAL_TEMPLATE:STONE_TEMPLATE]
[STATE_NAME_ADJ:ALL_SOLID:stuffed animal][DISPLAY_COLOR:7:7:1][TILE:199]
[MATERIAL_VALUE:1]
[IS_STONE]
[MELTING_POINT:16507]
[BOILING_POINT:18000]
« Last Edit: September 01, 2015, 08:08:10 am by Meph »
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

milo christiansen

  • Bay Watcher
  • Something generic here
    • View Profile
Re: More Ways to Enjoy Corpses
« Reply #38 on: September 02, 2015, 11:21:50 am »

The same problem afflicts bronze colossi, whose corpse item often ends up being a statue of bats or something.

Wouldn't it be possible to track down the associated art image (with DFHack) and change it to fit what you want? I had a similar problem with my two stage pottery system where the art image stayed unfired ceramic, so I just looked it up and changed the material.
Logged
Rubble 8 - The most powerful modding suite in existence!
After all, coke is for furnaces, not for snorting.
You're not true dwarven royalty unless you own the complete 'Signature Collection' baby-bone bedroom set from NOKEAS

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: More Ways to Enjoy Corpses
« Reply #39 on: September 02, 2015, 02:59:49 pm »

The same problem afflicts bronze colossi, whose corpse item often ends up being a statue of bats or something.

Wouldn't it be possible to track down the associated art image (with DFHack) and change it to fit what you want? I had a similar problem with my two stage pottery system where the art image stayed unfired ceramic, so I just looked it up and changed the material.
That seems to be what Atomic Chicken did.  Just doesn't seem to work on citizens.

Which would be pretty morbid, even for DF.

Though some kind of mummification reaction would nice.  Can't think of how to make it mandatory, but as an add-on to an elaborate tomb, why not?
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

Atomic Chicken

  • Bay Watcher
    • View Profile
Re: More Ways to Enjoy Corpses
« Reply #40 on: September 02, 2015, 04:02:03 pm »

The tiny script you posted just automatically turns all dead dwarven corpses into reaction-reagents, yes?
Nope, it only does that for a corpse selected via the cursor or whatnot.
This is the tiny script which does the same thing for all corpses in existence at the time of usage.
Code: [Select]
for _,item in ipairs(df.global.world.items.other.ANY_CORPSE) do
if item.flags.dead_dwarf == true then
item.flags.dead_dwarf = false
end
end

Spoiler (click to show/hide)
Looks great!
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. 

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: More Ways to Enjoy Corpses
« Reply #41 on: September 02, 2015, 04:08:17 pm »

I'm facepalming really hard right about now.

Though some kind of mummification reaction would nice.  Can't think of how to make it mandatory, but as an add-on to an elaborate tomb, why not?

I completely forgot about a project I wanted to do a long, long time ago, where dwarves had to embalm and prepare corpses before they can be buried, with the positive effect of keeping the dwarves from turning undead. Aka you bury a dwarf, he might rise, you prepare the corpse, he can't rise.

Didnt work, because corpses were not used in reactions. Well... thx Atomic Chicken, with your script it's possible.
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

crazyabe

  • Bay Watcher
  • I didn't start the fire...Just added the gasoline!
    • View Profile
Re: More Ways to Enjoy Corpses
« Reply #42 on: September 02, 2015, 05:37:30 pm »

how do i do that? ???
Spoiler (click to show/hide)
Any of that...
Logged
Quote from: MonkeyMarkMario, 2023
“Don’t quote me.”
nothing here.

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: More Ways to Enjoy Corpses
« Reply #43 on: September 02, 2015, 05:44:29 pm »

I can make a download folder, which is pre-installed. Only two things you'd need to do, add 2 lines to the entity and 2 lines to the onload init.
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

crazyabe

  • Bay Watcher
  • I didn't start the fire...Just added the gasoline!
    • View Profile
Re: More Ways to Enjoy Corpses
« Reply #44 on: September 02, 2015, 05:45:58 pm »

Thank you!!!  :D
Logged
Quote from: MonkeyMarkMario, 2023
“Don’t quote me.”
nothing here.
Pages: 1 2 [3] 4