Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 186 187 [188] 189 190 ... 360

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

scamtank

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2805 on: June 17, 2015, 11:12:24 pm »

Yeah, that's it. UPSTEP starts from the hand and goes up towards the torso. LBSTEP starts from the lower body and stretches down the legs.

All extensions stop before the next non-limb bit. Robe hems can't cover the feet, long pervy velvet gloves can't stretch past the shoulder and sleeves always cut off at the wrist. I'm sure you know their effects on layer volume already.
Logged

ElenaRoan

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2806 on: June 18, 2015, 02:11:41 am »

Thanks Lethosor, I'll keep an eye on that thread.

I really need to pull my thumb out and learn some lua *chuckle*
Logged
Someone, get the bug zapper! What do you mean that won't work on a bug the size of a house which glows? No, I don't want to hear it. Just get the damn zapper.

Roses

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2807 on: June 18, 2015, 02:09:43 pm »

I am sure there is probably a better way to check for armor covering, but this function works just fine according to the rules on the wiki which may be outdated. Note that it doesn't suffer from the bug listed in the wiki. As input it requires the unit (not the unit_id), the bp_id you are checking to see if it is covered, and the inventory item you are checking. Putting it in a loop such as will run through an entire units inventory and tell you all of the items that cover that body part.

Code: [Select]
for i,x in pairs(defender.inventory) do
  if x.mode == 2 then
   if checkcoverage(defender,target_part_id,x) then

Here is the actual function
Code: [Select]
function checkcoverage(unit,bp_id,inventory_item)
 covers = false
 item = inventory_item.item
 itype = df.item_type[item:getType()]
 base_bp_id = inventory_item.body_part_id
 if base_bp_id == bp_id then
  covers = true
  return covers
 end
 step = 0
 connect = {base_bp_id}
 if itype == 'ARMOR' then
  ubstep = item.subtype.ubstep
  while step < ubstep do
   temp = {}
   for i,x in pairs(unit.body.body_plan.body_parts) do
    for j,y in pairs(connect) do
     if x.con_part_id == y and not x.flags.LOWERBODY and not x.flags.HEAD and not x.flags.GRASP then
  if i == bp_id then
   covers = true
   return covers
  else
   table.insert(temp,i)
  end
end
end
   end
   connect = temp
   step = step + 1
  end
  step = 0
  for i,x in pairs(unit.body.body_plan.body_parts) do
   if x.flags.LOWERBODY then
    base_bp_id = i
    break
   end
  end
  if base_bp_id == bp_id then
   covers = true
   return covers
  end
  connect = {base_bp_id}
  lbstep = item.subtype.lbstep
  while step < lbstep do
   temp = {}
   for i,x in pairs(unit.body.body_plan.body_parts) do
    for j,y in pairs(connect) do
     if x.con_part_id == y and not x.flags.UPPERBODY and not x.flags.STANCE then
  if i == bp_id then
   covers = true
   return covers
  else
   table.insert(temp,i)
  end
end
end
   end
   connect = temp
   step = step + 1
  end
 elseif itype == 'HELM' then
  return covers
 elseif itype == 'GLOVES' then
  upstep = item.subtype.upstep
  while step < upstep do
   temp = {}
   for i,x in pairs(unit.body.body_plan.body_parts) do
    for j,y in pairs(connect) do
     if x.con_part_id == y and not x.flags.UPPERBODY and not x.flags.LOWERBODY then
  if i == bp_id then
   covers = true
   return covers
  else
   table.insert(temp,i)
  end
end
end
   end
   connect = temp
   step = step + 1
  end
 elseif itype == 'SHOES' then
  upstep = item.subtype.upstep
  while step < upstep do
   temp = {}
   for i,x in pairs(unit.body.body_plan.body_parts) do
    for j,y in pairs(connect) do
     if x.con_part_id == y and not x.flags.UPPERBODY and not x.flags.LOWERBODY then
  if i == bp_id then
   covers = true
   return covers
  else
   table.insert(temp,i)
  end
end
end
   end
   connect = temp
   step = step + 1
  end
 elseif itype == 'PANTS' then
  lbstep = item.subtype.lbstep
  while step < lbstep do
   temp = {}
   for i,x in pairs(unit.body.body_plan.body_parts) do
    for j,y in pairs(connect) do
     if x.con_part_id == y and not x.flags.UPPERBODY and not x.flags.STANCE then
  if i == bp_id then
   covers = true
   return covers
  else
   table.insert(temp,i)
  end
end
end
   end
   connect = temp
   step = step + 1
  end
 end
 return covers
end
Logged

JayThePro

  • Bay Watcher
  • [PERSONALITY:SELF_CONTROL:0:2:100]
    • View Profile
Re: DFHack 0.34.11 r5
« Reply #2808 on: June 18, 2015, 05:56:05 pm »

Did anything happen to "adv-bodyswap"
Can't seem to preform it at it's current v40.24.
Logged

expwnent

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2809 on: June 18, 2015, 10:01:47 pm »

In that case, would anyone be willing to educate me on what exactly the ub/up/lbstep values do? I know that, for example, a chest piece with a ubstep of 0 will only protect the upper body, and a chest piece with a ubstep of 1 will protect the upper body and upper arms. Is it just simply, you take the body part that the piece of armor is attached to, and then, for each increase in ubstep you move out one connected body part? So for a creature with just one part arms, their whole arm would be protected by a ubstep of 1, but a dwarf would need a ubstep of 2?

Raw modders would know better. You could ask around there.
Logged

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 0.34.11 r5
« Reply #2810 on: June 19, 2015, 08:47:20 am »

Did anything happen to "adv-bodyswap"
Can't seem to preform it at it's current v40.24.
have you tried out Dfusion's Body swap script that should still work. Adv-Bodyswap was someone else attempt at that code with mix results.
Logged
I thought I would I had never hear my daughter's escapades from some boy...
DAMN YOU RUMRUSHER!!!!!!!!
"body swapping and YOU!"
Adventure in baby making!Adv Homes

Lightningy

  • Bay Watcher
  • MOM GET THE CAMERA!!!
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2811 on: June 19, 2015, 11:20:42 am »



where do i get Add-splatter and details of how to use it? i found the actual code in the github site and i have no idea how to use it.
Logged
'What is life?', you ask. Fundamentally life is the apotheosis of pointlessness. We live to multiple. But what for? The Endless cycle of carnage pulls hardest on the furthest victim. An inescapable fate; one no one wants but we all desire. The more immoral we become the more ideal we are. A perverse oxymoron. We who live unencumbered but are the most burdened. We fight but at the end it is all for naught, as in life there are no winners; only the undistinguished.

GENERATION 29:
Copy and add 1.

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2812 on: June 19, 2015, 11:40:53 am »

It's a plugin that's compiled and included with DFHack by default.
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.

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2813 on: June 19, 2015, 12:31:30 pm »

This question seems more appropriate here.

Code: [Select]
df.global.world.history.events:new()
 df.global.world.history.events:insert('#',{new=df.history_event_hf_attacked_sitest,
year = whenever,
seconds = whatever,
id = df.global.hist_event_next_id,
site = you get the idea,
hfid = beast.id,
}
)
   df.global.hist_event_next_id = df.global.hist_event_next_id+1

does this actually do anything

I'm trying to make a creature that won't spawn naturally show up during worldgen, as if these historical sites were doing the same kinds of things that a player fort could do to get them to show up.  (They show up when a boil-away stone is mined, but that's not important for this discussion).

If I spawn a nemesis and figure out how to place it at a historical site during worldgen, will adding a "rampage" event at that time cause the creature to actually cause problems at that site?  Or maybe I'm overthinking this, and placing a hostile nemesis onsite will cause a rampage all by itself?

Ideally, I'd like there to be some mention of these beasts in Legends (and artworks) including the Knights In Shining Armor who've slain them.  It bothers me right that they appear in a game-y fashion right now that can only occur in a player fort.

Eventually, I'd like to do away with the boil-away stone entirely, and just make a tiny chance of spawning a critter whenever mining a layer stone.
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

Lightningy

  • Bay Watcher
  • MOM GET THE CAMERA!!!
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2814 on: June 19, 2015, 12:33:31 pm »

thx i should have checked
Logged
'What is life?', you ask. Fundamentally life is the apotheosis of pointlessness. We live to multiple. But what for? The Endless cycle of carnage pulls hardest on the furthest victim. An inescapable fate; one no one wants but we all desire. The more immoral we become the more ideal we are. A perverse oxymoron. We who live unencumbered but are the most burdened. We fight but at the end it is all for naught, as in life there are no winners; only the undistinguished.

GENERATION 29:
Copy and add 1.

JayThePro

  • Bay Watcher
  • [PERSONALITY:SELF_CONTROL:0:2:100]
    • View Profile
Re: DFHack 0.34.11 r5
« Reply #2815 on: June 19, 2015, 06:47:10 pm »

Did anything happen to "adv-bodyswap"
Can't seem to preform it at it's current v40.24.
have you tried out Dfusion's Body swap script that should still work. Adv-Bodyswap was someone else attempt at that code with mix results.
Er my bad, where would I get the script?
Logged

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2816 on: June 20, 2015, 01:14:54 am »

This question seems more appropriate here.

Spoiler (click to show/hide)

I'm trying to make a creature that won't spawn naturally show up during worldgen, as if these historical sites were doing the same kinds of things that a player fort could do to get them to show up.  (They show up when a boil-away stone is mined, but that's not important for this discussion).

If I spawn a nemesis and figure out how to place it at a historical site during worldgen, will adding a "rampage" event at that time cause the creature to actually cause problems at that site?  Or maybe I'm overthinking this, and placing a hostile nemesis onsite will cause a rampage all by itself?

Ideally, I'd like there to be some mention of these beasts in Legends (and artworks) including the Knights In Shining Armor who've slain them.  It bothers me right that they appear in a game-y fashion right now that can only occur in a player fort.

Eventually, I'd like to do away with the boil-away stone entirely, and just make a tiny chance of spawning a critter whenever mining a layer stone.
I slapped in the same basic layout for artifakes and it made them show up in legends properly. As long as those links are intact it should show up right. If you want to double check pull up the location with gui/gm-editor df.global.world.history.events dot whatever entry you're targeting and make sure you didn't miss a field in the entries.

Oh and I do mean literally slapped in, I just put that in before the last two sections where it handles the left/right and name arguments, at the end of the item/artifact definition sections and it worked as expected. I checked on the "attacked_sitest" format and it has the hfid and site and stuff fields which you'd need to have defined elsewhere but once those are set up and you link them properly it should insert an appropriate reference into legends as expected.
« Last Edit: June 20, 2015, 01:23:50 am by Max™ »
Logged

Showbiz

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2817 on: June 20, 2015, 06:08:14 am »

My adventurer is startet in a sealed Fort again. Is there a way to teleport my adventurer up to the surface?
Logged
Pardon for my mistakes
english isn't my native language

Arx

  • Bay Watcher
  • Iron within, iron without.
    • View Profile
    • Art!
Re: DFHack 0.40.24-r3
« Reply #2818 on: June 20, 2015, 12:57:18 pm »

I think the teleport command should do that, but I can't remember if it still needs to be be spoonfed information in this DFHack release.
Logged

I am on Discord as Arx#2415.
Hail to the mind of man! / Fire in the sky
I've been waiting for you / On this day we die.

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2819 on: June 20, 2015, 05:11:46 pm »

Also the option of reveal > find area with link to exit > head over there and advfort dig your way out. Traveling might give you access to a road and if you then travel back to the spot with the stairs you can exit.
Logged
Pages: 1 ... 186 187 [188] 189 190 ... 360