Quick little script if anyone is interested:
--Upgrades the military stats of a single dwarf based on what you want to specialize in
local upgrades = {"BITE", "DODGING", "MELEE_COMBAT", "GRASP_STRIKE", "STANCE_STRIKE", "WRESTLING",
"ARMOR", "SHIELD", "MISC_WEAPON", "RANGED_COMBAT" }
local opt = {...}
local utils = require 'utils'
local skillName, properSkillName, skillID, temp
function upgradeDwarf(unit)
if (unit.race == df.global.ui.race_id) then
for i=1,#upgrades do
skillName = upgrades[i]
skillID = df.job_skill[skillName]
if (skillID) then
properSkillName = df.job_skill.attrs[skillID].caption_noun
else
print("Invalid Skill Name: " .. skillName)
return
end
if (properSkillName) then
utils.insert_or_update(unit.status.current_soul.skills, { new = true, id = skillID, rating = 20 }, 'id')
print (unit.name.first_name.." is now a Legendary "..properSkillName)
else
print("Error 86")
end
end
else
print("Error 75")
end
end
function upgradeAllDwarves()
for i,unit in ipairs(df.global.world.units.all) do
if (unit.race == df.global.ui.race_id) then
for i=1,#upgrades do
skillName = upgrades[i]
skillID = df.job_skill[skillName]
if (skillID) then
properSkillName = df.job_skill.attrs[skillID].caption_noun
else
print("Invalid Skill Name: " .. skillName)
return
end
if (properSkillName) then
utils.insert_or_update(unit.status.current_soul.skills, { new = true, id = skillID, rating = 20 }, 'id')
if (not temp) then print (unit.name.first_name.." is now a Legendary "..properSkillName) end
else
print("Error 86")
end
end
if temp then print (unit.name.first_name.." now has all Legendary Military Skills!") end
else
--print("Skipping "..unit.name.first_name..": Not a dwarf")
end
end
end
for i=1,#opt do
local x = opt[i]:upper()
if (x:find("AXE") or x:find("AXEDWARF") or x:find("AXEMAN")) then
table.insert(upgrades, "AXE")
elseif (x:find("HAMMER") or x:find("HAMMERDWARF") or x:find("HAMMERMAN")) then
table.insert(upgrades, "HAMMER")
elseif (x:find("MACE") or x:find("MACEDWARF") or x:find("MACEMAN")) then
table.insert(upgrades, "MACE")
elseif (x:find("SPEAR") or x:find("SPEARDWARF") or x:find("SPEARMAN")) then
table.insert(upgrades, "SPEAR")
elseif (x:find("PIKE") or x:find("PIKEDWARF") or x:find("PIKEMAN")) then
table.insert(upgrades, "PIKE")
elseif (x:find("LASHER") or x:find("WHIP") or x:find("LASHERDWARF")) then
table.insert(upgrades, "WHIP")
elseif (x:find("KNIFE") or x:find("KNIFEDWARF") or x:find("KNIFEMAN") or x:find("KNIFE_USER") or x:find("DAGGER")) then
table.insert(upgrades, "DAGGER")
elseif (x:find("CROSSBOW") or x:find("CROSSBOWDWARF") or x: find("MARKSDWARF") or x:find("CROSSBOWMAN") or x:find("MARKSMAN")) then
table.insert(upgrades, "CROSSBOW")
elseif (x:find("SWORD") or x:find("SWORDSDWARF") or x:find("SWORDSMAN")) then
table.insert(upgrades, "SWORD")
elseif (x:find("BLOWGUN") or x:find("BLOWGUNNER")) then
table.insert(upgrades, "BLWOGUN")
elseif (x:find("BOW") or x:find("BOWDWARF") or x:find("BOWMAN")) then
table.insert(upgrades, "BOW")
elseif (x:find("LIST")) then
print("Default training: Shield, Armor, Biter, Kicker, Fighter, Archer, Wrestler, Dodging, Misc. Object Using, and Striking.")
print("Available training: Axe, Hammer, Mace, Sword, Dagger, Whip, Pike, Spear, Crossbow, Bow, Blowgun. Also, use 'All' to include everything!")
elseif (x:find("HELP")) then
print("Quickly train your military to legendary status!")
print("Possible arguments:")
print("list - Lists the default things that will be trained, and the skills you can add")
print("all - Adds all skills to the training regimen")
print("========================================================")
print("All of the commands work on a single unit (selected in a loo'k' around mode/unit list/etc), or on every dwarf in your fortress if you have no unit selected.")
print("Example usage (Unit Selected with 'k'): military_training sword")
print("Output: '[DwarfName] is now a Legendary Swordsdwarf!'")
print("Output: '[DwarfName] is now a Legendary Armor User!'")
print("Etc, etc")
print("Example 2 (No unit selected in-game): military_training all")
print("Output: '[DwarfName1] now has all Legendary Military Skills!")
print("Output: '[DwarfName2] now has all Legendary Military Skills!")
elseif (x:find("ALL")) then
table.insert(upgrades, "AXE")
table.insert(upgrades, "HAMMER")
table.insert(upgrades, "MACE")
table.insert(upgrades, "SWORD")
table.insert(upgrades, "DAGGER")
table.insert(upgrades, "WHIP")
table.insert(upgrades, "PIKE")
table.insert(upgrades, "SPEAR")
table.insert(upgrades, "CROSSBOW")
table.insert(upgrades, "BOW")
table.insert(upgrades, "BLOWGUN")
temp = true
else
print("Unknown Command")
end
end
local unit = dfhack.gui.getSelectedUnit()
local answer
if (unit) then
print("This will only upgrade " .. unit.name.first_name)
print("If you want to upgrade all of your dwarves, hit (n)o to restart the process and make sure you don't have a dwarf selected")
print("Continue? (y/n)")
answer = io.read()
if (answer == "y") then
upgradeDwarf(unit)
else
return
end
else
print("This will upgrade all of your dwarves.")
print("To upgrade a specific dwarf, hit (n)o to restart, and select a specific dwarf in-game")
print("Continue? (y/n)")
answer = io.read()
if (answer == "y") then
upgradeAllDwarves()
else
return
end
end
Threw this together tonight because I basically wanted parts of make_legendary, and parts of the armoks_blessing, with the ability to customize the weapon skills it at run-time. (*Note, this doesn't have rejuvenate, elevate_physical, elevate_mental, or brainwash).
Can be used on a single dwarf, or all of your dwarves. Includes a list of default skills that are always trained (Shield, Armor, Biter, Kicker, Fighter, Archer, Wrestler, Dodging, Misc. Object Using, and Striking). Because every military dwarf wants those! But I wanted to be able to specialize in a certain weapon type.
Usage examples with a single unit selected via the 'k' or units list:
Input -> military_training hammer
Output: -> [DwarfName] is now a Legendary Hammerdwarf!
Output: -> [DwarfName] is now a Legendary Armor User!
............etc etc etc
Input -> military_training dagger axe crossbow
Output: -> [DwarfName] is now a Legendary Knife User!
Output: -> [DwarfName] is now a Legendary Axedwarf!
Output: -> [DwarfName] is now a Legendary Marksdwarf!
Output: -> [DwarfName] is now a Legendary Armor User!
............etc etc etc
If you don't have a unit selected, it goes through all your dwarves and gives them the selected skills.
P.S. Most of the credit goes to vjek. I 'borrowed' a lot of his code to get what I wanted. Maybe someone else will find it useful!