For some reason, the following if statement is always evaluating to false, even when a factory has been completed.
if (AITechCount(player, c_TB_Factory, c_techCountCompleteOnly) > 0 && AITechCount(player, c_TB_FactoryTechLab, c_techCountInProgressOrBetter) < 1)
{
TriggerDebugOutput(1, StringToText("Blah"), true);
AISetStock(player, 1, c_TB_FactoryTechLab);
}
Even though it's a direct copy from the Barracks techlab code (obviously with barracks replaced with factory) which works just fine.