From 7dd091e57a0ed05a6f53e06856eee631b2d92ee9 Mon Sep 17 00:00:00 2001 From: lethosor Date: Mon, 26 Oct 2015 21:02:03 -0400 Subject: [PATCH] create-unit: add nickname option --- scripts/modtools/create-unit.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/modtools/create-unit.lua b/scripts/modtools/create-unit.lua index 948b94486..22a4dee9d 100644 --- a/scripts/modtools/create-unit.lua +++ b/scripts/modtools/create-unit.lua @@ -103,7 +103,7 @@ function createFigure(trgunit,he,he_group) hf.sex = trgunit.sex df.global.hist_figure_next_id=df.global.hist_figure_next_id+1 hf.appeared_year = df.global.cur_year - + hf.born_year = trgunit.relations.birth_year hf.born_seconds = trgunit.relations.birth_time hf.curse_year = trgunit.relations.curse_year @@ -330,6 +330,7 @@ validArgs = --[[validArgs or]]utils.invert({ 'flagSet', 'flagClear', 'name', + 'nick', 'location', 'age' }) @@ -369,6 +370,8 @@ arguments: set the unit's name to be a random name appropriate for the given entity examples: MOUNTAIN + -nick nickname + set the unit's nickname directly -location [ x y z ] create the unit at the specified coordinates -age howOld @@ -505,6 +508,10 @@ else end--]] end +if args.nick and type(args.nick) == 'string' then + dfhack.units.setNickname(df.unit.find(unitId), args.nick) +end + if civ_id then local u = df.unit.find(unitId) u.civ_id = civ_id