Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 183 184 [185] 186 187 ... 360

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

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2760 on: June 10, 2015, 08:32:14 pm »

Hmmmm, I bet artifake could be translated to that since it's very similar actually.

Wounds have a reference to a part, the part state, the actual wound, wound flags, and syndromes resulting from the wound like pain/numbness/loss of limb/sight/breathing/layers. Then there is a final check for the status2 limb stand/grasp tables I think.

Someone did some research on this a while back but I forget if it was in here or another thread.

Hah, YOU did the research:
http://www.bay12forums.com/smf/index.php?topic=139553.msg6076700#msg6076700
Logged

Roses

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2761 on: June 10, 2015, 11:31:03 pm »

Yes, I had done research previously about how to add wounds, so I have that mostly working. Now I am starting to research the numbers and their affect on the unit. Mayhaps I should also talk to Urist Da Vinci, I seem to remember him doing some research on wounds and how they accumulate.
Logged

captinjoehenry

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2762 on: June 11, 2015, 07:50:27 pm »

how do i go about spawning a dragon heart or dragon bones with dfhack?
Logged

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2763 on: June 11, 2015, 10:11:54 pm »

You can't just spawn the body parts, if it was from wanderlust then the best you could do would be createitem PLANT BALM_MIGHT (assuming that's what you wanted heart for) and createitem SOME:ITEM_SOME_TOKEN DRAGON:BONE, like createitem WEAPON:ITEM_WEAPON_HAMMER_WAR DRAGON:BONE, and artifake uses the same sceme with the arguments added, artifake -item WEAPON:ITEM_WEAPON_HAMMER_WAR -material DRAGON:BONE -name "The Glorious Buttscratcher of Ham" would make an artifact dragon bone war hammer with that name... that reminds me I gotta incorporate the names script into there properly, been busy and tired so I haven't poked at it much yet.
Logged

Roses

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2764 on: June 12, 2015, 01:42:39 am »

Well, I've written a script to successfully add wounds to specified body parts and their layers. Now I just need to work on figuring out the numbers. So far it seems to be working just fine. Copying numbers from other wounds gives the exact same outcome. And you can even get messages like "His eyes are burnt". This is the code so far, but note that it doesn't have any of the number stuff in it. I am still doing that by hand until I figure out a convenient way to do it.

Code: [Select]
local utils = require 'utils'

function checkbodycategory(unit,bp)
 local parts = {}
 local body = unit.body.body_plan.body_parts
 for i,x in ipairs(bp) do
  local a = 1
  for j,y in ipairs(body) do
   if y.category == x and not unit.body.components.body_part_status[j].missing then
    parts[a] = j
    a = a + 1
   end
  end
 end
 return parts
end
function checkbodytoken(unit,bp)
 local parts = {}
 local body = unit.body.body_plan.body_parts
 for i,x in ipairs(bp) do
  local a = 1
  for j,y in ipairs(body) do
   if y.token == x and not unit.body.components.body_part_status[j].missing then
    parts[a] = j
    a = a + 1
   end
  end
 end
 return parts
end
function checkbodyflag(unit,bp)
 local parts = {}
 local body = unit.body.body_plan.body_parts
 for i,x in ipairs(bp) do
  local a = 1
  for j,y in ipairs(body) do
   if y.flags[x] and not unit.body.components.body_part_status[j].missing then
    parts[a] = j
    a = a + 1
   end
  end
 end
 return parts
end
function checkbodylayer(unit,parts,layers)
 local a = 1
 local array = {}
 for i,x in pairs(parts) do
  local part = unit.body.body_plan.body_parts[x]
  for j,y in pairs(layers) do
   for k,z in pairs(part.layers) do
    if z.layer_name == y or y == 'ALL' then
array[a] = {x,k,z.layer_id}
a = a+1
end
   end
  end
 end
 return array
end

function addwound(unit,array)
 local body = unit.body
 local wound = df.unit_wound:new()
 wound.id = body.wound_next_id
 body.wound_next_id = body.wound_next_id + 1
 for i,x in pairs(array) do
  part = df.unit_wound.T_parts:new()
  part.global_layer_idx = x[3]
  part.layer_idx = x[2]
  part.body_part_id = x[1]
  wound.parts:insert('#',part)
 end
 body.wounds:insert('#',wound)
end

validArgs = validArgs or utils.invert({
 'help',
 'category',
 'token',
 'flag',
 'all',
 'layer',
 'unit',
})
local args = utils.processArgs({...}, validArgs)

if args.help then -- Help declaration
 print([[wound-add.lua
  Assign a wound to a specific body part and layer of a unit
  arguments:
   -help
     print this help message
   -unit id
     REQUIRED
     id of the target unit
   -all                       \
     target all body parts    |
   -category TYPE             |
     examples:                |
      TENTACLE                |
      HOOF_REAR               |
      HEAD                    |
   -token TYPE                | Must have at least one of these
     examples:                |
      UB                      |
      LB                      |
      REYE                    |
   -flag FLAG                 |
     examples:                |
      SIGHT                   |
      LIMB                    |
      SMALL                   /
   -layer TYPE
     examples:
      SKIN
  FAT
  MUSCLE
  ALL
  examples:
   unit/wound-add -unit \\UNIT_ID -all -layer SKIN
   unit/wound-add -unit \\UNIT_ID -token UB -layer ALL
 ]])
 return
end

if args.unit and tonumber(args.unit) then -- Check for unit declaration !REQUIRED
 unit = df.unit.find(tonumber(args.unit))
else
 print('No unit selected')
 return
end

dur = tonumber(args.dur) or 0 -- Check if there is a duration (default 0)

parts = {}
recall = ''
tokens = args.all or args.category or args.token or args.flag
layers = args.layer or ''
if type(layers) == 'string' then layers = {layers} end
if type(tokens) == 'string' then tokens = {tokens} end
if args.all then -- Check for the all body parts flag. !!RUN EFFECT!!
 body = unit.body.body_plan.body_parts
 for k,v in ipairs(body) do
  parts[k] = k
 end
 recall = 'all'
elseif args.category then -- Check for category body parts. !!RUN CHECKBODYCATEGORY!!. !!RUN EFFECT!!
 parts = checkbodycategory(unit,tokens)
 recall = 'category'
elseif args.token then -- Check for token body parts. !!RUN CHECKBODYTOKEN!!. !!RUN EFFECT!!
 parts = checkbodytoken(unit,tokens)
 recall = 'token'
elseif args.flag then -- Check for flag body parts. !!RUN CHECKBODYFLAG!!. !!RUN EFFECT!!
 parts = checkbodyflag(unit,tokens)
 recall = 'flag'
end

array = checkbodylayer(unit,parts,layers)
if #array >= 1 then
 addwound(unit,array)
end
Logged

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2765 on: June 12, 2015, 03:13:21 am »

Cool stuff.
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2766 on: June 12, 2015, 03:21:15 am »

...Does it just not doing anything with the wound, or am I misunderstanding something?

Libash_Thunderhead

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2767 on: June 12, 2015, 03:24:18 am »

Does dfhack.burrows.findByName still work?
I tried "Burrow 1" and "burrow 1", but both of them returned nil.
[edit*]
Well, I rename the burrow and it worked...
« Last Edit: June 12, 2015, 03:32:42 am by Libash_Thunderhead »
Logged

Bien

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2768 on: June 12, 2015, 09:17:18 am »

Some more script/plugin suggestions:
- A stack merger for Fort and Adventure mode
- An inventory organizer
- Some way to arrange attacks in adventure mode by ease/strength of hit
- A larger/alternate GUI for conversations
Logged

FukkenSaved

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2769 on: June 12, 2015, 12:56:16 pm »

Would it be possible to create a flag in Autolabor to set a certain type of labor as 'dedicated'? Like say, set "autolabor HAUL_STONE 2 4 d", where D disables all other labors in the dwarves it selects, leaving them as only stone haulers?

A generalized "HAUL" labor would also be useful, and would act as a macro that sets all of the Hauling labors to the set values.

I'd make this but sadly I have zero programming skill.

I don't know why anyone would use autolabor anymore as it does not assign skills optimally and anyone who ever had diplomat responsibility has their labors auto-stripped, including former mayors and expedition leaders. If you have to use autolabor, then your only option there would be to assign them the stone hauling labor only in something like Therapist then put them in a burrow so autolabor will ignore their labor assignments.
But autohauler is designed so you get a lot more control. All you'd have to do then is set the dwarf's stone hauling labor as the only one active then set a labor with the forbid flag so hauling assignments are not changed, by default Alchemist is one. For either program though you'll have a problem with hauling jobs accumulating, so make sure that at least 5% of non-military are idlers.
Logged

FukkenSaved

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2770 on: June 12, 2015, 12:59:53 pm »

I need to WinMerge what I've changed so far but the big thing is that it assigns hauling to sleeping dwarves and others that can't feasibly do anything so that it tricks DF into assigning more hauling jobs, expect a pull request soon
Logged

Rose

  • Bay Watcher
  • Resident Elf
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2771 on: June 12, 2015, 01:02:54 pm »

How often is DFHack updated? Like if I update a plugin, would it be more reasonable to provide a download of just the plugin, or hope that a new DFhack release comes out before the plugin is needed?
Logged

Roses

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2772 on: June 12, 2015, 01:11:41 pm »

...Does it just not doing anything with the wound, or am I misunderstanding something?

Yeah, that version just adds the wound to the correct body part and layer depending on the inputs you give it. I was just using it as a proof of concept. The version I am playing with now has options for all of the various numbers (bleeding, pain, nausea, dizziness, paralysis, numbness, swelling, impaired, contact_area, surface_area, and strain) along with options for various flags, and if you want it to be a bruise/burn/frostbite/blister/necrosis. I will upload a full version with all the bells and whistles when I get everything working well. I still have a few more ideas to add to it, like the ability to add wounds that simulate getting a body part chopped off.
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2773 on: June 12, 2015, 02:23:27 pm »

Does dfhack.burrows.findByName still work?
I tried "Burrow 1" and "burrow 1", but both of them returned nil.
[edit*]
Well, I rename the burrow and it worked...
It's possible that burrows have empty names by default and the names DF generates (e.g. "Burrow 1") aren't easily available to DFHack, although I haven't checked.
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

scamtank

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2774 on: June 12, 2015, 02:58:21 pm »

How often is DFHack updated? Like if I update a plugin, would it be more reasonable to provide a download of just the plugin, or hope that a new DFhack release comes out before the plugin is needed?

I don't think that even the current version cares what the plugins themselves say anymore. Did I interpret that right?
Logged
Pages: 1 ... 183 184 [185] 186 187 ... 360