If the consensus is this is a good & useful thing, I'll write up the mental attributes and personality traits in similar separate scripts.
Holy shit! That's exactly what I needed for Morul. Yes, the mental/personality would be appreciated as well. I haven't gotten around to digging into those areas and working out what the values mean. Thank you for posting that.
I've got an okay, if tedious mechanism for raising his skills. Here's what I did to raise his stats after many failed efforts to do it more automatically:
function tools.morul(unit)
if unit==nil then
unit=getCreatureAtPointer() --place the x pointer on top of the creature you want to change. best use is the look pointer and not 'v'
end
--Set the name. Surname is comprised of an array of references [words] into the language file. Each entry grabs a word fragment and the name is
--all of these catenated
unit.name.first_name = "Morul"
unit.name.words[0] = 1416
unit.name.words[1] = 1304
replace_labor = 1
labor_rating = 20
military_rating = 70
--These are the skill ids we want to add
skill = { 0,2,3,4,5,6,7,8,9,10,11,12,13,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,41,42,43,44,45,46,47,48,49,54,55,57,58,59,60,61,62,63,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,95,96,97,98,99,100,101,102,103,104,105,109,110,111,112,113,114,115 }
--These are the military skills that will get higher values
military = { 38,39,41,42,43,44,45,46,54,99,100,101,102,103,104,105 }
replaced = false
for sk,sv in ipairs(skill) do
if (replaced == false) then
replace_key = -1
present = false
for dk,dv in pairs(unit.status.souls[0].skills) do
if (dv.id == sv) then
present = true
unit.status.souls[0].skills[dk].rating = labor_rating
for _,v in ipairs(military) do
if v == sv then
unit.status.souls[0].skills[dk].rating = military_rating
end
end
rating = unit.status.souls[0].skills[dk].rating
unit.status.souls[0].skills[dk].experience = (rating * 500) + (rating * (rating - 1)) * 50
end
if (dv.id == replace_labor) then
replace_key = dk
end
end
if (present == false) and (replace_key > -1) then
print("Replace with ", sv)
unit.status.souls[0].skills[replace_key].id = sv
unit.status.souls[0].skills[replace_key].rating = labor_rating
for _,v in ipairs(military) do
if v == sv then
unit.status.souls[0].skills[replace_key].rating = military_rating
end
end
rating = unit.status.souls[0].skills[replace_key].rating
unit.status.souls[0].skills[replace_key].experience = (rating * 500) + (rating * (rating - 1)) * 50
replaced = true
end
end
end
for sk,sv in ipairs(unit.status.souls[0].skills) do
printall(sv)
end
end
tools.menu:add("Morul",tools.morul)
I tried inserting skills to the skills array, but I couldn't get it to stop duplicating skills - so he'd wind up with 100 entries for legendary wax worker or whatever. It appeared that there was more involved in adding skills than just that, and as soon as it tried writing it out it went all wonky. This routine instead takes a list of skill ids that you want added, looks for them, sets them if it finds one, and writes the next new skill over top of something that you identify (I did woodcutting). So I had Morul go and cut down a tree, run the script which would replace woodcutting with mining or fish dissecting or whatever, set the level and experience, and then exit, wait for him to cut another tree, do it again, etc. Any help finding a way to build them all out at once would be appreciated in the event I need to regen. I got the skill codes (and other goodies) out of DwarfTherapist.
It also shows how to update the name, but it doesn't fix it in the description screen. Any help with that would also be appreciated.
Learning lua in the process didn't help much. It's kind of a wonky language.