Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 198 199 [200] 201 202 ... 373

Author Topic: DFHack 0.34.11 r3  (Read 1457454 times)

FogAnimal

  • Escaped Lunatic
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2985 on: February 10, 2013, 11:13:41 am »

My apologies if this is incredibly noobish, but can and if so how would DFHack be used to remove the insanity tag from a single dwarf?
  Any help is much appreciated.
Logged

Telgin

  • Bay Watcher
  • Professional Programmer
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2986 on: February 10, 2013, 01:03:27 pm »

So a unit can have more than one soul.

What effect, exactly, does that have?

I made a real quickie script to test if I could do it and, sure enough, it shows the creature as having two souls after using it:

I'm not sure there is any point yet, actually.  It's part of a frame work for future things I think.  Do reanimated zombies reuse the same unit but with a different soul?  That could be a potential future use if not.
Logged
Through pain, I find wisdom.

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2987 on: February 10, 2013, 01:43:39 pm »

So a unit can have more than one soul.

What effect, exactly, does that have?

I made a real quickie script to test if I could do it and, sure enough, it shows the creature as having two souls after using it:

I'm not sure there is any point yet, actually.  It's part of a frame work for future things I think.  Do reanimated zombies reuse the same unit but with a different soul?  That could be a potential future use if not.
uhh no it's really a new but that copies the identity of a corpse over an undead unit.
you can revive both the original unit and the corpse at the same time if 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

WillowLuman

  • Bay Watcher
  • They/Them Life is weird
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2988 on: February 10, 2013, 03:20:09 pm »

So, a zombie counts as a completely different entity, as in fort mode someone shows up as 'deceased' but their reanimated body shows up as 'Urist's corpse - undead.' If someone is resurrected, though, does it still make a new unit using their body or does it actually bring them back?
Logged
Dwarf Souls: Prepare to Mine
Keep Me Safe - A Girl and Her Computer (Illustrated Game)
Darkest Garden - Illustrated game. - What mysteries lie in the abandoned dark?

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2989 on: February 10, 2013, 03:55:51 pm »

So a unit can have more than one soul.

What effect, exactly, does that have?

I made a real quickie script to test if I could do it and, sure enough, it shows the creature as having two souls after using it:

Code: [Select]
-- It's a test!

function getMaxId()
local maxid = 0
  local units = df.global.world.units.all
  for _uid,unit in ipairs(df.global.world.units.all) do
    maxid = maxid + 1
end
return maxid
end

local selectedUnit = dfhack.gui.getSelectedUnit()

local maxid = getMaxId()+1

selectedUnit.status.souls:insert('#',
{
new = df.unit_soul,
unit_id = maxid,
race = 894, --this is Lord English in Fortbent, shouldn't cause any problems in vanilla etc. AFAIK. If it does, just change it to 1  or something.
sex = 1,
caste = 0,
unk1 = -1,
unk2 = -1,
unk3 = -1,
unk4 = -1,
anon_1 = 0,
anon_2 = 0,
anon_3 = -1,
anon_4 = -1,

}
)
There are two wrong (afaik) assumption here: 1st getting the max id of unit. 2nd that soul needs a new unit id.
I think it should be like this:
Code: [Select]
unit_id=selectedUnit.id
Also if you need next unit id its:
Code: [Select]
df.global.unit_next_id
but usually you don't need to mess with that.

vjek

  • Bay Watcher
  • If it didn't work, change the world so it does.
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2990 on: February 10, 2013, 04:09:37 pm »

My apologies if this is incredibly noobish, but can and if so how would DFHack be used to remove the insanity tag from a single dwarf?
  Any help is much appreciated.

This may be of help.
In particular:
Code: [Select]
[DFHack]# lua
[lua]# dfhack.gui.getSelectedUnit().mood = df.mood_type.None
[lua]# quit
I have not tested this myself, I have no idea if it will work or not.

FogAnimal

  • Escaped Lunatic
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2991 on: February 10, 2013, 06:29:14 pm »

My apologies if this is incredibly noobish, but can and if so how would DFHack be used to remove the insanity tag from a single dwarf?
  Any help is much appreciated.

This may be of help.
In particular:
Code: [Select]
[DFHack]# lua
[lua]# dfhack.gui.getSelectedUnit().mood = df.mood_type.None
[lua]# quit
I have not tested this myself, I have no idea if it will work or not.

Worked! You are a life saver, my thanks.
Logged

chairo

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2992 on: February 10, 2013, 08:34:55 pm »

Hello! I cannot run DFhack. I have installed it as the directions say, but every time I run DF, I get the message "Main index file missing/corrupted. The file "index" must be in the data folder. Make sure DF compressed into its folders properly". The problem is, it only does this when DFhack is installed. Index is in the data folder, and it is not corrupted.
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2993 on: February 11, 2013, 12:02:06 am »

how could I get the caste name of a unit?
« Last Edit: February 11, 2013, 12:27:08 am by Putnam »
Logged

Telgin

  • Bay Watcher
  • Professional Programmer
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2994 on: February 11, 2013, 12:28:03 am »

Looks like something like this should work, if you have a handle to the unit already.

Code: [Select]
local caste = df.creature_raw.find(unit.race).caste[unit.caste]
I don't know what the property is for the name of the caste, but you can do this in the Lua interpreter to print out all keys in a table:

Code: [Select]
for key, value in pairs(some_object) do print(key, value) end
You can substitute anything into some_object there, so you could do that with a caste variable or anything to dump out all of the properties.  That can be useful if you don't feel like looking it up in df-structures.
Logged
Through pain, I find wisdom.

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2995 on: February 11, 2013, 12:29:49 am »

I knew the latter one, but the former one I didn't, thanks!

Also, I usually just go into the lua interpreter and use the included (very handy) printall(table) function they have.

Okay, so what I was looking for is this:

df.creature_raw.find(unit.race).caste[unit.caste].caste_name[0]

Thanks again!

EDIT: Ah--how could I get the current adventurer unit?
« Last Edit: February 11, 2013, 12:53:43 am by Putnam »
Logged

Telgin

  • Bay Watcher
  • Professional Programmer
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2996 on: February 11, 2013, 12:56:25 am »

Also, I usually just go into the lua interpreter and use the included (very handy) printall(table) function they have.

I knew there had to be an easier way to do that.  How did I miss this in the documentation?   :-\

Quote
EDIT: Ah--how could I get the current adventurer unit?

No idea about that, unfortunately, since I never use adventure mode.  Is there a look command in adventure mode you can center over yourself?  You could probably get it through dfhack.gui.getSelectedUnit() in that case, but that's hardly suitable for automated scripts.
Logged
Through pain, I find wisdom.

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2997 on: February 11, 2013, 01:07:46 am »

Hmm. It appears that only adventurers (and perhaps former adventurers) have values in their adventurer_knows table, but I'll have to check that further.

WillowLuman

  • Bay Watcher
  • They/Them Life is weird
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2998 on: February 11, 2013, 01:08:12 am »

Hit z to go to your stats window, then use dfhack.gui.getselectedunit(print.id)

What is the adventurer_knows table?
Logged
Dwarf Souls: Prepare to Mine
Keep Me Safe - A Girl and Her Computer (Illustrated Game)
Darkest Garden - Illustrated game. - What mysteries lie in the abandoned dark?

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.34.11 r2
« Reply #2999 on: February 11, 2013, 01:15:07 am »

No idea, but it has a bunch of numbers (hist fig ids for units the player has talked to?) if the unit is an adventurer and nothing at all if unit is not an adventurer.

This function successfully found my adventurer:

Code: [Select]
function find_adventurer()
for _uid,unit in ipairs(df.global.world.units.all) do
if #unit.adventurer_knows~=0 then return unit end
end
end

player = find_adventurer()
« Last Edit: February 11, 2013, 01:20:35 am by Putnam »
Logged
Pages: 1 ... 198 199 [200] 201 202 ... 373