Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 [2] 3

Author Topic: Spawning in Necromancy Books/Adding Secrets etc. in DFHack?-  (Read 14326 times)

Eschar

  • Bay Watcher
  • hello
    • View Profile
Re: Spawning in Necromancy Books/Adding Secrets etc. in DFHack?-
« Reply #15 on: November 25, 2017, 11:40:44 am »

No sleep either, and no tiring - expect training can still tire them, which will then get stuck at that level, and zombies may attack necromancers anyway.

It has its uses, but it is overall simpler to just keep using the automated food and drink production you already have set up.

One could keep a separate vault full of a few necromancers as a backup force. Train them in arms, marksdwarfship, and farming. The farming is so they can get food - you could rotate people between farming and training - and since they don't reproduce, their food supply wouldn't be strained by the children who would be born in a vault full of normal dwarves.
Logged

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: Spawning in Necromancy Books/Adding Secrets etc. in DFHack?-
« Reply #16 on: November 25, 2017, 04:29:08 pm »

It's a neat idea, though I'd prefer a vault of vampires. What are they supposed to do with the food, though, given necros don't eat?

The training would have to be live, I think...Thankfully, they're necromancers, so they can make their own bait.

Eschar

  • Bay Watcher
  • hello
    • View Profile
Re: Spawning in Necromancy Books/Adding Secrets etc. in DFHack?-
« Reply #17 on: November 25, 2017, 07:58:57 pm »

What are they supposed to do with the food, though, given necros don't eat?

I didn't know about the lack of hunger beforehand: I just picked up on the lack of thirst because someone had mentioned it somewhere else in the thread.
Logged

Atomic Chicken

  • Bay Watcher
    • View Profile
Re: Spawning in Necromancy Books/Adding Secrets etc. in DFHack?-
« Reply #18 on: November 26, 2017, 01:31:47 pm »

Anychance you could give us the script for a book instead of a slab please?
Just no one will read a slab in fort mode.

Sorry about the delay; books are significantly more complex than slabs and I've been particularly busy as of late. Threw together a script for spawning secret-containing books as requested. Spawns necromancy books by default. You can change the book material, title, artifact status and secret contained by editing the first couple of lines of code where indicated. If you wish to use a different secret, specify it via its IS_NAME. Note that this script was written for 0.43.05, not the new version. May as well enjoy messing around with it while the latter undergoes bugfixing. I haven't tested it too thoroughly, so feel free to notify me if you encounter any issues.

Code: [Select]
--Author: Atomic Chicken
--Version: 0.43.05
--------------------------------------------------------------
--edit the following as desired:

--book material:
local material = 'INORGANIC:SILVER'
--book title:
local title = 'The Necronomicon'
--secret conveyed by the book (must use the IS_NAME of the secret)
local secret = 'the secrets of life and death'
--changing the following to false will make the book be treated as a copy:
local artifact = true
--------------------------------------------------------------

function getSecretId(secret)
  for _,i in ipairs(df.global.world.raws.interactions) do
    for _,is in ipairs (i.sources) do
      if getmetatable(is) == 'interaction_source_secretst' then
        if is.name == secret then
          return i.id
        end
      end
    end
  end
end

function createWriting(title,secret)
  local w = df.written_content:new()
  w.id = df.global.written_content_next_id
  w.title = title
  w.page_start = 1
  w.page_end = 42--number of pages
  w.styles:insert('#',7)--(forceful)
  w.style_strength:insert('#',0)--'the writing drives forward relentlessly'
  w.anon_3 = 50--'the prose is masterful'
 
  local ref = df.general_ref_interactionst:new()
  ref.interaction_id = getSecretId(secret)
  ref.source_id = 0
  ref.unk_08 = -1
  ref.unk_0c = -1
  w.refs:insert('#',ref)
  w.ref_aux:insert('#',0)
 
  df.global.written_content_next_id = df.global.written_content_next_id+1
  df.global.world.written_contents.all:insert('#',w)
  return w.id
end

local pos = copyall(df.global.cursor)
if pos.x <0 then
  error('Please place the cursor wherever you want to spawn the book.')
end

local m = dfhack.matinfo.find(material)
if not m then
  error('Invalid material.')
end

local book = df.item_bookst:new()
book.id = df.global.item_next_id
df.global.world.items.all:insert('#',book)
df.global.item_next_id = df.global.item_next_id+1
book:setMaterial(m['type'])
book:setMaterialIndex(m['index'])
book:categorize(true)
book.flags.removed = true
book:setSharpness(0,0)
book:setQuality(0)
book.title = title

local imp = df.itemimprovement_pagesst:new()
imp.mat_type = m['type']
imp.mat_index = m['index']
imp.count = 42--number of pages
imp.contents:insert('#',createWriting(title,secret))
book.improvements:insert('#',imp)
book.flags2.has_written_content = true

if artifact == true then
  local a = df.artifact_record:new()
  a.id = df.global.artifact_next_id
  df.global.artifact_next_id = df.global.artifact_next_id+1
  a.item = book
  a.name.first_name = title
  a.name.has_name = true
  a.flags:assign(df.global.world.artifacts.all[0].flags)
  a.anon_1 = -1000000
  a.anon_2 = -1000000
  a.anon_3 = -1000000
  df.global.world.artifacts.all:insert('#',a)
  local ref = df.general_ref_is_artifactst:new()
  ref.artifact_id = a.id
  book.general_refs:insert('#',ref)
 
  df.global.world.items.other.ANY_ARTIFACT:insert('#',book)
 
  local e = df.history_event_artifact_createdst:new()
  e.year = df.global.cur_year
  e.seconds = df.global.cur_year_tick
  e.id = df.global.hist_event_next_id
  e.artifact_id = a.id
  df.global.world.history.events:insert('#',e)
  df.global.hist_event_next_id = df.global.hist_event_next_id+1
end

dfhack.items.moveToGround(book,{x=pos.x,y=pos.y,z=pos.z})
« Last Edit: November 26, 2017, 01:52:23 pm by Atomic Chicken »
Logged
As mentioned in the previous turn, the most exciting field of battle this year will be in the Arstotzkan capitol, with plenty of close-quarter fighting and siege warfare.  Arstotzka, accordingly, spent their design phase developing a high-altitude tactical bomber. 

Purdurabo

  • Bay Watcher
    • View Profile
Re: Spawning in Necromancy Books/Adding Secrets etc. in DFHack?-
« Reply #19 on: November 28, 2017, 04:57:25 am »


Sorry about the delay; books are significantly more complex than slabs and I've been particularly busy as of late. Threw together a script for spawning secret-containing books as requested. Spawns necromancy books by default. You can change the book material, title, artifact status and secret contained by editing the first couple of lines of code where indicated. If you wish to use a different secret, specify it via its IS_NAME. Note that this script was written for 0.43.05, not the new version. May as well enjoy messing around with it while the latter undergoes bugfixing. I haven't tested it too thoroughly, so feel free to notify me if you encounter any issues.

Code: [Select]
--Author: Atomic Chicken
--Version: 0.43.05
--------------------------------------------------------------
--edit the following as desired:

--book material:
local material = 'INORGANIC:SILVER'
--book title:
local title = 'The Necronomicon'
--secret conveyed by the book (must use the IS_NAME of the secret)
local secret = 'the secrets of life and death'
--changing the following to false will make the book be treated as a copy:
local artifact = true
--------------------------------------------------------------

function getSecretId(secret)
  for _,i in ipairs(df.global.world.raws.interactions) do
    for _,is in ipairs (i.sources) do
      if getmetatable(is) == 'interaction_source_secretst' then
        if is.name == secret then
          return i.id
        end
      end
    end
  end
end

function createWriting(title,secret)
  local w = df.written_content:new()
  w.id = df.global.written_content_next_id
  w.title = title
  w.page_start = 1
  w.page_end = 42--number of pages
  w.styles:insert('#',7)--(forceful)
  w.style_strength:insert('#',0)--'the writing drives forward relentlessly'
  w.anon_3 = 50--'the prose is masterful'
 
  local ref = df.general_ref_interactionst:new()
  ref.interaction_id = getSecretId(secret)
  ref.source_id = 0
  ref.unk_08 = -1
  ref.unk_0c = -1
  w.refs:insert('#',ref)
  w.ref_aux:insert('#',0)
 
  df.global.written_content_next_id = df.global.written_content_next_id+1
  df.global.world.written_contents.all:insert('#',w)
  return w.id
end

local pos = copyall(df.global.cursor)
if pos.x <0 then
  error('Please place the cursor wherever you want to spawn the book.')
end

local m = dfhack.matinfo.find(material)
if not m then
  error('Invalid material.')
end

local book = df.item_bookst:new()
book.id = df.global.item_next_id
df.global.world.items.all:insert('#',book)
df.global.item_next_id = df.global.item_next_id+1
book:setMaterial(m['type'])
book:setMaterialIndex(m['index'])
book:categorize(true)
book.flags.removed = true
book:setSharpness(0,0)
book:setQuality(0)
book.title = title

local imp = df.itemimprovement_pagesst:new()
imp.mat_type = m['type']
imp.mat_index = m['index']
imp.count = 42--number of pages
imp.contents:insert('#',createWriting(title,secret))
book.improvements:insert('#',imp)
book.flags2.has_written_content = true

if artifact == true then
  local a = df.artifact_record:new()
  a.id = df.global.artifact_next_id
  df.global.artifact_next_id = df.global.artifact_next_id+1
  a.item = book
  a.name.first_name = title
  a.name.has_name = true
  a.flags:assign(df.global.world.artifacts.all[0].flags)
  a.anon_1 = -1000000
  a.anon_2 = -1000000
  a.anon_3 = -1000000
  df.global.world.artifacts.all:insert('#',a)
  local ref = df.general_ref_is_artifactst:new()
  ref.artifact_id = a.id
  book.general_refs:insert('#',ref)
 
  df.global.world.items.other.ANY_ARTIFACT:insert('#',book)
 
  local e = df.history_event_artifact_createdst:new()
  e.year = df.global.cur_year
  e.seconds = df.global.cur_year_tick
  e.id = df.global.hist_event_next_id
  e.artifact_id = a.id
  df.global.world.history.events:insert('#',e)
  df.global.hist_event_next_id = df.global.hist_event_next_id+1
end

dfhack.items.moveToGround(book,{x=pos.x,y=pos.y,z=pos.z})

Thank you so much my friend.
Logged

Purdurabo

  • Bay Watcher
    • View Profile
Re: Spawning in Necromancy Books/Adding Secrets etc. in DFHack?-
« Reply #20 on: November 28, 2017, 05:10:58 am »

What are they supposed to do with the food, though, given necros don't eat?

I didn't know about the lack of hunger beforehand: I just picked up on the lack of thirst because someone had mentioned it somewhere else in the thread.
Necro dwarfs are still alcoholics and get hungry even though they will not eat nor drink normally. This leeds to very unhappy distracted dwarfs who move and work like snails and who will no longer gain any levels in skills.

Now you can use a tavern to force a necro dwarf to drink which will allow them to work at a normal speed and skill up again for a few months but it is a very haphazard and inneficient way to do it. Maybe it will be possible to make it more reliable by using 2 man squads in a secluded tavern and then swapping the innkeeper position between both of them to get both a drink. But this would be extremely micro intensive and time consuming to maintain with a fort of more than 10 dwarfs.
Logged

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: Spawning in Necromancy Books/Adding Secrets etc. in DFHack?-
« Reply #21 on: November 28, 2017, 10:19:11 am »

None of the necromancers got hungry when I played in Bloodyhells, and most citizens were one.

They're alcohol dependent, though, yeah. Thankfully it seems the lone tavern keeper went to pick up a mug when a new person in tavern and then back to socializing instead of maniacal overfocus as I watched, but nonetheless the most useful dwarves were too busy to attend (due, e.g. a job backlog) unless I made them to.

Purdurabo

  • Bay Watcher
    • View Profile
Re: Spawning in Necromancy Books/Adding Secrets etc. in DFHack?-
« Reply #22 on: November 28, 2017, 12:07:48 pm »

When you look through their thoughts you will often see something along the line of "distracted due to not eating in ages".

Strangely enough after some more testing it does not seem to be the lack of alcohol which is the main problem. Just I limited my dwarfs population at 20 and used the visitor system to get about 30 non dwarf citizens  in my fort and yet about a year after becoming a necromancer they also became as slow as snails even though they are not alcoholics like my dwarfs. And yet on the other hand I have also seen the dramatic difference an innkeeper giving a slowed down necromancer a drink can make. Which makes me wonder if the main problem could possibly be due to severe dehydration rather than anthing else?
Logged

EPM

  • Bay Watcher
    • View Profile
Re: Spawning in Necromancy Books/Adding Secrets etc. in DFHack?-
« Reply #23 on: November 28, 2017, 12:32:23 pm »

Sorry about the delay; books are significantly more complex than slabs and I've been particularly busy as of late. Threw together a script for spawning secret-containing books as requested. Spawns necromancy books by default.

You're a hero. Thanks a lot for making this!
Logged

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: Spawning in Necromancy Books/Adding Secrets etc. in DFHack?-
« Reply #24 on: November 30, 2017, 05:21:52 am »

Are you sure your visitors don't need to drink anyway due seeing lot of deaths? A human may start out as alcohol-independent, but become so as they're driven to drink by trauma.

If not, might be distracted.

Purdurabo

  • Bay Watcher
    • View Profile
Re: Spawning in Necromancy Books/Adding Secrets etc. in DFHack?-
« Reply #25 on: December 01, 2017, 08:01:19 am »

No, they had definitly not been driven to alcoholism due to violence. They lacked the `don't really care about anything anymore` thought associated with it in non dwarfs and often even have a thought something along the line of `is not distracted after being kept from alcohol`.

After some further testing with them in the military it seems that merely having them rest(locked them in a room for a few days off duty) had the exact same effect as feeding them alcohol in that when put back on military duty they would train normally for a few days and skill up a little.

Also making a mixed squad of necro and normal soldiers ends up with the necromancers actually spending some time training instead of falling into the endless resting cycle. They still spend a fair bit of time resting but not all the time .

I have also finally got a goblin to ask to stay, when he asks for residency in 2 years it will be interesting to see if a creature which naturally does not need to eat nor drink nor is alcoholic is effected by the neco curse in the same way.
Logged

Purdurabo

  • Bay Watcher
    • View Profile
Re: Spawning in Necromancy Books/Adding Secrets etc. in DFHack?-
« Reply #26 on: December 02, 2017, 10:17:49 am »

It would seem that it is impossible for goblin citizens to learn the secret of life and death. My one read  multiple necro books , had happy thoughts about reading and learning and yet never became a necromancer.
Logged

Atomic Chicken

  • Bay Watcher
    • View Profile
Re: Spawning in Necromancy Books/Adding Secrets etc. in DFHack?-
« Reply #27 on: December 03, 2017, 01:53:56 pm »

It would seem that it is impossible for goblin citizens to learn the secret of life and death. My one read  multiple necro books , had happy thoughts about reading and learning and yet never became a necromancer.

Necromancy secrets are generated with [IT_REQUIRES:MORTAL], so they'll have no effect on immortal creatures like goblins and elves. You can get around this by adding a [MAXAGE:x:y] token to the respective creature raws.
Logged
As mentioned in the previous turn, the most exciting field of battle this year will be in the Arstotzkan capitol, with plenty of close-quarter fighting and siege warfare.  Arstotzka, accordingly, spent their design phase developing a high-altitude tactical bomber. 

Purdurabo

  • Bay Watcher
    • View Profile
Re: Spawning in Necromancy Books/Adding Secrets etc. in DFHack?-
« Reply #28 on: December 03, 2017, 07:14:26 pm »

Can goblins get Vampirism? And if so how do you spread vampirism  in a fort now that the well trick no longer works?
Logged

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: Spawning in Necromancy Books/Adding Secrets etc. in DFHack?-
« Reply #29 on: December 04, 2017, 02:43:29 am »

They can, but since they don't drink on their own you need to get them to topple a statue or hand them a poisoned chalice in adventure mode. Goblin vampires might be slightly more successful in worldgen due not being suspected of agelessness.
Pages: 1 [2] 3