Hi everybody,
since it's my first post I'd like to thank all the people in this community since I learned a lot about warhammer modding from this forum.
I'm currently working on creating a legendary lord and I'd like him to be added to the character pool after unlocking a building, as you can do with a normal agent.
I tried to add him as a building effect like other agents but it doesn't work so I had to make a script, but since it doesn't work at all and I've no idea how to debug it I'd like to get some help from you.
Here is the script:
Code:
function norsca_dhampir_script()
out("-------- SCRIPT DHAMPIR START ---------");
NorVamp_Custom_Listeners();
end;
function NorVamp_Custom_Listeners()
out("-------- LISTENER DHAMPIR START ---------");
core:add_listener(
"add_Lord_to_Character_Pool",
"BuildingCompleted",
function(context)
local faction = context:garrison_residence():faction();
out("local faction:"..tostring(faction)));
return faction:name() == "wh_main_vmp_vampire_counts";
end,
function(context)
local building_name = context:building():name();
local faction_name = context:garrison_residence():faction():name();
out("local building faction:"..tostring(building_name;
out("local faction:"..tostring(faction_name)));
if (building_name == "wh_main_vmp_forest_1") and not (cm:get_saved_value("lord_spawn_only_one")) then
cm:spawn_character_to_pool("wh_main_vmp_vampire_counts", "names_name_999888777", "", "", "", 18, true, "general", "wh_main_vmp_blood_ritual_great_sorcerer", true, "");
cm:set_saved_value("lord_spawn_only_one", true);
end;
end,
true
);
end;
I put it in script->campaign->main_warhammer->mod->norsca_dhampir_script.lua
Cheers