Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 330 331 [332] 333 334 ... 373

Author Topic: DFHack 0.34.11 r3  (Read 1453038 times)

PeridexisErrant

  • Bay Watcher
  • Dai stihó, Hrasht.
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4965 on: December 13, 2013, 05:45:39 pm »

Apologies - I just went and checked my old fort, and it wasn't working the way I thought for coke (which explains where my logs kept disappearing to).  The similar trick is to set high thresholds for green glass, and lower for stone (eg pots); that way if the glass furnaces are bottlenecked for some reason the fort doesn't grind to a halt and tantrum. 

You might be able to stick something together with the Stockflow plugin, I guess. 
Logged
I maintain the DF Starter Pack - over a million downloads and still counting!
 Donations here.

greycat

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4966 on: December 14, 2013, 02:18:54 pm »

I keep getting these errors in the tty console:
Code: [Select]
/usr/local/src/LFR/hack/scripts/itemsyndrome.lua:32: attempt to index local 'material' (a nil value)
stack traceback:
/usr/local/src/LFR/hack/scripts/itemsyndrome.lua:32: in function 'getMaterial'
/usr/local/src/LFR/hack/scripts/itemsyndrome.lua:269: in function 'checkAndAddSyndrome'
/usr/local/src/LFR/hack/scripts/itemsyndrome.lua:304: in function </usr/local/src/LFR/hack/scripts/itemsyndrome.lua:303>
This is with LFR 0.21a ASCII Edition and self-compiled DFHack from git, as described earlier in this thread.  The errors don't appear to cause the game to crash or misbehave (at least not in any obvious way), and they only appear once in a while, at times that don't follow any pattern I can see.
Logged
Hell, if nobody's suffocated because of it, it hardly counts as a bug! -- StLeibowitz

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4967 on: December 14, 2013, 03:39:57 pm »

DAMMIT, how many times do I have to fix that?

...

Use this version.

Thundercraft

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4968 on: December 16, 2013, 11:50:58 pm »

Recently, the breeding from egg-laying invader mounts thread caught my attention. It talked about the obstacles involved, with the main one being:

Invader mounts can be trained/tamed once, and only once, after which they disappear off your animal list. They will revert to wild status eventually and can't be retrained, but gain all the benefits of having been part of your fort: loyalty cascade if you kill them with soldiers and immunity to traps (not to lever or otherwise triggered upright spikes though), plus they remain an enemy iirc so instead of running away and hopefully off the map, they'll attack your dorfs.

Questions:
Shouldn't it be possible to use a DFHack script to at least change the hostility of said invader mounts, if not make them a permanent part of your fort?

What about the old "Toggle hostile" script from DFusion?

I did a search in the dfusion folder from the lastest (r3) release, but I could not find a script containing the name "hostile". Also, I can't find a mention of such a script in the DFHack readme.

Was "Toggle hostile" not ported over? Is DFHack still missing a lot of DFusion scripts? For that matter, would it even work in Fort mode? (Originally for Adventure mode.) Would it work on a hostile invader mount?
« Last Edit: December 16, 2013, 11:53:38 pm by Thundercraft »
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4969 on: December 16, 2013, 11:52:06 pm »

Yes to all of that, right now.

Making enemies allies is not difficult at all. You just need to muck around with their entity links and allegiances.

Thundercraft

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4970 on: December 17, 2013, 12:04:04 am »

Yes to all of that, right now.

Interesting. Though, I had assumed Toggle Hostile would not work properly for this purpose without a lot of changes.

Making enemies allies is not difficult at all. You just need to muck around with their entity links and allegiances.

Simple, perhaps, for those familiar with the inner workings of DF and DFHack.

I take it, then, there are not any scripts already written to do this? Perhaps something similar that I could study and apply to a different use? Or maybe some documentation? I could not find a mention of "entity links" or "allegiences" in the Readme. (Though, I also understand that the Readme desperately needs updating. Over a year old?)
Logged

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4971 on: December 17, 2013, 12:25:31 am »

The main source of "knowledge" about dfhack is not any readme, and will never be a readme. It can only tell you about the fixed part of dfhack i.e. the part we wrote, the part that has the infrastructure, the usage details of plugins etc... We can't (or at least i won't) write a guide/readme about the part thats from DF. The part that holds e.g. entity membership. The main reasons are: it will probably change with next df version, there is a ton of it, nobody (except Toady One) knows what does what exactly. Other than that the fastest way is either to dig through df-structures , join our irc channel and ask around, try using gui/gm-editor to get the feel for structures and inner working of df, analyze the other plugins and scripts. The best example is creature creation script. It was not made for so long because nobody knew how it works and some fields were unknown. After some playing around (and df crashing) we have a working creature spawning script. Though it still is missing a lot of details and customization (e.g. memberships, history, starting afflictions, event birth date(age), inventory, maybe appearance customization, beliefs and family relations and so on) my idea was to spawn a creature and then modify it to your liking.

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4972 on: December 17, 2013, 12:26:07 am »

mmm I've got something that makes a unit an ally in adventure mode; it shouldn't be too difficult to edit it for fort mode.

Code: [Select]
local args={...}

local unit = args[1] and df.unit.find(args[1]) or dfhack.gui.getSelectedUnit()

local unitnem = dfhack.units.getNemesis(unit)

local unitfig = df.historical_figure.find(unit.hist_figure_id)

local adv = df.global.world.units.active[0]

local advnem = dfhack.units.getNemesis(adv)

unit.relations.group_leader_id=adv.id

if unitnem then
unitnem.group_leader_id=advnem.id
end
if advnem and unitnem then
advnem.companions:insert('#',unitnem.id)
end

if unitfig then
for i=1,#unitfig.entity_links do
unitfig.entity_links:erase(0)
end
end
unit.civ_id=(df.global.world.units.active[0].civ_id)

Thundercraft

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4973 on: December 17, 2013, 03:00:01 am »

The main source of "knowledge" about dfhack is not any readme, and will never be a readme. It can only tell you about the fixed part of dfhack i.e. the part we wrote, the part that has the infrastructure, the usage details of plugins etc... We can't (or at least i won't) write a guide/readme about the part thats from DF...

Understood. I knew there wasn't a comprehensive guide or anything. But I had no idea where to start.

Other than that the fastest way is either to dig through df-structures , join our irc channel and ask around, try using gui/gm-editor to get the feel for structures and inner working of df, analyze the other plugins and scripts. The best example is creature creation script...

:) Thank you for the tips.

mmm I've got something that makes a unit an ally in adventure mode; it shouldn't be too difficult to edit it for fort mode.

{code}

Oh, thanks! That looks like a good starting point.
Logged

Sutremaine

  • Bay Watcher
  • [ETHIC:ATROCITY: PERSONAL_MATTER]
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4974 on: December 17, 2013, 10:24:31 am »

What's COMBATHARDNESS called for the purposes of DFHack scripts? Specifically, I'd like it to be able to examine how 'tragic' an individual effect is.
Logged
I am trying to make chickens lay bees as eggs. So far it only produces a single "Tame Small Creature" when a hen lays bees.
Honestly at the time, I didn't see what could go wrong with crowding 80 military Dwarves into a small room with a necromancer for the purpose of making bacon.

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: DFHack 0.34.11 r3
« Reply #4975 on: December 17, 2013, 01:28:28 pm »

What's COMBATHARDNESS called for the purposes of DFHack scripts? Specifically, I'd like it to be able to examine how 'tragic' an individual effect is.
In Lua, you should be able to use "df.misc_trait_type.Hardened".
Logged
P.S. If you don't get this note, let me know and I'll write you another.
It's amazing how dwarves can make a stack of bones completely waterproof and magmaproof.
It's amazing how they can make an entire floodgate out of the bones of 2 cats.

Sutremaine

  • Bay Watcher
  • [ETHIC:ATROCITY: PERSONAL_MATTER]
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4976 on: December 17, 2013, 02:49:39 pm »

How do I use it? I've been using the getbloodcount script as a base and replacing unit.body.blood_count with whatever will make it give out the number I'm after, but it either gives me various errors or returns the number 15. I tried running that one on two dwarves with different descriptions of their combat hardiness, and should have gotten two different numbers.

The original getbloodcount script:

Spoiler (click to show/hide)
Logged
I am trying to make chickens lay bees as eggs. So far it only produces a single "Tame Small Creature" when a hen lays bees.
Honestly at the time, I didn't see what could go wrong with crowding 80 military Dwarves into a small room with a necromancer for the purpose of making bacon.

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4977 on: December 17, 2013, 03:59:01 pm »

You should be using df.unit.find(num) there, not df.global.world.units.all[num].

Also, for combathardness you want dfhack.units.getMiscTrait(unit,df.misc_trait_type.Hardened,true)

The true is optional (it creates the misc trait if the creature doesn't have one) but I don't think it'll hurt anything.

Sutremaine

  • Bay Watcher
  • [ETHIC:ATROCITY: PERSONAL_MATTER]
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4978 on: December 17, 2013, 06:40:09 pm »

Okay, here's what I've got now.

Spoiler (click to show/hide)

What it's outputting now is <unit_misc_trait: 0x1C71a220> , with a different memory address for each unit.

I assume I need to connect the 'get_misc_trait' part of the script to the 'print(getTraumaCount(traumaCountUnit))' part, but I don't know how.
Logged
I am trying to make chickens lay bees as eggs. So far it only produces a single "Tame Small Creature" when a hen lays bees.
Honestly at the time, I didn't see what could go wrong with crowding 80 military Dwarves into a small room with a necromancer for the purpose of making bacon.

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #4979 on: December 17, 2013, 06:42:43 pm »

You want to add a .value at the end of your getTraumaCount(traumaCountUnit) thing:

print(getTraumaCount(traumaCountUnit).value)
Pages: 1 ... 330 331 [332] 333 334 ... 373