Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 190 191 [192] 193 194 ... 360

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

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2865 on: June 25, 2015, 12:30:17 pm »

Hmmm, well, not sure if it would be easier to set up a faked item or try the projectile thing. Need to ask Putnam if he knows what any of those unk values do, who would have guessed that unk_30 was freaking attack velocity?
Logged

Roses

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2866 on: June 25, 2015, 12:50:42 pm »

Yeah, from the few tests I did it doesn't seem like any of the other unk values have anything to do with material or the like (which why would they since that information is stored in the attack_item_id and body_part_id. What I really need to do is find a way to get into what the actual attack action does (i.e. calculate momentum, shear costs, blah, blah, blah, calculate wound), but from my cursory check it doesn't look like we have a way to manipulate that.
Logged

expwnent

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2867 on: June 25, 2015, 01:45:07 pm »

Announcement: if possible, please submit structure/memory research in the issues tracker for df-structures. Direct Link
Logged

Max™

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

Does that include stuff like being able to put a name/function on an unk_ entry?
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2870 on: June 26, 2015, 06:37:13 am »

Yes, although a pull request would be even better.
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-r3
« Reply #2871 on: June 26, 2015, 01:04:30 pm »

Yeah, from the few tests I did it doesn't seem like any of the other unk values have anything to do with material or the like (which why would they since that information is stored in the attack_item_id and body_part_id. What I really need to do is find a way to get into what the actual attack action does (i.e. calculate momentum, shear costs, blah, blah, blah, calculate wound), but from my cursory check it doesn't look like we have a way to manipulate that.

Well, I do have an idea for a workaround now, but it might be pretty messy and have unforeseen consequences. Basically it is split into two parts, item attacks and body part attacks.

  • Item Attacks
    • Create appropriate item of desired material (or use equipped item)
    • Add an attack to the item raw with the desired contact/penetration/name/velocity
    • Add the attack action with all necessary inputs
    • Wait one tick for attack to be applied
    • Remove attack from item raw
    • Remove item (if not using an equipped item)
  • Body Part Attacks
    • Pick body part
    • Change the creature raw to use the desired material
    • Add attack to the creature raw with the desired contact/penetration/name/velocity
    • Add the attack action with all necessary inputs
    • Wait one tick for the attack to be applied
    • Remove attack from the creature raw
    • Revert material of creature raw

Now as far as I can see this should work fine, allowing for highly customisable attacks and such. The only downside is that for that one tick (or however long it needs to remain for the attack to be applied) all items/creatures of that type will have the change. Thoughts?

I really wish you could change an individual creatures material!
Logged

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2872 on: June 26, 2015, 02:37:51 pm »

Second, is there a quick way to check if a material matches one of 24 arbitrary materials?  Since this will be an eventful call-back, I'll have a chance to pre-populate a persistent list with numeric ids if that will make a difference in performance.
Does anyone have a lead on this, either from a Lua angle or a regular expression angle?  Otherwise it turns into looping string match tests, which I imagine would be relatively slow.  There are 49 tests in a worst case scenario, so it might not be too bad.  Would still like a more elegant solution, though.

Make a persistent table with the id of each of the materials. Then just use
Code: [Select]
if persistTable.GlobalTable.DirstMatTable[mat.id] then something like that should work
So it turns out that getting the layer and vein materials for a tile is non-trivial, but Milo wrote a Lua plugin to extract it.  But I'd also like to check if the just-mined-out tile has a boulder in it or not.  Spawning an "awakened stone" creature or a rough "hidden gem" will have a low probability per tile, so I might as well avoid the 1-in-4 tiles that mine out a boulder anyway.

Is there a straightforward check for an object at a given set of XYZ coordinates?  Since this will be checked the tick a tile was mined out, the only possible outcomes are empty and boulder.  Carved stairs, etc. are terrain features so they shouldn't interfere with the check.

If I get this to work, I won't need to have different versions of the inorganic file for different graphics packs.  The next step would be to find a tile that's universally applicable as a plant, and then there'd be no need to adjust for graphics packs at all.
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

Roses

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2873 on: June 26, 2015, 03:07:34 pm »

Second, is there a quick way to check if a material matches one of 24 arbitrary materials?  Since this will be an eventful call-back, I'll have a chance to pre-populate a persistent list with numeric ids if that will make a difference in performance.
Does anyone have a lead on this, either from a Lua angle or a regular expression angle?  Otherwise it turns into looping string match tests, which I imagine would be relatively slow.  There are 49 tests in a worst case scenario, so it might not be too bad.  Would still like a more elegant solution, though.

Make a persistent table with the id of each of the materials. Then just use
Code: [Select]
if persistTable.GlobalTable.DirstMatTable[mat.id] then something like that should work
So it turns out that getting the layer and vein materials for a tile is non-trivial, but Milo wrote a Lua plugin to extract it.  But I'd also like to check if the just-mined-out tile has a boulder in it or not.  Spawning an "awakened stone" creature or a rough "hidden gem" will have a low probability per tile, so I might as well avoid the 1-in-4 tiles that mine out a boulder anyway.

Is there a straightforward check for an object at a given set of XYZ coordinates?  Since this will be checked the tick a tile was mined out, the only possible outcomes are empty and boulder.  Carved stairs, etc. are terrain features so they shouldn't interfere with the check.

If I get this to work, I won't need to have different versions of the inorganic file for different graphics packs.  The next step would be to find a tile that's universally applicable as a plant, and then there'd be no need to adjust for graphics packs at all.

Something like
Code: [Select]
if dhack.maps.getTileBlock(pos).occupancy[pos.x%16][pos.y%16].item thenwill tell you if the particular position has an item in it.
Logged

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2874 on: June 26, 2015, 03:21:25 pm »

Something like
Code: [Select]
if dhack.maps.getTileBlock(pos).occupancy[pos.x%16][pos.y%16].item thenwill tell you if the particular position has an item in it.
Thanks, this improved way of hiding things in the rock is coming along nicely.
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

Roses

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2875 on: June 26, 2015, 04:46:01 pm »

Hmmm, well, not sure if it would be easier to set up a faked item or try the projectile thing. Need to ask Putnam if he knows what any of those unk values do, who would have guessed that unk_30 was freaking attack velocity?

It seems that unk_3c is accuracy, or in some way related to the chance to hit. At 100 all of my custom attacks hit, at 0 all of my custom attacks missed.

Yeah, from the few tests I did it doesn't seem like any of the other unk values have anything to do with material or the like (which why would they since that information is stored in the attack_item_id and body_part_id. What I really need to do is find a way to get into what the actual attack action does (i.e. calculate momentum, shear costs, blah, blah, blah, calculate wound), but from my cursory check it doesn't look like we have a way to manipulate that.

Well, I do have an idea for a workaround now, but it might be pretty messy and have unforeseen consequences. Basically it is split into two parts, item attacks and body part attacks.

  • Item Attacks
    • Create appropriate item of desired material (or use equipped item)
    • Add an attack to the item raw with the desired contact/penetration/name/velocity
    • Add the attack action with all necessary inputs
    • Wait one tick for attack to be applied
    • Remove attack from item raw
    • Remove item (if not using an equipped item)
  • Body Part Attacks
    • Pick body part
    • Change the creature raw to use the desired material
    • Add attack to the creature raw with the desired contact/penetration/name/velocity
    • Add the attack action with all necessary inputs
    • Wait one tick for the attack to be applied
    • Remove attack from the creature raw
    • Revert material of creature raw

Now as far as I can see this should work fine, allowing for highly customisable attacks and such. The only downside is that for that one tick (or however long it needs to remain for the attack to be applied) all items/creatures of that type will have the change. Thoughts?

I really wish you could change an individual creatures material!

Well, I got it working for mostly for both items and body parts. Still not sure what some of the values do, but they don't seem to affect the outcome. It is interesting to note you can queue up as many attacks as you want and it will execute them all at once. I punched a goblin 100 times in the chest using very low velocity punches and watched the wounds accumulate (then once with a super velocity and watched him fly away). But be careful, each of those actions adds a bit of exhaustion. After punching 100 times my dwarf passed out from over exertion. I then changed the dwarf bone to slade and punched a bronze colossus 100 times smashing him into pieces (without the change to slade the attacks all bounced off).

Interestingly, shooting a crossbow doesn't seem to generate an action. And all attack actions assume you are adjacent to the enemy, so you can't use fake long range attacks without teleporting your attacker to the defender and then executing the attack or simply using the projectile script.
Logged

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2876 on: June 26, 2015, 06:24:05 pm »

Oh jesus, I'm kinda turned on thinking about what Putnam and Rumrusher will end up doing when they get their hands on that.

Holy fuckbats, you just confirmed the old "artifact weapons are more accurate" thing.

Steel artifake battle axe regular swings at easy/can't land squarely targets tends to give a value of around 271 at legendary+10 skill/fighter skill. Regular steel masterwork battle axe tends to range around 105~160 in similar conditions.

Precise attacks bumped it up to 330 something, multiple ATTACKS reduce the accuracy of the first attack pretty significantly, the others have less consistent and less noticeable reductions.

Now the interesting thing: attacking and dodging has no accuracy penalty, so, yeah, ku-fuckin-dos to you Roses and to Putnam as well, it's very nice knowing where those damn values sit for sure.
« Last Edit: June 26, 2015, 06:53:49 pm by Max™ »
Logged

expwnent

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2877 on: June 27, 2015, 11:37:29 am »

Awesome! Scriptable attacks are a great tool. I'm slightly concerned what would happen if the game saves during the one tick where things are weird but as long as that doesn't happen it should work fine.
Logged

elcr

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2878 on: June 27, 2015, 02:00:39 pm »

Does anyone have a Linux build of DFHack 0.34.11-r5 lying around they could share? I can only find 0.34.11-r3 builds here, and only source packages are available on the GitHub releases page.
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2879 on: June 27, 2015, 02:07:22 pm »

Releases made before we started uploading builds to GitHub are all on DFFD.
Edit:
« Last Edit: June 27, 2015, 02:11:34 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.
Pages: 1 ... 190 191 [192] 193 194 ... 360