Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 128 129 [130] 131 132 ... 243

Author Topic: DFHack 50.13-r2  (Read 820285 times)

DerMeister

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1935 on: October 30, 2019, 01:14:22 pm »

What about reaction, that can be done by only milkable worker and produce milk of this worker? How make this with dfhack?
Logged

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1936 on: October 30, 2019, 03:44:45 pm »

Yeah, that's much easier - Eventmanager would let you fill in milk from creature into bucket when they complete a job to milk themselves, provided they're milkable. (That takes a bucket and produces that same bucket.)

There might have been a way to ensure only suitable creatures can take the job without cancellations; not sure. But you could cancel milk self when the unit can't be milked due not being milkable or being milked too recently.

(Though you can't assign same creature as the milker and the milkee in vanilla job; they'll cancel the job due being in custody.)

DerMeister

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1937 on: October 30, 2019, 04:26:19 pm »

Yeah, that's much easier - Eventmanager would let you fill in milk from creature into bucket when they complete a job to milk themselves, provided they're milkable. (That takes a bucket and produces that same bucket.)

There might have been a way to ensure only suitable creatures can take the job without cancellations; not sure. But you could cancel milk self when the unit can't be milked due not being milkable or being milked too recently.

(Though you can't assign same creature as the milker and the milkee in vanilla job; they'll cancel the job due being in custody.)
So I need only reaction raw code? Or also need script?
Logged

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1938 on: October 30, 2019, 05:56:15 pm »

You need both, but script would be over ten times simpler to do than before.

DerMeister

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1939 on: October 30, 2019, 06:36:27 pm »

You need both, but script would be over ten times simpler to do than before.
Can you make new script and reaction?

Also I want know: is any way to teleport worldgen artifacts from location (especially lost in wilds) to my fort?
Logged

fortunawhisk

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1940 on: October 31, 2019, 12:49:44 am »

I saw this in the ThreeToe's stress thread:
- Dorfs that have had a strange mood are immune to insanity. I had one that was tantruming and had maximum stress, but once I managed to get the finicky bugger to pick up a trinket of a desired material (wouldn't take anything else hauled), a slow trek towards recovery started. Unfortunately, the fortress was cut short by raid corruption when the stress level had improved from -100000 to -70000 (which is still extremely bad). I believe I also did other things apart from the crucial trinket acquisition to improve the condition of this starting 7 dorf, though.

Is there a data structure somewhere in the unit that contains a list of desired trinkets and their material(s)? A 'I want to acquire a ring, preferably dolomite' entry, if you will?

Separately, has anyone worked out how the 'stress_boost' / 'stress_drain' system from the unit personality section works?
Logged

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1941 on: October 31, 2019, 02:38:48 am »

Yeah, you can access preferred things in .status.current_soul.preferences, and needs in ..soul.personality.needs. I bet latter is more important than the former.

@DerMeister: Maybe one day when I'm also on a mod dealing with milkable sapients; for now working on other stuff. It's a lot more interesting at least, allowing stuff like snakemen milking themselves for venom.
« Last Edit: October 31, 2019, 03:13:18 am by Fleeting Frames »
Logged

Atkana

  • Bay Watcher
  • [CURIOUSBEAST]
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1942 on: October 31, 2019, 02:49:07 am »

Is there a data structure somewhere in the unit that contains a list of desired trinkets and their material(s)? A 'I want to acquire a ring, preferably dolomite' entry, if you will?
That would be the unit's preferences (that list you can see where it explains materials, creatures, art forms, etc. that they like). The preferences are stored in the unit's unit.status.current_soul.preferences.

For a material preference: type will be 0 (df.unit_preference.T_type[0] is LikeMaterial). mattype and matindex are the type and index of the material. You can use dfhack.matinfo.find(TOKEN), where TOKEN is the material's token (e.g. "INORGANIC:GOLD", "COW:MILK") to find the material, and then use its .type and .index info to fill in mattype and matindex respectively.

For an item preference: type will be 4 (df.unit_preference.T_type[4] is LikeItem). item_type will be the item's type (df.item_type). Conveniently, the numerical ids and tokens are listed on this wiki page, so set the item_type value to either the number listed or use df.item_type[TOKEN] (e.g. for blocks use 2 or df.item_type.BLOCKS). item_subtype will be -1 for items without subtype. For items with subtypes (weapons, trap components, toys, tools, instruments, armor, ammo, siege_ammo, gloves, shields, helms, pants, food) you use that item's subtype. I don't know if there's any direct way of finding a subtype by a string, but all items with subtypes are listed in df.global.world.raws.itemdefs.all (or instead of .all you can use stuff like .weapons to only get the weapon itemdefs). From within that table, it'd simply be a case of looping through it until you find the desired id (the token of the item subtype e.g. "ITEM_WEAPON_CROSSBOW") and using the subtype entry for the item_subtype (so again in this example crossbows have a subtype of 6).

You're lucky I just recently looked into all of this :P

Clément

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1943 on: October 31, 2019, 05:34:02 am »

You don't need to know the values for the preference type, use df.unit_preference.T_type.LikeMaterial instead of 0.
Logged

PatrikLundell

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1944 on: October 31, 2019, 07:47:08 am »

I haven't seen anything like a "desired item" list, and I don't expect one to exist. Instead, I'd expect the current logic (which ought to be revised to allow non haulers to be catered for) to go the other way, i.e. "I'm currently hauling a dolomite ring. How does that match my trinket preferences?".
From there, I'd guess the results can be (note guess):
- Well, it's a quality trinket, I need one, and I'm not too picky. I'll take it.
- Well, it's a quality dolomite ring, I need a trinket, and I require it to be either a ring or made from gabbro. I'll take it.
- MOMMY!!! I WANT A GABBRO RING!!! (stomping optional).

Most dorfs appear to be satisfied by any trinket, possibly with a quality threshold, with my finicky dorf an exception. Also note that some dorfs have material preferences, some have item type preferences, and some have both (hence nobles demanding things like bronze beds), and some neither (with nobles without item preferences being safe from ordering mandate violation murders. Materials are OK).
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1945 on: October 31, 2019, 04:10:27 pm »

Hm, while we're speaking of structures anyway, any idea what's the minimum change to convert 43.03 units.xml unit from struct-type to class-type?

It's impossible. struct-type is for structs or classes that don't have virtual methods, and class-type is for ones that do. Going from no virtual methods to some virtual methods changes the layout of the class (specifically, it adds a pointer at the beginning pointing to all the virtual methods). While the methods that became virtual in 0.43.05 existed before, there's no easy way to call them from 0.43.03 because they weren't virtual then.
Quote
It just spits errors at me (such as unit has no .name) if I just change the type as in the commit that changed it and add the three virtual methods, and don't want to paste wholesale since that'll break plugins relying on old relationship compounds.
However, this might be something else. What specific commit are you trying to compile? What changes are you looking at? Links and error messages would help (pastebin is fine if they're long).

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.

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1946 on: October 31, 2019, 06:07:17 pm »

Just this change will result in breakage.

Anyway, good to know it's impossible. I think I found at least partial workaround while editing something similar (in regards to vermin with no vmethods), thankfully.

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1947 on: October 31, 2019, 11:02:13 pm »

To clarify, you're using 0.43.03 structures and changing struct-type to class-type? And the "name" field isn't defined? Its name hasn't changed, so maybe something else named "name" is breaking - the messages from the compiler might help here.
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.

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1948 on: October 31, 2019, 11:24:49 pm »

Yes. And wait, I think I got confused with a different error, it does compile but segfaults when looking at unit and using gui/gm-editor (confirmed this by compile, check, revert, check again).

Of course, given can't include the vmethods anyway the point is moot.

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1949 on: November 01, 2019, 04:17:31 am »

like with dfhack's item spawning you can produce unlimited amounts of liquid milk in any container you want and probably attach the milk origins to any person, though I think no one here probably too keen on wanting to use dfhack to force sapient folks into milking factories... when one could just craft milk via modding... that said kinda wonder how the whole process of milking works in adventure mode to some what improve on the advfort stuff.
In advfort - haven't tested but general idea is this: create just enough df stuff that it's job handling logic takes over and then if player presses "pass time" it controls your char as if it's one of the fort mode dwarves (well more like your units ) and does all the complicated stuff. And that fails in many ways (e.g. plant gathering... have no idea why it does not work). Sometimes you need to setup a lot more stuff than other times (e.g. fill out various references)...

Anyway my newest attempt at "job creation utils" is here but it looks very bad already :< need to revisit all this job thing (for my undead doing the dirty jobs for you mod)
so during the first time advfort broke and noticing it doesn't really break on npcs I modified it to be a 'companion' fort script that just sends the jobs over to them. which while works does mean I have to pass a lot of time and probably could just re-write it to just send them job commands or something.

but most of this is a vacation from the head scratcher that is figuring out where the Mission data went in the new version of Dfhack and poking around how armies work.
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
Pages: 1 ... 128 129 [130] 131 132 ... 243