Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: DFHack Question  (Read 604 times)

They Got Leader

  • Bay Watcher
  • Current Fortress:
    • View Profile
    • Steam Profile
DFHack Question
« on: December 27, 2017, 08:47:29 pm »

Is there a way to clear Distraction status from a creature? I have a birds that are all "distracted".

More info on this other thread: http://www.bay12forums.com/smf/index.php?topic=168850.0
Logged
Quote from: Urist McDwarfFortress
You do not understand the ways of Toady One. He is not a business, he's just a guy trying to make a fun game. He's invited people to come along and experience the journey with him (and help him test it out as he goes along). At the end of the day, I don't think his main goal is to sell Dwarf Fortress, its just to create the best game possible.

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack Question
« Reply #1 on: December 27, 2017, 11:27:13 pm »

Better to ask in here.

Anyway, this script should remove all distraction from the highlighted unit:

Code: [Select]
local unit_personality=dfhack.gui.getSelectedUnit().status.current_soul.personality

for k,need in ipairs(unit_personality.needs) do
    need.focus_level=400
end

unit_personality.flags.has_unmet_needs=false

unit_personality.current_focus=unit_personality.undistracted_focus

Put that into a lua file, highlight your unit, run the script.

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack Question
« Reply #2 on: December 27, 2017, 11:44:22 pm »

Mind if I steal that for an "official" script?
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

They Got Leader

  • Bay Watcher
  • Current Fortress:
    • View Profile
    • Steam Profile
Re: DFHack Question
« Reply #3 on: December 27, 2017, 11:48:58 pm »

Sorry for putting this in the wrong place. Either way, thank you. I will run it and make sure it works.

Nevermind. Figured it out. It works, yay!
« Last Edit: December 28, 2017, 12:03:08 am by They Got Leader »
Logged
Quote from: Urist McDwarfFortress
You do not understand the ways of Toady One. He is not a business, he's just a guy trying to make a fun game. He's invited people to come along and experience the journey with him (and help him test it out as he goes along). At the end of the day, I don't think his main goal is to sell Dwarf Fortress, its just to create the best game possible.