Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 170 171 [172] 173 174 ... 360

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

Qrox

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2565 on: May 03, 2015, 11:50:35 pm »

I was trying to get rid of all the excessive dead plants in my map, so I made a script to walk through all the columns and find out the dead ones. And then I found there are df.global.world.plants.* which also contain the plants. So I have to remove them from those vectors too. Sadly, I just made deeper research and found the vectors are not sorted by address, it's just a false positive on a rough look. So my method will not work. Curiously there's no clue how the vectors are sorted or are they even sorted. I'm now curious how the game remove plants from all these vectors. (Linear search is a way but then the script slows to a crawl)

to lethosor: Yes, df.plant.find() treats the parameter as the index of an object in df.global.world.plants.all, and df.plant.find(ind) is equivalent to df.global.world.plants.all[ind] (iterated through the vector and it's true for every object inside it on game load)

Edit: when I removed the plants from all the vectors do I have to manually free the memory or is it automatically handled by dfhack? And to be honest I don't know how to free a c object from lua script. Google doesn't tell me either.
« Last Edit: May 03, 2015, 11:56:46 pm by Qrox »
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2566 on: May 03, 2015, 11:53:25 pm »

to lethosor: Yes, df.plant.find() treats the parameter as the index of an object in df.global.world.plants.all, and df.plant.find(ind) is equivalent to df.global.world.plants.all[ind] (iterated through the vector and it's true for every object inside it on game load)

No, it's plant id, not index in .all. The two are are important to distinguish, at least in most cases.

Qrox

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2567 on: May 04, 2015, 12:08:07 am »

to lethosor: Yes, df.plant.find() treats the parameter as the index of an object in df.global.world.plants.all, and df.plant.find(ind) is equivalent to df.global.world.plants.all[ind] (iterated through the vector and it's true for every object inside it on game load)

No, it's plant id, not index in .all. The two are are important to distinguish, at least in most cases.

I know items have an id but are you sure plants also have it? there are site_id and srb_id but they seem to be a constant -1

TheFlame52

  • Bay Watcher
  • Master of the randomly generated
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2568 on: May 04, 2015, 05:12:14 pm »

Where is the time until laying eggs in gm-editor?

Roses

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2569 on: May 05, 2015, 12:52:35 pm »

Questions:

1. If I give a unit several interactions is it possible to tell them not to use them all right away? Can I give them any logic behind using them? (besides the USAGE_HINT) Or staggering their usage?
2. Is there a function for computing the weight of a unit? I know there is the dfhack.units functions for figuring out speed and age and such, wondering if there is one for weight.
3. If I use add a syndrome with add-syndrome command with modtools/item-trigger -onEquip is it smart enough to know to remove the syndrome when the item is unequiped or do I need to add an -onUnequip version?
4. Similarly, does -onEquip only work if the actual inventory changes? What happens if I use another script to change one of the items material or subtype? Will it still run -onEquip or -onUnequip?
5. Does -onStrike only run if the target is wounded? What about if the attack is blocked/parried/dodged?
6. With the decoupling of movement and attack speeds, does CE_SPEED_CHANGE still affect both or just movement?
7. I am planning on either making a seperate plugin or an addition to the item-trigger script by allowing for -onParry and -onBlock. Currently the only way I see to do that is by using the eventful onReport and parsing the report for the required information. Is there another way to do it? Possibly an onAction event? I suppose if I make it a seperate plugin I could make it something like action-trigger and allow for dodging and such too?
Logged

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2570 on: May 05, 2015, 01:06:27 pm »

No clue on weight, and last time I tried to make a race and be clever by trying to use dragonbreath with a clean hint I was glad I had made them fireimmune super because they just sat around all day bathing each other in dragonfire.

Speed change just works on movement, weapons are by tick, I can say that for sure after running around at 9.9 speed and having other creatures trading swings with me despite being fast enough to hurl them through the air, run past them, and then jump out of their way as they slide to a stop.

Does anyone know where the check to see if you have something adjacent to grab takes place?

Similarly would it be possible to have a check for when a unit was about to slam into something so you could say, zero the speed back out? I tried tracking how it takes place in a jump but had no luck.
« Last Edit: May 05, 2015, 01:13:29 pm by Max™ »
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2571 on: May 05, 2015, 02:32:17 pm »

1. You could always have each interaction give the next one in sequence
2. I don't think one exists right now
3. You have to add the -onUnequip version
4. It will not
5. I believe so
6. Movement only
7. I made an onAction event in the DBZ mod that I use for some silly ki stuff, but it gets slow as the game gets more bloated (due to incrementing through every single unit in the active vector every tick).

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2572 on: May 05, 2015, 06:03:52 pm »

7 is what I worry about from trying to make a check for ground impact next tick.
Logged

Roses

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2573 on: May 05, 2015, 07:12:23 pm »

Thanks for the reply.

@Max, I'm not sure if it would help but there is the eventful event onProjUnitCheckMovement. I suppose you could use that and check and see if there are any obstacles next to the creature whenever it moves.
Logged

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2574 on: May 05, 2015, 11:23:03 pm »

Ooooh, didn't even notice that, gonna check it out thanks!
Logged

figment

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2575 on: May 06, 2015, 12:05:00 am »

Hi. Long time lurker.  I thought I'd post a little Windows - 0.40.24-r3 only plugin/hack for Adventure Mode Region Teleportation. 

So basically this is Adventure Mode World/Region map teleportation by site.  You can do this without going to the map so can use it while in a site or deep underground.

I missed the discussion on Adventure Mode teleport a couple of weeks ago and decided to find my own way to make this happen.  I did this because I sort of got tired of hunting down sites like vaults which showed up in Legends but I had difficulty actually locating.  Turns out it seems to be fairly complex operations but with some hacking I found some functions that when called seem to do the correct thing and teleport the adventurer from one map to another without too many consequences that I have found.

I don't know if this is properly generalizable to other platforms or other versions as I'm effectively using functions directly.  I did try to make it slightly more generic by using an Array of Bytes (AOB) scan rather than a fixed address to find the functions but those are easily broken by a recompile but at least have chance of working on future releases out of the box.

The source can be pulled from my github repo (advutils branch) if interested.

Release Notice: https://github.com/figment/dfhack/releases/tag/v1.0
Binaries:  https://github.com/figment/dfhack/releases/download/v1.0/dfhack-0.40.24-r3-Windows-adv_teleport-v1.zip

Usage:
gui/adv_teleport

The above will present a menu of nearby sites which allow teleportation. Scripting can be done directly via the adv_teleport(world.x,world.y,region.x,region.y) in plugins.advutils.  Generically, I added a Sites dialog similar to the Materials dialog based on that code so it could be useful for other things and maybe that could be useful enough to include in the main trunk.  The site dialog sorts by distance from current location and gives some basic filter options for finding interesting locations.

It does not support same map teleportation at this time and instead sets you down from orbit on the region of interest as you would coming off the map.  I also give an option to offset from the center so that you are not necessarily placed on top of multi-story building and only have the option to climb down.  I did use this to quickly escape from vaults and caves after getting lost or not wanting to climb out.

I believe if you are a traveling at night you can still get boogeymen intercepting you so I guess beware.  As the same map teleport also seems not currently achievable then I guess some of my next investigations might be there unless someone has a good way to do this now.  I've never visited hell in adventure mode so that could be cool for a few moments anyway and presumably that would be the way to do it unless you really work for it.

Also this is using direct function calls and df has so many global variables it sort of scares me so state could be corrupted by using this so save early and save often if you use it.  Having said that I've been using it without any observable side effects for some time but would welcome feedback if people found it useful or have issues with it.
Logged

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2576 on: May 06, 2015, 12:52:17 am »

Interesting method, I just added a check in gm-editor for travel mode that makes it open the adventurer army pos_1 and make use of the brief hop into travel mode when resting to exit underground sites by whacking my gm-editor keybind.
Logged

Box

  • Bay Watcher
  • [VERMINHUNTER]
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2577 on: May 06, 2015, 08:33:52 am »

Hi. Long time lurker.  I thought I'd post a little Windows - 0.40.24-r3 only plugin/hack for Adventure Mode Region Teleportation.

-snip-

oh my god i love you so much

I was trying to cross the ocean in adventure mode because I got tired of trying to walk around it and saw land on the other side but it was lagging so badly and took so long I tried using teleport commands I found around which led me to putnam's instant_transmission teleport since the ordinary teleport.lua command is nonfunctional and it's actually not useful at all except for getting yourself stuck underground.  You saved me!

Initial testing shows it worked absolutely fine.
Logged
You should come inside the box.

Then you'll know what I mean.

figment

  • Bay Watcher
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2578 on: May 06, 2015, 09:07:33 am »

Glad it worked for you.  That is basically the reason I did it.  And released it since I already put work into productizing it. In my last game I had to swim across and ocean and that is just plain boring. Also couldn't find a site I was searching for.

I will try the Army pos technique and see if I can make use of it.  It is probably the reliable long term solution and also cross platform way but still seems like its not quite there. 

The next problem i had was finding people so a quick view by name look up is probably the next script.  Already have one working but want an easier to use version.  This was inspired by trying to find a vampire (not that it helps as they wont fight you and you have to become a murderer anymore) and a demon but having difficulty.
Logged

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: DFHack 0.40.24-r3
« Reply #2579 on: May 06, 2015, 02:26:33 pm »

Well, the army method probably wouldn't be too hard to expand into a full script, but I really prefer incorporating it into gm-editor so I haven't poked too much at trying to do it. It does have the limitation that you have to either be able to rest or travel to use it since otherwise it won't be able to find your army and open it up.
Logged
Pages: 1 ... 170 171 [172] 173 174 ... 360