Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 204 205 [206] 207 208 ... 360

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

mifki

  • Bay Watcher
  • works secretly...
    • View Profile
    • mifki
Re: DFHack 0.40.24-r3
« Reply #3075 on: September 09, 2015, 07:47:50 pm »

Do we know where the adventurer's location while traveling is stored?

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #3076 on: September 10, 2015, 12:17:33 am »

Do we know where the adventurer's location while traveling is stored?
Yes. It forms an army. It has first flag equal to true. pull request about all that stuff.
Not sure where it holds the coordinates before traveling... Maybe in map?

mifki

  • Bay Watcher
  • works secretly...
    • View Profile
    • mifki
Re: DFHack 0.40.24-r3
« Reply #3077 on: September 10, 2015, 12:28:13 am »

Do we know where the adventurer's location while traveling is stored?
Yes. It forms an army. It has first flag equal to true. pull request about all that stuff.
Not sure where it holds the coordinates before traveling... Maybe in map?

Oh I found it looks for something in the armies vector and gave up. Thanks.

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #3078 on: September 10, 2015, 02:42:14 am »

Under df.global.world.world_data, adv_region_x, adv_region_y, adv_emb_x, and adv_emb_y are at least part of it.

The values respectively while fresh out of travel mode:
adv_region_x 63
adv_region_y 27
adv_emb_x 8
adv_emb_y 13

Enter travel mode, move around, the values stay the same while I'm traveling.
Teleport my army from 3043 by 1667 to 304 by 1667, the values stay the same.

Exit travel mode at 304 by 1667 and I get:
adv_region_x 6
adv_region_y 27
adv_emb_x 4
adv_emb_y 13

I moved 4 squares west in travel mode, so thats adv_emb_x 8 -> 4
I teleported from 3043 to 304, so that's adv_region_x 63 -> 6
Logged

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #3079 on: September 10, 2015, 03:03:26 am »

Under df.global.world.world_data, adv_region_x, adv_region_y, adv_emb_x, and adv_emb_y are at least part of it.

The values respectively while fresh out of travel mode:
adv_region_x 63
adv_region_y 27
adv_emb_x 8
adv_emb_y 13

Enter travel mode, move around, the values stay the same while I'm traveling.
Teleport my army from 3043 by 1667 to 304 by 1667, the values stay the same.

Exit travel mode at 304 by 1667 and I get:
adv_region_x 6
adv_region_y 27
adv_emb_x 4
adv_emb_y 13

I moved 4 squares west in travel mode, so thats adv_emb_x 8 -> 4
I teleported from 3043 to 304, so that's adv_region_x 63 -> 6

More interesting question: now that we can create armies (with your chosen races and their counts) is it possible (by setting position or armies path) force it to appear in fort mode and/or in your adventure map?

This would allow for all sorts of !!fun!! scenarios.

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #3080 on: September 10, 2015, 04:55:04 am »

Putnam and I poked at that a bit, and we had varying degrees of success, but nothing consistent.

I did learn one interesting trick though: nameless historical figures in an army are just designated by a race and a count. I've brought armies to my position which started as 2 gobs and loaded in as 30 or something.

Need a script that goes in and checks what the races are, it would be nice if we could cross check that against their goals. I've noticed various armies which run patrol loops even though they aren't guards. Yetis do this a lot, bandits tend to do it unless there are nearby hillocks/hamlets, I've noticed vampires doing it as well.

I don't know how well it would work if you just told the game "there are now 30 goblins from x civ at my fort who want to attack me because I'm from y civ" as I recall the tent of 2 goblins I ported over to me just ended up with a pile of them sleeping eternally stacked like cordwood.

I recall that the one siege I was actually able to force was one of the hostile gob civs and I grabbed that army by checking the pos_x and pos_y for the right area of the map before zooping them next to my fort. They started attacking decently enough, but when I went out with an adventurer and came back they were acting like they lived there but were hostile to me as an adventurer, not a member of the ruby hammers or whatever.

Spoiler (click to show/hide)
Logged

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #3081 on: September 10, 2015, 05:29:37 am »

Putnam and I poked at that a bit, and we had varying degrees of success, but nothing consistent.

I did learn one interesting trick though: nameless historical figures in an army are just designated by a race and a count. I've brought armies to my position which started as 2 gobs and loaded in as 30 or something.

There is two arrays in army: one is historical figures the other is non-historical. I added the fields i guessed (and then checked by spawning armies in advmode). But i did not have any success in "calling-in" army in fort mode.

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #3082 on: September 10, 2015, 10:38:57 am »

hmm would dabble more into this but I still haven't gotten a good UI working for the fast travel warp to marker fixed(waypoint is fixed but portal isn't).
another question is with the wait command can you send personal armies to do base of operations in areas?
like park a bunch of peasants at a ruin/lair and tell them to settle there?
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

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #3083 on: September 10, 2015, 12:07:49 pm »

So, this works to get a newly spawned creature in a fighting mood, but it's heavier-handed than I would like.

Code: [Select]
...

function add_attack(attacker_id,defender_id,target,weapon)
attacker = df.unit.find(attacker_id)
defender = df.unit.find(defender_id)
j = 0
while j < 1 do -- Not sure why this "loop" is here???
action = df.unit_action:new()
action.id = attacker.next_action_id
attacker.next_action_id = attacker.next_action_id + 1

action.type = 1
attack = action.data.attack
attack.target_unit_id = defender_id
attack.attack_item_id = -1
attack.target_body_part_id = tonumber(target)
attack.attack_body_part_id = tonumber(weapon)
attack.unk_30 = 1
attack.attack_id = 0
attack.flags = 0
attack.unk_28 = 100
attack.unk_2c = 100
attack.unk_38 = 100
attack.unk_3c = 100
attack.timer1 = 1
attack.timer2 = 1
for i,x in pairs(attack.unk_4) do
attack.unk_4[i] = 0
end
attack.unk_4.wrestle_type = -1
attacker.actions:insert('#',action)
j = j + 1
end
end

...

wyrm = df.unit.find(wyrm_id)
miner = df.unit.find(args.miner)
wyrm.opponent.unit_id = args.miner      -- who it's supposed to attack
wyrm.opponent.unit_pos.x = miner.pos.x  -- where the target is
wyrm.opponent.unit_pos.y = miner.pos.y
wyrm.opponent.unit_pos.z = miner.pos.z
wyrm.opponent.anon_1 = 300              -- how long to stay in combat mode?
wyrm.mood = 7                           -- go berserk, the only reliable way to force more than a single attack
add_attack(wyrm_id,args.miner,3,12)     -- targets head, but seems to ignore instructions to attack with its tail

...

I dialed up the chance of spawning one and got it to appear at a fresh embark.  It took six of the Starting Seven about two weeks to kill the thing (the hunter was off doing his own thing), which seems about the balance I was looking for: dangerous to a lone miner but not fort-killing.  I'd rather not make it berserk, though, just so that withdrawal is an option where it can prowl the old mine tunnels and grow to full size.
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 #3084 on: September 10, 2015, 12:19:25 pm »

Looking over the code, what is the bit about it's tail?
Logged

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #3085 on: September 10, 2015, 12:24:41 pm »

Looking over the code, what is the bit about it's tail?
My understanding of add_attack was that you provided the target bodypart and the bodypart to be used for the attack.  Maybe I just misread that completely?  The thing's tail is body part index 12.

In any event, what is the normal value for attack velocity?  Is it 1, 100, 1000?  Having it really dialed down for an initial ambush is fine if the fight continues, but I'm curious what is considered a "normal" attack.
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 #3086 on: September 10, 2015, 12:36:47 pm »

Looking over the code, what is the bit about it's tail?
My understanding of add_attack was that you provided the target bodypart and the bodypart to be used for the attack.  Maybe I just misread that completely?  The thing's tail is body part index 12.

In any event, what is the normal value for attack velocity?  Is it 1, 100, 1000?  Having it really dialed down for an initial ambush is fine if the fight continues, but I'm curious what is considered a "normal" attack.

No, you are correct, it's odd that it isn't using the tails attack (does the creature have [ATTACK:SLAP:BODYPART:BY_CATEGORY:TAIL]?)

As for velocity, another script I am working on (which simulates inflicting wounds without the attack) uses these formulae for velocity (which were taken from a thread by Urist DaVinci)
Code: [Select]
function momentumitem(unit,velocity,item,material)
 weight = math.floor(item.size*material.solid_density/100000)
 weight_fraction = item.size*material.solid_density*10 - weight*1000000
 effweight=unit.body.size_info.size_cur/100+weight*100+weight_fraction/10000
 actweight=weight*1000+weight_fraction/1000
 vel=unit.body.size_info.size_base * dfhack.units.getPhysicalAttrValue(unit,0) * velocity/1000/effweight/1000
 mom=vel*actweight/1000+1
 return mom
end
function momentumbodypart(unit,velocity,bp,material)
 partsize = math.floor(unit.body.size_info.size_cur * bp.relsize / unit.body.body_plan.total_relsize)
 partweight = math.floor(partsize * material.solid_density / 100)
 vel = 100 * dfhack.units.getPhysicalAttrValue(unit,0) / 1000 * velocity / 1000
 mom = vel * partweight / 1000 + 1
 return mom
end

Typically I was seeing values in the 10-100 range. But it can vary a lot.
Logged

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #3087 on: September 10, 2015, 01:17:25 pm »

Yes it has a tail slap, but it is secondary priority.  Maybe that's the problem?

Another creature has claws, but I couldn't figure out how to specify all of them.  I just went with its right front hand (glossed as a "claw"), but that guy defaults to its primary bite attack as well.

It works fine for the mod it's in... I just want these guys to pop up and fight rather than wander off... but in a perfect world I would convince them they are in a normal fight rather than driving them berserk.

In case this helps:
Spoiler: Creature (click to show/hide)

This script is called by the mod when a miner strikes "Living Stone."  Whether the creature is an Awakened Stone or a Wyrm, and whether it is friendly or hostile, is decided by mod logic outside this script as passed through command line arguments.
A "hostile" creature is induced to attack immediately.  A "friendly" Awakened Stone is tame; a "friendly" Wyrm is simply a wild animal.
Spoiler: "Wake" script (click to show/hide)
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 #3088 on: September 10, 2015, 01:28:53 pm »

Oh, it's because attack.attack_id = 0. Use 2 for the tail attack and 1 for the claw attack (that should work I think)

Edit: The tail attack might be more like 5 if it can claw attack with all four claws
Logged

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #3089 on: September 10, 2015, 01:40:49 pm »

Oh, it's because attack.attack_id = 0. Use 2 for the tail attack and 1 for the claw attack (that should work I think)

Edit: The tail attack might be more like 5 if it can claw attack with all four claws
Oh!  That makes sense.  Thanks!
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
Pages: 1 ... 204 205 [206] 207 208 ... 360