Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Converting "wild animals" to "guests"  (Read 581 times)

Anon_404

  • Bay Watcher
    • View Profile
Converting "wild animals" to "guests"
« on: May 13, 2018, 05:20:48 pm »

Been trying to figure out what tags are needed to convert a "wild animal" such as a gorlak or other "can_learn" to a guest to allow for the citizenship path. So far, I know that flag2:visitor will convert the unit into a friendly unit but will label it as a "visitor". Setting flag3:unk31 to true will display the unit as being a "Guest" and will display it's current activity (typically "No activity"). However, trying to "Zoom to unit" on the new guest or "View Units" them crashes the game.

Any thoughts on what the cause could be and how or if it could be fixed? (Error logs have been thoroughly unhelpful)
Logged

Anon_404

  • Bay Watcher
    • View Profile
Re: Converting "wild animals" to "guests"
« Reply #1 on: May 15, 2018, 06:12:53 pm »

Think I found the cause: the lack of a proper historical_figure id (-1) appeared to be causing the crash as changing it to any value (999 for example) will name the unit and display why they are there (such as "traveler"). My main concern now is how to check if a historical_figure id is already in use.

Any thoughts?
Logged

bloop_bleep

  • Bay Watcher
    • View Profile
Re: Converting "wild animals" to "guests"
« Reply #2 on: May 16, 2018, 01:43:51 am »

You have to assign it the next histfig ID in line and set up a bunch of references. Check out the create-unit.lua script included with DFHack; it should contain the code you need.
Logged
Quote from: KittyTac
The closest thing Bay12 has to a flamewar is an argument over philosophy that slowly transitioned to an argument about quantum mechanics.
Quote from: thefriendlyhacker
The trick is to only make predictions semi-seriously.  That way, I don't have a 98% failure rate. I have a 98% sarcasm rate.

Anon_404

  • Bay Watcher
    • View Profile
Re: Converting "wild animals" to "guests"
« Reply #3 on: May 16, 2018, 08:02:10 pm »

You have to assign it the next histfig ID in line and set up a bunch of references. Check out the create-unit.lua script included with DFHack; it should contain the code you need.

Thank you, the create-unit.lua does appear to have exactly what I'm looking for (in particular hist_figure_next_id).

Hopefully shouldn't have to mess around with it too much.
Logged