I was unaware of this issue. I think the function responsible for selecting and randomizing which army template to spawn is the one we need to look at.
att_preservation.lua
Code:
function get_hun_army_string()
local turn_number = cm:model():turn_number();
-- verify we still have at least one army template
if #hun_preservation_army_template_list < 1 then
script_error("ERROR: get_hun_army_string() called but we have no army templates to look through - returning an emergency force but this needs fixing");
return "emergency", "att_nom_steppe_levy";
end;
-- for each of our army templates, work out if the current turn falls in the min/max range
local possible_armies = {};
for i = 1, #hun_preservation_army_template_list do
local current_template = hun_preservation_army_template_list[i];
local min_date = current_template.min_date;
local max_date = current_template.max_date;
if (min_date < 0 or min_date <= turn_number) and (max_date < 0 or max_date >= turn_number) then
table.insert(possible_armies, current_template);
end;
end;
if #possible_armies > 0 then
local possible_armies = cm:random_sort(possible_armies); -- Sort the table randomly
return possible_armies[1].name, possible_armies[1].army_string; -- Pick the first one, which will be random
end
script_error("WARNING: get_hun_army_string() called but couldn't find any matching force for the current turn " .. tostring(turn_number) .. ", using the first force string");
return hun_preservation_army_template_list[1].name, hun_preservation_army_template_list[1].army_string;
end;
At a glance I don't see a problem with the function.