I've requested a user page on the wiki, but apparently those requests all go through a single user, and none of the last half dozen user pages have content, so I'm not sure it's actually being done. In any case, this will have to do until I can get a user page there.
This script...
... is for 34.10 (yes, I know 34.11 was just released)
... combines a bunch of functionality from my previous scripts, but does not replace them.
... will make changes to ALL YOUR DWARVES. All of them. Not just one. All.
If the script is executed without any arguments, it runs the equivalent of rejuvenate, elevate_physical, elevate_mental, and brainwash on all dwarves currently on the map. It will only rejuvenate dwarves 21 years or older.
If the script has been copied into /df_install_dir/hack/scripts/ , you'll see the following
[DFHack]# ls
...
scripts:
armoks_blessing - Adjust all attributes, personality, age and skills of all dwarves in play
Now running the script by itself
[DFHack]# armoks_blessing
No skillname supplied, no skills will be adjusted. Pass argument 'list' to see a skill list, 'classes' to show skill classes, or use 'all' if you want all skills legendary.
Adjusting Nil Laruzol
Adjusting Sibrek Sarveshtangath
Adjusting Aban Oltarmörul
Adjusting Olon Kolakmam
Adjusting Edzul Isonzas
Adjusting Ast Mamotiden
Adjusting Doren Aranònul
[DFHack]#
I ran that on a new embark with just the starting seven. What it did:
- changed all the personality values to "an ideal", the specifics of which are in the code.
- adjusted all mental and physical attributes to 2600
- reduced the age of all dwarves older than 20 to age 20.
The script will accept arguments. Use 'list' or 'classes' to see them, but the most common ones will be:
all
Normal
MilitaryDefense
MilitaryAttack
MINING
CARPENTRY
etc
all - this makes all your dwarves legendary in all skills. All. Every single one.
Normal - this makes your dwarves legendary in the common labour skills plus a few extras (exactly shown with 'list' )
MilitaryDefense - the defensive military skills (dodge, armor, shield) are all made legendary
MilitaryAttack - the offensive military skills (weapons, fighting, biting, etc) are all made legendary.
MINING - all dwarves are made into legendary miners.
Example:
[DFHack]# armoks_blessing CARPENTRY
Adjusting Nil Laruzol
nil is now a Legendary Carpenter
Adjusting Sibrek Sarveshtangath
sibrek is now a Legendary Carpenter
Adjusting Aban Oltarmörul
aban is now a Legendary Carpenter
Adjusting Olon Kolakmam
olon is now a Legendary Carpenter
Adjusting Edzul Isonzas
edzul is now a Legendary Carpenter
Adjusting Ast Mamotiden
ast is now a Legendary Carpenter
Adjusting Doren Aranònul
doren is now a Legendary Carpenter
[DFHack]#Another example:
[DFHack]# armoks_blessing Normal
Adjusting Nil Laruzol
Skill Mining is type: Normal and is now Legendary for nil
...
Skill Wax Working is type: Normal and is now Legendary for nil
Adjusting Sibrek Sarveshtangath
Skill Mining is type: Normal and is now Legendary for sibrek
...
Skill Wax Working is type: Normal and is now Legendary for sibrek
Adjusting Aban Oltarmörul
Skill Mining is type: Normal and is now Legendary for aban
...
Skill Wax Working is type: Normal and is now Legendary for aban
Adjusting Olon Kolakmam
Skill Mining is type: Normal and is now Legendary for olon
...
Skill Wax Working is type: Normal and is now Legendary for olon
Adjusting Edzul Isonzas
Skill Mining is type: Normal and is now Legendary for edzul
...
Skill Wax Working is type: Normal and is now Legendary for edzul
Adjusting Ast Mamotiden
Skill Mining is type: Normal and is now Legendary for ast
...
Skill Wax Working is type: Normal and is now Legendary for ast
Adjusting Doren Aranònul
Skill Mining is type: Normal and is now Legendary for doren
...
Skill Wax Working is type: Normal and is now Legendary for doren
[DFHack]#The previous scripts work on single dwarves, this one works on all the dwarves currently on the map.
You should be REALLY REALLY sure you want to affect ALL YOUR DWARVES before you even copy this script into your /hack/scripts/ directory, and you should definitely have a backup/save ready in case you make changes you weren't expecting.
I would also recommend pausing the game before you run it. Enjoy! And please PM me if you find any problems with using this script in DF/dfhack 34.10.
-- Adjust all attributes, personality, age and skills of all dwarves in play
-- place in /hack/scripts/ for ease of use
-- without arguments, all attributes, age & personalities are adjusted
-- arguments allow for skills to be adjusted as well
-- WARNING: USING THIS SCRIPT WILL ADJUST ALL DWARVES IN PLAY!
-- by vjek, version 1, 20120623, for DF(hack) 34.10
-- Praise Armok!
-- ---------------------------------------------------------------------------
function rejuvenate(v)
local current_year,newbirthyear
unit=v
if unit==nil then
print ("No unit available! Aborting with extreme prejudice.")
return
end
current_year=df.global.cur_year
newbirthyear=current_year - 20
if unit.relations.birth_year < newbirthyear then
unit.relations.birth_year=newbirthyear
end
end
-- ---------------------------------------------------------------------------
function brainwash_unit(v)
unit=v
if unit==nil then
print ("No unit available! Aborting with extreme prejudice.")
return
end
unit.status.current_soul.traits.ANXIETY=1
unit.status.current_soul.traits.ANGER=1
unit.status.current_soul.traits.DEPRESSION=1
unit.status.current_soul.traits.SELF_CONSCIOUSNESS=1
unit.status.current_soul.traits.IMMODERATION=1
unit.status.current_soul.traits.VULNERABILITY=1
unit.status.current_soul.traits.FRIENDLINESS=99
unit.status.current_soul.traits.GREGARIOUSNESS=99
unit.status.current_soul.traits.ASSERTIVENESS=99
unit.status.current_soul.traits.ACTIVITY_LEVEL=99
unit.status.current_soul.traits.EXCITEMENT_SEEKING=99
unit.status.current_soul.traits.CHEERFULNESS=99
unit.status.current_soul.traits.IMAGINATION=99
unit.status.current_soul.traits.ARTISTIC_INTEREST=99
unit.status.current_soul.traits.EMOTIONALITY=99
unit.status.current_soul.traits.ADVENTUROUSNESS=99
unit.status.current_soul.traits.INTELLECTUAL_CURIOSITY=99
unit.status.current_soul.traits.LIBERALISM=1
unit.status.current_soul.traits.TRUST=99
unit.status.current_soul.traits.STRAIGHTFORWARDNESS=99
unit.status.current_soul.traits.ALTRUISM=99
unit.status.current_soul.traits.COOPERATION=99
unit.status.current_soul.traits.MODESTY=99
unit.status.current_soul.traits.SYMPATHY=99
unit.status.current_soul.traits.SELF_EFFICACY=99
unit.status.current_soul.traits.ORDERLINESS=99
unit.status.current_soul.traits.DUTIFULNESS=99
unit.status.current_soul.traits.ACHIEVEMENT_STRIVING=99
unit.status.current_soul.traits.SELF_DISCIPLINE=99
unit.status.current_soul.traits.CAUTIOUSNESS=99
end
-- ---------------------------------------------------------------------------
function elevate_attributes(v)
local demigod = 2600
unit=v
if unit==nil then
print ("No unit available! Aborting with extreme prejudice.")
return
end
unit.body.physical_attrs.STRENGTH.unk1=demigod
unit.body.physical_attrs.AGILITY.unk1=demigod
unit.body.physical_attrs.TOUGHNESS.unk1=demigod
unit.body.physical_attrs.ENDURANCE.unk1=demigod
unit.body.physical_attrs.RECUPERATION.unk1=demigod
unit.body.physical_attrs.DISEASE_RESISTANCE.unk1=demigod
unit.status.current_soul.mental_attrs.ANALYTICAL_ABILITY.unk1=demigod
unit.status.current_soul.mental_attrs.FOCUS.unk1=demigod
unit.status.current_soul.mental_attrs.WILLPOWER.unk1=demigod
unit.status.current_soul.mental_attrs.CREATIVITY.unk1=demigod
unit.status.current_soul.mental_attrs.INTUITION.unk1=demigod
unit.status.current_soul.mental_attrs.PATIENCE.unk1=demigod
unit.status.current_soul.mental_attrs.MEMORY.unk1=demigod
unit.status.current_soul.mental_attrs.LINGUISTIC_ABILITY.unk1=demigod
unit.status.current_soul.mental_attrs.SPATIAL_SENSE.unk1=demigod
unit.status.current_soul.mental_attrs.MUSICALITY.unk1=demigod
unit.status.current_soul.mental_attrs.KINESTHETIC_SENSE.unk1=demigod
unit.status.current_soul.mental_attrs.EMPATHY.unk1=demigod
unit.status.current_soul.mental_attrs.SOCIAL_AWARENESS.unk1=demigod
end
-- ---------------------------------------------------------------------------
function make_legendary(skillname,v)
local skillnamenoun,skillnum
unit=v
if unit==nil then
print ("No unit available! Aborting with extreme prejudice.")
return
end
if (df.job_skill[skillname]) then
skillnamenoun = df.job_skill.attrs[df.job_skill[skillname]].caption_noun
else
print ("The skill name provided is not in the list.")
return
end
if skillnamenoun ~= nil then
utils = require 'utils'
skillnum = df.job_skill[skillname]
utils.insert_or_update(unit.status.current_soul.skills, { new = true, id = skillnum, rating = 20 }, 'id')
print (unit.name.first_name.." is now a Legendary "..skillnamenoun)
else
print ("Empty skill name noun, bailing out!")
return
end
end
-- ---------------------------------------------------------------------------
function BreathOfArmok(v)
unit=v
if unit==nil then
print ("No unit available! Aborting with extreme prejudice.")
return
end
local i
utils = require 'utils'
for i=0, 115 do
utils.insert_or_update(unit.status.current_soul.skills, { new = true, id = i, rating = 20 }, 'id')
end
print ("The breath of Armok has engulfed "..unit.name.first_name)
end
-- ---------------------------------------------------------------------------
function LegendaryByClass(skilltype,v)
unit=v
if unit==nil then
print ("No unit available! Aborting with extreme prejudice.")
return
end
utils = require 'utils'
local i
local skillclass
for i=0, 115 do
skillclass = df.job_skill_class[df.job_skill.attrs[i].type]
if skilltype == skillclass then
print ("Skill "..df.job_skill.attrs[i].caption.." is type: "..skillclass.." and is now Legendary for "..unit.name.first_name)
utils.insert_or_update(unit.status.current_soul.skills, { new = true, id = i, rating = 20 }, 'id')
end
end
end
-- ---------------------------------------------------------------------------
function PrintSkillList()
local i
for i=0, 115 do
print("'"..df.job_skill.attrs[i].caption.."' "..df.job_skill[i].." Type: "..df.job_skill_class[df.job_skill.attrs[i].type])
end
print ("Provide the UPPER CASE argument, for example: PROCESSPLANTS rather than Threshing")
end
-- ---------------------------------------------------------------------------
function PrintSkillClassList()
local i
for i=0, 8 do
print(df.job_skill_class[i])
end
print ("Provide one of these arguments, and all skills of that type will be made Legendary")
print ("For example: Medical will make all medical skills legendary")
end
-- ---------------------------------------------------------------------------
function adjust_all_dwarves(skillname)
for _,v in ipairs(df.global.world.units.all) do
if v.race == df.global.ui.race_id then
print("Adjusting "..dfhack.TranslateName(dfhack.units.getVisibleName(v)))
brainwash_unit(v)
elevate_attributes(v)
rejuvenate(v)
if skillname then
if skillname=="Normal" or skillname=="Medical" or skillname=="Personal" or skillname=="Social" or skillname=="Cultural" or skillname=="MilitaryWeapon" or skillname=="MilitaryAttack" or skillname=="MilitaryDefense" or skillname=="MilitaryMisc" then
LegendaryByClass(skillname,v)
elseif skillname=="all" then
BreathOfArmok(v)
else
make_legendary(skillname,v)
end
end
end
end
end
-- ---------------------------------------------------------------------------
-- main script operation starts here
-- ---------------------------------------------------------------------------
local opt = ...
local skillname
if opt then
if opt=="list" then
PrintSkillList()
return
end
if opt=="classes" then
PrintSkillClassList()
return
end
skillname = opt
else
print ("No skillname supplied, no skills will be adjusted. Pass argument 'list' to see a skill list, 'classes' to show skill classes, or use 'all' if you want all skills legendary.")
end
adjust_all_dwarves(skillname)