Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 279 280 [281] 282 283 ... 373

Author Topic: DFHack 0.34.11 r3  (Read 1456022 times)

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4200 on: June 29, 2013, 08:33:53 am »

I just can't figure out how to use DFusion commands like friendship, mirgants and embark expander. How do they work?
by typing in the number not the word corresponding to the option
it doesn't help that dfusion kinda gutted out friendship,migrant, and embark expander...

in scripting news I just finished ironing out the spawn unit script warmist made now it can spawn any unit how many times you want and doesn't horribly turn all your dwarves tame and make sharks rulers, costing you the trust of a coder.

here's a fort friendly version so that you don't have to set an adventurer in your fort to spawn units
here's one for adventure mode one

this won't work right away if you don't have genesis so you need to edit the "Barbarian Class" with any race you want.
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

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4201 on: June 29, 2013, 02:27:00 pm »

I just can't figure out how to use DFusion commands like friendship, mirgants and embark expander. How do they work?
by typing in the number not the word corresponding to the option
it doesn't help that dfusion kinda gutted out friendship,migrant, and embark expander...

in scripting news I just finished ironing out the spawn unit script warmist made now it can spawn any unit how many times you want and doesn't horribly turn all your dwarves tame and make sharks rulers, costing you the trust of a coder.

here's a fort friendly version so that you don't have to set an adventurer in your fort to spawn units
here's one for adventure mode one

this won't work right away if you don't have genesis so you need to edit the "Barbarian Class" with any race you want.

SHIET

EDIT: Does autosyndrome work with adventure mode reactions?
« Last Edit: June 29, 2013, 03:03:19 pm by Putnam »
Logged

theit8514

  • Escaped Lunatic
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4202 on: July 01, 2013, 12:16:57 am »

EDIT: DOH, I made a variable mistake :D Ignore this. I've updated the code to the complete 100% working (including preferred improvement types and counting # of improvements over 1), incase anyone else needs a value calculator :) Time to start working on the other item types. Yay.

I've been working on calculating out trader item values (to make improvements to how tradeassist works). So far, I've gotten pretty close (for weapons, that is :D ). Some items that are improved have the correct value (#3). Others are way off (#4). I am wondering if any dfhack veterans have any suggestions.

Spoiler (click to show/hide)

I have absolutely no idea why ITEM_WEAPON_WHIP_THROWING is so off. It's size is 100 in the raws (a 3 multi), and the material multi is the same as the raws. The calculation is correct for other items (or close enough that I can count the remainder as "trader variation").

Spoiler (click to show/hide)

The code, for anyone interested:
Spoiler (click to show/hide)
« Last Edit: July 01, 2013, 01:36:21 am by theit8514 »
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4203 on: July 01, 2013, 06:48:23 pm »

changed some todo stuff:

Code: [Select]
function CreateUnit(race_id,caste_id) --This is from Rumrusher/Warmist's spawnunit script: http://www.bay12forums.com/smf/index.php?topic=91166.msg4359680
    local race=df.creature_raw.find(race_id)
    if race==nil then error("Invalid race_id") end
    local caste=getCaste(race_id,caste_id)
    local miscStuff = caste.misc
    local unit=df.unit:new()
    unit.race=race_id
    unit.caste=caste_id
        unit.id=(df.global.unit_next_id)
        df.global.unit_next_id = df.global.unit_next_id + 1
    local body=unit.body
   
    body.body_plan=caste.body_info
    local body_part_count=#body.body_plan.body_parts
    local layer_count=#body.body_plan.layer_part
    --components
    local creatureAge = math.random(miscStuff.child_age,miscStuff.maxage_min/2)
    unit.relations.birth_year=df.global.cur_year-creatureAge
    --unit.relations.birth_time=??
    unit.relations.old_year=unit.relations.birth_year+(math.random(miscStuff.maxage_min,miscStuff.maxage_max))
    --unit.relations.old_time=?? --TODO add normal age
    local cp=body.components
    cp.body_part_status:resize(body_part_count)
    cp.numbered_masks:resize(#body.body_plan.numbered_masks)
    for num,v in ipairs(body.body_plan.numbered_masks) do
        cp.numbered_masks[num]=v
    end
   
    cp.body_layer_338:resize(layer_count)
    cp.body_layer_348:resize(layer_count)
    cp.body_layer_358:resize(layer_count)
    cp.body_layer_368:resize(layer_count)
    cp.body_layer_378:resize(layer_count)
    --maybe physical_attr
    body.blood_max=miscStuff.adult_size
    body.blood_count=miscStuff.adult_size
    body.unk_494=0
    unit.status2.body_part_temperature:resize(body_part_count)
    for k,v in pairs(unit.status2.body_part_temperature) do
        unit.status2.body_part_temperature[k]={new=true,whole=(caste.homeotherm~=60001) and caste.homeotherm or 10067,fraction=0}
       
    end
    --------------------
    local stuff=unit.enemy
    stuff.body_part_878:resize(body_part_count) -- all = 3
    stuff.body_part_888:resize(body_part_count) -- all = 3
    stuff.body_part_relsize:resize(body_part_count)
 
    --TODO add correct sizes.
   
    stuff.were_race=race_id
    stuff.were_caste=caste_id
    stuff.normal_race=race_id
    stuff.normal_caste=caste_id
    stuff.body_part_8a8:resize(body_part_count) -- all = 1
    stuff.body_part_base_ins:resize(body_part_count)
    stuff.body_part_clothing_ins:resize(body_part_count)
    stuff.body_part_8d8:resize(body_part_count)
    unit.recuperation.healing_rate:resize(layer_count)
    --appearance
   
    local app=unit.appearance
    app.body_modifiers:resize(#caste.body_appearance_modifiers) --3
    app.bp_modifiers:resize(#caste.bp_appearance.modifier_idx) --0
    --app.unk_4c8:resize(33)--33
        app.tissue_style:resize(#caste.bp_appearance.style_layer_idx)
        app.tissue_style_civ_id:resize(#caste.bp_appearance.style_layer_idx)
        app.tissue_style_id:resize(#caste.bp_appearance.style_layer_idx)
        app.tissue_style_type:resize(#caste.bp_appearance.style_layer_idx)
        app.tissue_length:resize(#caste.bp_appearance.style_layer_idx)
    app.genes.appearance:resize(#caste.body_appearance_modifiers+#caste.bp_appearance.modifiers) --3
    app.genes.colors:resize(#caste.color_modifiers*2) --???
    app.colors:resize(#caste.color_modifiers)--3
    -- maybe add a soul?
    df.global.world.units.all:insert("#",unit)
    --df.global.world.units.bad:insert("#",unit)
    df.global.world.units.active:insert("#",unit)
    return unit
end

function PlaceUnit(trgunit,filter)
u = selectCreature(filter)
u.relations.group_leader_id=trgunit.id
local u_nem=dfhack.units.getNemesis(u)
local t_nem=dfhack.units.getNemesis(trgunit)
if u_nem then
        u_nem.group_leader_id=t_nem.id
end
if t_nem and u_nem then
        t_nem.companions:insert(#t_nem.companions,u_nem.id)
end
u.civ_id=df.global.ui.civ_id
--u.civ_id=(df.global.world.units.active[0].civ_id) --be sure to use adventure swap on a local dwarf so they be connected to the right civ
--u.pos:assign(df.global.world.units.active[0].pos)
u.pos:assign(xyz2pos(pos2xyz(df.global.cursor)))
u.name.first_name="Summoned monster of " .. target.name.first_name
u.name.has_name=true
end
« Last Edit: July 01, 2013, 07:18:47 pm by Putnam »
Logged

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4204 on: July 01, 2013, 08:59:33 pm »

changed some todo stuff:

Code: [Select]
function CreateUnit(race_id,caste_id) --This is from Rumrusher/Warmist's spawnunit script: http://www.bay12forums.com/smf/index.php?topic=91166.msg4359680
    local race=df.creature_raw.find(race_id)
    if race==nil then error("Invalid race_id") end
    local caste=getCaste(race_id,caste_id)
    local miscStuff = caste.misc
    local unit=df.unit:new()
    unit.race=race_id
    unit.caste=caste_id
        unit.id=(df.global.unit_next_id)
        df.global.unit_next_id = df.global.unit_next_id + 1
    local body=unit.body
   
    body.body_plan=caste.body_info
    local body_part_count=#body.body_plan.body_parts
    local layer_count=#body.body_plan.layer_part
    --components
    local creatureAge = math.random(miscStuff.child_age,miscStuff.maxage_min/2)
    unit.relations.birth_year=df.global.cur_year-creatureAge
    --unit.relations.birth_time=??
    unit.relations.old_year=unit.relations.birth_year+(math.random(miscStuff.maxage_min,miscStuff.maxage_max))
    --unit.relations.old_time=?? --TODO add normal age
    local cp=body.components
    cp.body_part_status:resize(body_part_count)
    cp.numbered_masks:resize(#body.body_plan.numbered_masks)
    for num,v in ipairs(body.body_plan.numbered_masks) do
        cp.numbered_masks[num]=v
    end
   
    cp.body_layer_338:resize(layer_count)
    cp.body_layer_348:resize(layer_count)
    cp.body_layer_358:resize(layer_count)
    cp.body_layer_368:resize(layer_count)
    cp.body_layer_378:resize(layer_count)
    --maybe physical_attr
    body.blood_max=miscStuff.adult_size
    body.blood_count=miscStuff.adult_size
    body.unk_494=0
    unit.status2.body_part_temperature:resize(body_part_count)
    for k,v in pairs(unit.status2.body_part_temperature) do
        unit.status2.body_part_temperature[k]={new=true,whole=(caste.homeotherm~=60001) and caste.homeotherm or 10067,fraction=0}
       
    end
    --------------------
    local stuff=unit.enemy
    stuff.body_part_878:resize(body_part_count) -- all = 3
    stuff.body_part_888:resize(body_part_count) -- all = 3
    stuff.body_part_relsize:resize(body_part_count)
 
    --TODO add correct sizes.
   
    stuff.were_race=race_id
    stuff.were_caste=caste_id
    stuff.normal_race=race_id
    stuff.normal_caste=caste_id
    stuff.body_part_8a8:resize(body_part_count) -- all = 1
    stuff.body_part_base_ins:resize(body_part_count)
    stuff.body_part_clothing_ins:resize(body_part_count)
    stuff.body_part_8d8:resize(body_part_count)
    unit.recuperation.healing_rate:resize(layer_count)
    --appearance
   
    local app=unit.appearance
    app.body_modifiers:resize(#caste.body_appearance_modifiers) --3
    app.bp_modifiers:resize(#caste.bp_appearance.modifier_idx) --0
    --app.unk_4c8:resize(33)--33
        app.tissue_style:resize(#caste.bp_appearance.style_layer_idx)
        app.tissue_style_civ_id:resize(#caste.bp_appearance.style_layer_idx)
        app.tissue_style_id:resize(#caste.bp_appearance.style_layer_idx)
        app.tissue_style_type:resize(#caste.bp_appearance.style_layer_idx)
        app.tissue_length:resize(#caste.bp_appearance.style_layer_idx)
    app.genes.appearance:resize(#caste.body_appearance_modifiers+#caste.bp_appearance.modifiers) --3
    app.genes.colors:resize(#caste.color_modifiers*2) --???
    app.colors:resize(#caste.color_modifiers)--3
    -- maybe add a soul?
    df.global.world.units.all:insert("#",unit)
    --df.global.world.units.bad:insert("#",unit)
    df.global.world.units.active:insert("#",unit)
    return unit
end

function PlaceUnit(trgunit,filter)
u = selectCreature(filter)
u.relations.group_leader_id=trgunit.id
local u_nem=dfhack.units.getNemesis(u)
local t_nem=dfhack.units.getNemesis(trgunit)
if u_nem then
        u_nem.group_leader_id=t_nem.id
end
if t_nem and u_nem then
        t_nem.companions:insert(#t_nem.companions,u_nem.id)
end
u.civ_id=df.global.ui.civ_id
--u.civ_id=(df.global.world.units.active[0].civ_id) --be sure to use adventure swap on a local dwarf so they be connected to the right civ
--u.pos:assign(df.global.world.units.active[0].pos)
u.pos:assign(xyz2pos(pos2xyz(df.global.cursor)))
u.name.first_name="Summoned monster of " .. target.name.first_name
u.name.has_name=true
end

 pretty sure warmist corrected the sizes and what not in his version, mine is an earlier version of his script modified to work with little crashing so it would be safe to throw in all that randomize/state changing stuff.
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

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4205 on: July 01, 2013, 09:03:55 pm »

Yeah, on my end it's crashing without fail.

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4206 on: July 02, 2013, 12:12:56 pm »

which one? my version, your version, warmist version? or all three?
because to explain it to others my version is a modified old version that was tested in genesis,
warmist is kinda unstable.
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

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4207 on: July 02, 2013, 01:05:05 pm »

which one? my version, your version, warmist version? or all three?
because to explain it to others my version is a modified old version that was tested in genesis,
warmist is kinda unstable.
warmist is uber stable :)

But my version is for next dfhack release. so ;P

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4208 on: July 02, 2013, 10:12:53 pm »

Then I'll have more reason to wait ;V

I tried both mine and yours, Rumrusher, but Warmist I didn't, hehe.

skyte100

  • Bay Watcher
  • God of Ichor
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4209 on: July 02, 2013, 10:46:58 pm »

I wanted to take an adventurer and start a fort with just him as a challenge. Anyone know a way to change it from adventure mode to fortress mode with it being stable? Methods I tried result in crashes.
Logged

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4210 on: July 03, 2013, 12:43:40 am »

I wanted to take an adventurer and start a fort with just him as a challenge. Anyone know a way to change it from adventure mode to fortress mode with it being stable? Methods I tried result in crashes.
https://gist.github.com/warmist/4198190 this to switch from adv-mode to fort mode. But it needs a site in that location. To create a site you can use dfusion->2.) adventurer tools->4.) create a site at current location.

After using first script, save n exit, and reload. It should work somewhat more uncrashy then other methods.

skyte100

  • Bay Watcher
  • God of Ichor
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4211 on: July 03, 2013, 11:49:14 am »

I wanted to take an adventurer and start a fort with just him as a challenge. Anyone know a way to change it from adventure mode to fortress mode with it being stable? Methods I tried result in crashes.
https://gist.github.com/warmist/4198190 this to switch from adv-mode to fort mode. But it needs a site in that location. To create a site you can use dfusion->2.) adventurer tools->4.) create a site at current location.

After using first script, save n exit, and reload. It should work somewhat more uncrashy then other methods.
Thanks! Methods I tried were:
1. Changing from adventure straight to fortress. Result was locked keys, inability to move map, area in adventuers line of sight went dark and area to his far left was fully visible. Doesnt function at all.
 1.1. Changing it to fortress mode while in the adventurers screen and using "tweak makeown" then saving resulted in instant crashes if the game doesnt pause on load. It then crashes when unpausing or trying to access certain screens.
2. Changing from adventure to arena, manually removing control of adventurer, then switching to fort mode and adding the adventurer to to the fort via "tweak makeown". Result is semi functioning with immediate pausing with the ability to change labors but several labors missing. Unpausing results in immediate unleashing of hell followed by crash. Also had a fully revealed map due to arena. It was also unable to save thanks to the use of arena mode.
 2.1. Changing it instead to fortress mode, using reveal, changing it to arena, removing control, back to fort, and unreveal resulted in only hell being visible other than the surface. It then crashes.

Also gonna go ahead and report here that the advfort thing that lets you do jobs had a bit of a hiccup. I manually slept in a built underground base. Waking up reloaded the site with all changes I had made reverted and me moved above ground and the inability to move in the same square as the logs from cut trees.

Edit: I tried it and it seems more stable but accessing the z > Animals screen crashes it. Also gonna send you some screen shots of issues I found.
« Last Edit: July 03, 2013, 12:05:36 pm by skyte100 »
Logged

Button

  • Bay Watcher
  • Plants Specialist
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4212 on: July 05, 2013, 01:36:59 pm »

What's the name of the script that checks if eggs are fertilized? I've googled around for it but I must be blanking on the right keywords.
Logged
I used to work on Modest Mod and Plant Fixes.

Always assume I'm not seriously back

Kurik Amudnil

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4213 on: July 05, 2013, 01:53:25 pm »

What's the name of the script that checks if eggs are fertilized? I've googled around for it but I must be blanking on the right keywords.

I know that a while back there was some discussion about what will allow an egg to hatch, which if I interpreted it correctly summarizes to if the egg layer is on the nest and has a valid pregnancy timer/ptr/mystry when the egg gets to 3 months old, it should hatch.  I find that there is something missing from that because resetting the age and pregnancy timer on ages that failed to hatch doesn't fix them.  I would also be interested in a script that gets it right (knows if they are going to hatch or not).

I did find that item_eggst.anon_4 is the unit.id of the egg layer.  item_eggst.unk_cc is a copy of the egg layer's unit.animal.population (world_population_ref) or in other words, the unit.animal.population structure the hatchlings will receive.  And I think item_eggst.anon_3 is the unit.training_level that the hatchlings will receive (based on the egg layer's training level)

Edit: added another egg field
« Last Edit: July 06, 2013, 12:35:03 am by Kurik Amudnil »
Logged

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4214 on: July 05, 2013, 02:35:42 pm »

Edit: I tried it and it seems more stable but accessing the z > Animals screen crashes it. Also gonna send you some screen shots of issues I found.
updated that fixes animal screen:
https://gist.github.com/warmist/4198190
if you want to fix already existing fort that has this, type this into dfhack console:
Code: [Select]
:lua df.global.ui.main.fortress_entity.training_knowledge={new=true}

ps: about usability: all this is not for general consumption. It hacks df quite bad and is a miracle that it works. That is why it's not included in main dfhack package and i don't encourage using it for general population. Some thing could be improved (everybody is welcome to fork my gist) but I'm not sure about the value of this. Main limitations and problems:
  • viewscreen does not change - and i don't see how to change it without save-load step
  • strange designations - that could be fixed by undesignating all the field (will be slow) happens because adv-mode uses same fields for different stuff
  • site suddenly shrinks (might lose fort if all units are in shrunken chunks) - happens because in adv mode loading sites happens differently then in fort, not sure if there is a way around it
« Last Edit: July 05, 2013, 02:42:12 pm by Warmist »
Logged
Pages: 1 ... 279 280 [281] 282 283 ... 373