v50 Steam/Premium information for editors
  • v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
  • Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.

Editing User:Andux/Scripts

Jump to navigation Jump to search

Warning: You are not logged in.
Your IP address will be recorded in this page's edit history.


The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 58: Line 58:
 
"umma", "undi", "unga", "unni",  
 
"umma", "undi", "unga", "unni",  
 
"vala", "vali", "vara", "vari", "vina",
 
"vala", "vali", "vara", "vari", "vina",
 
 
"ya",
 
"ya",
 
"zadi", "zani", "zara", "zi"
 
"zadi", "zani", "zara", "zi"
Line 153: Line 152:
  
 
===Urbanizer===
 
===Urbanizer===
For older versions of Dwarf Fortress--converts all forest retreats to visitable towns.
+
Converts all forest retreats to visitable towns.
 
<pre style="overflow: auto;">
 
<pre style="overflow: auto;">
 
for k,v in pairs(df.global.world.world_data.sites) do
 
for k,v in pairs(df.global.world.world_data.sites) do
Line 164: Line 163:
  
 
==General==
 
==General==
 +
===HealUnit===
 +
Repairs all health issues except for syndromes and severed limbs.
 +
<pre style="overflow: auto;">
 +
local unit=dfhack.gui.getSelectedUnit()
 +
if unit then
 +
print("Erasing wounds...")
 +
while #unit.body.wounds > 0 do
 +
unit.body.wounds:erase(#unit.body.wounds-1)
 +
end
 +
unit.body.wound_next_id=1
 +
 +
print("Refilling blood...")
 +
unit.body.blood_count=unit.body.blood_max
 +
 +
print("Resetting status flags...")
 +
 +
-- for DFHack >= 0.34.11 r3
 +
unit.status2.limbs_stand_count=unit.status2.limbs_stand_max
 +
unit.status2.limbs_grasp_count=unit.status2.limbs_grasp_max
 +
-- for older versions, use these instead:
 +
--unit.status2.able_stand_impair=unit.status2.able_stand
 +
--unit.status2.able_grasp_impair=unit.status2.able_grasp
 +
 +
unit.flags2.has_breaks=false
 +
unit.flags2.gutted=false
 +
unit.flags2.circulatory_spray=false
 +
unit.flags2.vision_good=true
 +
unit.flags2.vision_damaged=false
 +
unit.flags2.vision_missing=false
 +
unit.flags2.breathing_good=true
 +
unit.flags2.breathing_problem=false
 +
 +
unit.flags2.calculated_nerves=false
 +
unit.flags2.calculated_bodyparts=false
 +
 +
print("Resetting counters...")
 +
unit.counters.winded=0
 +
unit.counters.stunned=0
 +
unit.counters.unconscious=0
 +
unit.counters.webbed=0
 +
unit.counters.pain=0
 +
unit.counters.nausea=0
 +
unit.counters.dizziness=0
 +
 +
unit.counters2.paralysis=0
 +
unit.counters2.fever=0
 +
unit.counters2.exhaustion=0
 +
unit.counters2.hunger_timer=0
 +
unit.counters2.thirst_timer=0
 +
unit.counters2.sleepiness_timer=0
 +
unit.counters2.vomit_timeout=0
 +
 +
end
 +
</pre>
  
 
===GoodAsNew===
 
===GoodAsNew===
Line 185: Line 238:
 
r.wear_timer=0
 
r.wear_timer=0
 
printall(r)
 
printall(r)
end
 
</pre>
 
 
===Kinsey===
 
<pre style="overflow: auto;">
 
-- View or change the sexual orientation of the selected unit.
 
 
--[====[
 
 
kinsey
 
======
 
View or change the sexual orientation of the selected unit. Usage:
 
 
:kinsey:
 
    Print the unit's orientation flags.
 
:kinsey -asexual:
 
    Change flags so that the unit will not romance or marry anyone.
 
:kinsey -rf:
 
    Allow the unit to romance females.
 
:kinsey -rm:
 
    Allow the unit to romance males.
 
:kinsey -mf:
 
    Allow the unit to marry females.
 
:kinsey -mm:
 
    Allow the unit to marry males.
 
:kinsey -indeterminate:
 
    Mark the unit's orientation as indeterminate (default for adventurers).
 
 
Apart from the -asexual flag, any of the options above can be used together;
 
for example, ``kinsey -rm -mf`` will allow a unit to romance either sex, but
 
only marry females.
 
 
]====]
 
 
local utils = require('utils')
 
 
local validArgs = utils.invert({
 
    'asexual',
 
    'rf',
 
    'rm',
 
    'mf',
 
    'mm',
 
    'indeterminate',
 
    'help',
 
})
 
 
local args = utils.processArgs({...}, validArgs)
 
 
if args.help then
 
print(dfhack.script_help())
 
return
 
end
 
 
local unit = dfhack.gui.getSelectedUnit()
 
if not unit then
 
qerror('Error: please select a unit.')
 
end
 
 
local hf = df.historical_figure.find(unit.hist_figure_id)
 
if not hf then
 
print("Warning: Couldn't find histfig data for this unit.")
 
end
 
 
if unit then
 
if args.asexual then
 
unit.status.current_soul.orientation_flags.indeterminate = false
 
unit.status.current_soul.orientation_flags.romance_male = false
 
unit.status.current_soul.orientation_flags.marry_male = false
 
unit.status.current_soul.orientation_flags.romance_female = false
 
unit.status.current_soul.orientation_flags.marry_female = false
 
print("Unit orientation flags cleared.")
 
if hf then
 
hf.orientation_flags.indeterminate = false
 
hf.orientation_flags.romance_male = false
 
hf.orientation_flags.marry_male = false
 
hf.orientation_flags.romance_female = false
 
hf.orientation_flags.marry_female = false
 
print("Changes propagated to histfig data.")
 
end
 
 
elseif args.indeterminate or args.rm or args.mm or args.rf or args.mf then
 
unit.status.current_soul.orientation_flags.indeterminate = (args.indeterminate~=nil)
 
unit.status.current_soul.orientation_flags.romance_male = (args.rm~=nil)
 
unit.status.current_soul.orientation_flags.marry_male = (args.mm~=nil)
 
unit.status.current_soul.orientation_flags.romance_female = (args.rf~=nil)
 
unit.status.current_soul.orientation_flags.marry_female = (args.mf~=nil)
 
print("Unit orientation flags updated.")
 
if hf then
 
hf.orientation_flags.indeterminate = unit.status.current_soul.orientation_flags.indeterminate
 
hf.orientation_flags.romance_male = unit.status.current_soul.orientation_flags.romance_male
 
hf.orientation_flags.marry_male = unit.status.current_soul.orientation_flags.marry_male
 
hf.orientation_flags.romance_female = unit.status.current_soul.orientation_flags.romance_female
 
hf.orientation_flags.marry_female = unit.status.current_soul.orientation_flags.marry_female
 
print("Histfig data updated to match.")
 
end
 
end
 
 
print("Current orientation flags:")
 
print("  indeterminate: ", unit.status.current_soul.orientation_flags.indeterminate)
 
print("  romance_male:  ", unit.status.current_soul.orientation_flags.romance_male)
 
print("  marry_male:    ", unit.status.current_soul.orientation_flags.marry_male)
 
print("  romance_female:", unit.status.current_soul.orientation_flags.romance_female)
 
print("  marry_female:  ", unit.status.current_soul.orientation_flags.marry_female)
 
 
end
 
end
 
</pre>
 
</pre>

Please note that all contributions to Dwarf Fortress Wiki are considered to be released under the GFDL & MIT (see Dwarf Fortress Wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:

Cancel Editing help (opens in new window)