Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 148 149 [150] 151 152 ... 360

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

Roses

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r2
« Reply #2235 on: March 03, 2015, 03:07:22 am »

Does anyone have experience with adding wounds to units with DFHack? Every time I try to add a wound using gm-editor or just the command line it reverts back after a few ticks.
It might just heal... Wounds are complicated to say the least.

Let's see... I had a script that adds a wound... A heart ripping out script. here

The wound just removes the heart and adds a HUGE amount of bleed per tick (without the bleeding ripping out a heart does nothing... dwarves can be heartless strangely). So more complicated stuff like damaging tissues and breaking bones or even figureing out how much bleeding to add for heart removal (also it would be fun to add a hole through to the heart :) ) is left as an exercise to the reader ;)

Hmm, I may be able to use that to achieve what I am thinking, but I will have to investigate wounds a bit more in arena first I think. Get a good bench mark for numbers and such.
Logged

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: DFHack 0.40.24-r2
« Reply #2236 on: March 03, 2015, 05:56:01 am »

Thank you! I needed an actual error to know what to fix.

...There is no == in all of that file. That's odd. I can't find what that error is.

Also, you really shouldn't teleport using gm-editor. It causes unit occupancy units. See teleport to see how to properly do it.
Yeah, it is kinda a way to encourage me to not use it too much though, find different ways to do things instead of porting around.
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r2
« Reply #2237 on: March 03, 2015, 06:46:36 am »

Did you check out dfhack.lua lines 418-436? It looks like the actual error is occurring there, not necessarily in teleport.lua. I think.
No, the trackback lists the most recent function call first. The syntax error is occurring when attempting to load the actual script (which does occur in dfhack.lua, but the error message also mentions the problem in teleport.lua).
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.

Descan

  • Bay Watcher
  • [HEADING INTENSIFIES]
    • View Profile
Re: DFHack 0.40.24-r2
« Reply #2238 on: March 03, 2015, 12:28:48 pm »

I was able to use teleport.lua as long as I filled out both unitID and position. If I omitted one, I got errors. Here's a screenshot.
Tiny Pic because my internet is shit right now.
Logged
Quote from: SalmonGod
Your innocent viking escapades for canadian social justice and immortality make my flagellum wiggle, too.
Quote from: Myroc
Descan confirmed for antichrist.
Quote from: LeoLeonardoIII
I wonder if any of us don't love Descan.

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r2
« Reply #2239 on: March 03, 2015, 01:19:25 pm »

I was able to use teleport.lua as long as I filled out both unitID and position. If I omitted one, I got errors. Here's a screenshot.
Tiny Pic because my internet is shit right now.
You could just copy the text from the console.
Edit: I think this requires using the console menu on Windows - I'm not entirely sure how to do that, but it's either accessible by right-clicking the title bar or clicking on the dwarf icon.
« Last Edit: March 03, 2015, 01:36:24 pm by lethosor »
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.

Roses

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r2
« Reply #2240 on: March 03, 2015, 01:20:33 pm »

I was able to use teleport.lua as long as I filled out both unitID and position. If I omitted one, I got errors. Here's a screenshot.
Tiny Pic because my internet is shit right now.

It looks to me like you didn't have your cursor set somewhere. You can try putting a printall(pos) right before teleport(unit,pos). I'm guessing you will get nil or something like that.

Does anyone have experience with adding wounds to units with DFHack? Every time I try to add a wound using gm-editor or just the command line it reverts back after a few ticks.
It might just heal... Wounds are complicated to say the least.

Let's see... I had a script that adds a wound... A heart ripping out script. here

The wound just removes the heart and adds a HUGE amount of bleed per tick (without the bleeding ripping out a heart does nothing... dwarves can be heartless strangely). So more complicated stuff like damaging tissues and breaking bones or even figureing out how much bleeding to add for heart removal (also it would be fun to add a hole through to the heart :) ) is left as an exercise to the reader ;)

Hmm, I may be able to use that to achieve what I am thinking, but I will have to investigate wounds a bit more in arena first I think. Get a good bench mark for numbers and such.

So I have spent quite a bit of time looking through wounds, from what I can tell there are three main components. The first is adding the actual wound to the unit. Namely;
Code: [Select]
[lua]# ~unit.body.wounds[0]
<unit_wound: 0x1606de90>
id                       = 1
parts                    = <vector<unit_wound.T_parts*>: 0x1606de94>
age                      = 343
attacker_unit_id         = 3
attacker_hist_figure_id  = -1
flags                    = <unit_wound.T_flags: 0x1606deb0>
syndrome_id              = -1
pain                     = 0
nausea                   = 0
dizziness                = 0
paralysis                = 0
numbness                 = 0
fever                    = 0
curse                    = nil
Then you have to add the parts that the wound affects. Each wound can have more than one body part affected, although it usually appears to be the same body part with different layers.
Code: [Select]
[lua]# ~unit.body.wounds[0].parts[0]
<unit_wound.T_parts: 0x13da0dc0>
global_layer_idx         = 64
body_part_id             = 15
layer_idx                = 0
contact_area             = 24
surface_perc             = 100
strain                   = 49900
effect_perc1             = <vector<int16_t>: 0x13da0dd4>
effect_perc2             = <vector<int16_t>: 0x13da0de4>
effect_type              = <vector<wound_effect_type>: 0x13da0df4>
edged_curve_perc         = 29
flags1                   = <wound_damage_flags1: 0x13da0e08>
flags2                   = <wound_damage_flags2: 0x13da0e0c>
bleeding                 = 0
pain                     = 5
nausea                   = 0
dizziness                = 0
paralysis                = 0
numbness                 = 0
swelling                 = 0
impaired                 = 0
cur_penetration_perc     = 99
max_penetration_perc     = 100
jammed_layer_idx         = -1
unk_v406_1               = 0
Lastly, the corresponding body part AND layer must have the correct values and flags set.
Code: [Select]
[lua]# ~unit.body.components
<body_component_info: 0x15ff4c98>
body_part_status         = <vector<body_part_status>: 0x15ff4c98>
numbered_masks           = <vector<uint32_t>: 0x15ff4ca8>
nonsolid_remaining       = <vector<uint32_t>: 0x15ff4cb8>
layer_status             = <vector<body_layer_status>: 0x15ff4cc8>
layer_wound_area         = <vector<uint32_t>: 0x15ff4cd8>
layer_cut_fraction       = <vector<uint32_t>: 0x15ff4ce8>
layer_dent_fraction      = <vector<uint32_t>: 0x15ff4cf8>
layer_effect_fraction    = <vector<uint32_t>: 0x15ff4d08>
With all three of these things I have managed to add persistent wounds (although in about 10% of my trials the damage was undone and the wound removed, but that may have been because the wound healed, or there is another check somewhere that I am unaware of for certain wounds).

So it seems adding wounds to units is at least possible, now the issue is getting correct values for everything. I could definitely use some help in that department. What would be awesome is if anytime you are playing and one of your units gets a cool wound you could post all the values. Or if you have a fort that has lived through a bunch of different sieges and monster attacks I can go through the units (both alive and dead) and get a set of wounds, ranging from stubbed toes to torn in half. My hope is to build a, sort of, wound database, that I can use in modding and scripts to simulate an adventuring system inside of fortress mode.
Logged

Descan

  • Bay Watcher
  • [HEADING INTENSIFIES]
    • View Profile
Re: DFHack 0.40.24-r2
« Reply #2241 on: March 03, 2015, 01:24:35 pm »

No, I had my cursor set.

Jeeze, you try and be helpful, and people call you an idiot...
Logged
Quote from: SalmonGod
Your innocent viking escapades for canadian social justice and immortality make my flagellum wiggle, too.
Quote from: Myroc
Descan confirmed for antichrist.
Quote from: LeoLeonardoIII
I wonder if any of us don't love Descan.

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r2
« Reply #2242 on: March 03, 2015, 01:33:16 pm »

Oh, you passed -x twice in the second command. For me, the script works when passed only -x, -y, and -z parameters if a unit is selected. (It could provide more user-friendly error messages when arguments are missing/invalid, though.) If it doesn't work for you, make sure your copy of the script matches the one in the repo.
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.

Roses

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r2
« Reply #2243 on: March 03, 2015, 01:41:24 pm »

No, I had my cursor set.

Jeeze, you try and be helpful, and people call you an idiot...

Oh I see the problem. (I really didn't mean to suggest you were an idiot, its my fault for not reading your error log carefully enough). One sec for a fix.

EDIT: I am sure there is a more elegant way to do this, but I just threw it together, just copy and paste this in between the 'local pos =' and 'teleport()' (at the end of the file)
Code: [Select]
if df.global.T_cursor:is_instance(pos) then
  postemp = {x=0,y=0,z=0}
  postemp.x = pos.x
  postemp.y = pos.y
  postemp.z = pos.z
  pos = postemp
 end
For those of you wondering, it appears the getTileBlock function will not accept an global.T_cursor type. Hence it won't work when using the cursor.
« Last Edit: March 03, 2015, 01:49:46 pm by Roses »
Logged

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: DFHack 0.40.24-r2
« Reply #2244 on: March 03, 2015, 01:59:50 pm »

No, I had my cursor set.

Jeeze, you try and be helpful, and people call you an idiot...

Oh I see the problem. (I really didn't mean to suggest you were an idiot, its my fault for not reading your error log carefully enough). One sec for a fix.

EDIT: I am sure there is a more elegant way to do this, but I just threw it together, just copy and paste this in between the 'local pos =' and 'teleport()' (at the end of the file)
Code: [Select]
if df.global.T_cursor:is_instance(pos) then
  postemp = {x=0,y=0,z=0}
  postemp.x = pos.x
  postemp.y = pos.y
  postemp.z = pos.z
  pos = postemp
 end
For those of you wondering, it appears the getTileBlock function will not accept an global.T_cursor type. Hence it won't work when using the cursor.

yes there is:
Code: [Select]
thing_that_needs_pos(copyall(df.global.pos))

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.40.24-r2
« Reply #2245 on: March 03, 2015, 03:49:37 pm »

Also, I'm pretty sure you shouldn't be putting the unit ID in parentheses.

Descan

  • Bay Watcher
  • [HEADING INTENSIFIES]
    • View Profile
Re: DFHack 0.40.24-r2
« Reply #2246 on: March 03, 2015, 07:16:48 pm »

Well when it wasn't working, I kept trying different things. >_>
Logged
Quote from: SalmonGod
Your innocent viking escapades for canadian social justice and immortality make my flagellum wiggle, too.
Quote from: Myroc
Descan confirmed for antichrist.
Quote from: LeoLeonardoIII
I wonder if any of us don't love Descan.

Propman

  • Bay Watcher
  • Eh.
    • View Profile
Re: DFHack 0.40.24-r2
« Reply #2247 on: March 04, 2015, 12:44:45 am »

Fiddling with my raws a bit, I've come across a rather peculiar error.

Code: [Select]
...d\Desktop\Mashup Fortress\hack\lua\plugins\stockflow.lua:390: attempt to index local 'entity' (a nil value)
stack traceback:
...d\Desktop\Mashup Fortress\hack\lua\plugins\stockflow.lua:390: in function 'collect_reactions'
...d\Desktop\Mashup Fortress\hack\lua\plugins\stockflow.lua:34: in function <...d\Desktop\Mashup Fortress\hack\lua\plugins\stockflow.lua:33>
Could not load stockflow world data!

Interesting bit is that reverting all my raws from before the error doesn't make it go away. Doesn't seem to affect gameplay yet (mostly conducting arena mode tests), though it's somewhat annoying to see that line of text each loadup.
Logged
Quote from: from Pathos on April 07, 2010, 08:29:05 pm »
( It was inevitable, really. )

scamtank

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r2
« Reply #2248 on: March 04, 2015, 01:44:53 am »

That's a problem with arena mode. Stockflow tries to look up things about civilizations, but since there's no actual world out there to collect from, it throws a fit in red text.
Logged

breadman

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r2
« Reply #2249 on: March 04, 2015, 12:32:07 pm »

DFHack previously used Shift-Enter, which now selects all items (this is a feature in vanilla DF, introduced at some point in the 0.40.xx series). You can now use Shift-Down (or Shift-Up) to accomplish the same thing.

...any chance of getting a related shortcut to buy a container and move past the items inside the container?

Should be possible, though not quite as easy as the current ones.  I've added to my list of suggestions to consider.

That's a problem with arena mode. Stockflow tries to look up things about civilizations, but since there's no actual world out there to collect from, it throws a fit in red text.

Sorry about that.  I'll look into it.
Logged
Quote from: Kevin Wayne, in r.g.r.n
Is a "diety" the being pictured by one of those extremely skinny aboriginal statues?
Pages: 1 ... 148 149 [150] 151 152 ... 360