DFHack / dfhack

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

fix/distracted : new script to meet impossible needs #1069

Open PeridexisErrant opened 7 years ago

PeridexisErrant commented 7 years ago

@rndmvar posted a neat script on Reddit, to fix distracted pets. I think it should be added to DFHack after

Reddit post follows.

This is in reference to Bug 9567

After seeing too many of my pets gain the distracted flag and flash angry yellow or red exclamation marks at me, I decided to see what I could do to remedy the problem. After a bit of research which lead me to the aforementioned bug page, I found that the pets/mobs have needs that may not be possible to fulfill due to their lack of being able to speak (I think socializing and praying require speech). So I put together a DFHack script that will set the distracted unit's need values to max levels, thus clearing the distracted debuff.

This script currently takes no arguments, and prints out the needs info of each unit before it changes those values. This will target all non-player race units currently, including non-player race traders, diplomats, sentient units aligned with the fort, and those things dwelling in the dark parts of the world. (That last one may lead to sudden !FUN! as distracted things appear to be far more sluggish)

You can find the script here: https://github.com/rndmvar/DFHack_scripts/blob/master/fix_distracted.rb

rndmvar commented 7 years ago

@PeridexisErrant, Thanks for the mention. I just updated the script to fix a few issues I found after further testing and use on my part. I could put in an argument for printing so that the script is silent by default, and maybe one for use on player dwarves. As it seems that there are a few issues with praying for dwarves that have multiple deities, see: http://mail.bay12games.com/dwarves/mantisbt/view.php?id=9324 That bug is fixed in later versions apparently, while I'm still running 0.42.03 myself. Ideally I would like to make a script that removes needs from units that cannot fulfill them due to lacking speech, but I don't currently know if that's possible.