Skip to content

Instantly share code, notes, and snippets.

@IndigoFenix
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IndigoFenix/13d56eaecd6038e63167 to your computer and use it in GitHub Desktop.
Save IndigoFenix/13d56eaecd6038e63167 to your computer and use it in GitHub Desktop.
Turns a selected unit into a ghost and back again. Works in adventure mode too!
--Turn ghost on or off
local unit=dfhack.gui.getSelectedUnit()
if unit == nil then
unit = df.unit.find(df.global.ui_advmode.player_id)
end
if unit then
if unit.flags1.dead then
unit.flags1.dead = false
unit.flags3.ghostly = true
else
if unit.body.components.body_part_status[0].missing then
unit.flags3.ghostly = false
unit.flags1.dead = true
else
unit.flags3.ghostly = not unit.flags3.ghostly
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment