am not sure what wrong with this script am trying to get my custom made lord to be recruited from a certain building here is the script was wondering if someone can finding the problem

events = get_events();




events.FirstTickAfterWorldCreated[#events.FirstTickAfterWorldCreated+1] =
function(context)
anointed_lord_pack();
return true;
end;


function anointed_lord_pack()
cm:set_saved_value("anointed_lord_pack", true);

end;


core:add_listener(


"anointed_lord",
"BuildingCompleted",
function(context)
local faction = context:garrison_residence():faction();

return faction:culture() == "wh2_main_hef_high_elves";
end,
function(context)
local building_name = context:building():name();
local faction = context:garrison_residence():faction();
local faction_name = context:garrison_residence():faction():name();
local anointed_id = "anointed_lord"..cm:model():turn_number()..faction_name;

if building_name == "wh2_main_hef_barracks_2" then

cm:create_agent(
faction_name,
"general",
wh2_lth_anointed_lord,
118,
142,
false,
nil



end;
end,
true
);




end;