DFHack / dfhack

Memory hacking library for Dwarf Fortress and a set of tools that use it
Other
1.88k stars 476 forks source link

Create a tool to instate a baron #3370

Open myk002 opened 1 year ago

myk002 commented 1 year ago

so players have recourse when their baron dies and they suddenly can't get wagons again ever

something to do with entity_site_profilest

we could (eventually) extend this into a general nobles tool for programmatically assigning all types of nobles, perhaps subsuming the logic in make-monarch. So calling this particular tool nobles instead of something more specific to barons might help smooth things later.

myk002 commented 1 year ago

Instructions here: https://dwarffortresswiki.org/index.php/Wagon#When_do_caravans_bring_wagons.3F

azrazalea commented 1 year ago

I investigated this a little bit, with the current beta versions of DFhack and DF (50.10 betas).

I was able to replicate these instructions but slightly modified to add a baroness to a fort that didn't meet the requirements and didn't have one yet. The ramifications of this have not been studied. I don't know if caravans work or if you end up getting send a second baron once you meet requirements and what that might do. It may crash.

I put the steps I followed into that wiki section as highly experimental

azrazalea commented 1 year ago

So I did confirm that in my case killing my baron (with magma) resulted in some historical figure out there not in the fort inherting the title.

Based on this and the working info from the wiki I'm proposing the following as what we could script for a fix (needs to be fully tested)

  1. Find the info as suggested in the wiki on the position id, civ id, site id, etc etc
  2. Get the historical figure id of the dwarf you want to be baron (selected via GUI or given via unit id)
  3. Use that info and get the historical figure id of the dwarf who inherited the position
  4. If there is no dwarf currently assigned, the player hasn't become a barony yet (probably) so either display a large warning or bail.
  5. Go into gui/gm-editor df.historical_entity.find(df.global.plotinfo.civ_id).positions.assignments and change the historical figure id to be the dwarf you want it to be
  6. Go into gui/gm-editor df.historical_figure.find().entity_links for the inherited dwarf and remove or (if that's dangerous) modify the entry related to the position so it no longer points to our barony
  7. Go into the same for the person we want to be the baron and add the entity link

???

  1. Profit
myk002 commented 1 year ago

I think that looks reasonable. I'm not entirely sure how to maintain invariants for the entity links, but these steps are definitely a good start.