function getChild()
local ret={}
local adv=df.global.world.units.active[0]
for k,v in pairs(df.global.world.units.active) do
if v.relations.mother_id==adv.id or v.relations.mother_id==adv.id then
table.insert(ret,v)
end
end
return ret
end
function tools.childrenFollow(unit,trgunit)
local adv=df.global.world.units.active[0]
for k,v in pairs(df.global.world.units.active) do
if v.relations.mother_id==adv.id or v.relations.mother_id==adv.id then
if unit == nil then
unit=getChild()
printall(unit)
end
if unit== nil then
error("Invalid creature")
end
if trgunit==nil then
trgunit=df.global.world.units.active[0]
end
v.relations.group_leader_id=trgunit.id
local u_nem=getNemesis(v)
local t_nem=getNemesis(trgunit)
if u_nem then
u_nem.group_leader_id=t_nem.id
end
v.profession=96
if t_nem and u_nem then
t_nem.companions:insert(#t_nem.companions,u_nem.id)
end
end
end
end
function tools.healchild(unit)
local adv=df.global.world.units.active[0]
for k,v in pairs(df.global.world.units.active) do
if v.relations.mother_id==adv.id or v.relations.mother_id==adv.id then
v.body.wounds:resize(0) -- memory leak here :/
v.body.blood_count=v.body.blood_max
--set flags for standing and grasping...
v.status2.able_stand=4
v.status2.able_stand_impair=4
v.status2.able_grasp=4
v.status2.able_grasp_impair=4
--should also set temperatures, and flags for breath etc...
v.flags1.dead=false
v.flags2.calculated_bodyparts=false
v.flags2.calculated_nerves=false
v.flags2.circulatory_spray=false
v.flags2.vision_good=true
v.flags2.vision_damaged=false
v.flags2.vision_missing=false
v.counters.winded=0
v.counters.unconscious=0
for k,v in pairs(v.body.components) do
for kk,vv in pairs(v) do
v[kk]=0
end
end
end
end
end
tools.menu:add("healchild",tools.healchild)
Okay here some functions for the use of adventure mode child armies. with these you can recruit (your)children and make them fight. This is great for if you body swap into a parent or using empregnate function on your self.