The code segment starts with elseif (sType == "Unit") then. Therefore it's only computed if the build controller checks a unit build item and not enough units of this type are on the field. If the build controller gets stuck because of this, then there are three possibilities:
1.) The unit can't be built because the necessary building or tech is not available or...
2.) The name of the unit is written incorrect and the build controller can't find any buildings where he can build the unit.
3.) The units are part of a rush program. In this case no other units are built until the rush is over. (If I remenber right...)
If those don't apply, it's possible that there's a completely other reason for the problem.
Thanks for clarification, Arkhan. Will check for different reasons in my code.
I have a suggestion I use for CC commanders with DowPro AI. I changed ChekForDetach() to
function InfantryTactic:CheckForDetach() -- Set detach health local fDetachHealth = self.m_fCommanderAttachHealth + 0.2 -- Detach healthy commanders after combat. if (not self.squad_ai:IsInCombat() and not self.squad_ai:WasRecentlyHurt() and self:CommanderAttached() and self.squad_ai:GetAttachedHealthPercentage() > fDetachHealth) then self.squad_ai:DoDetachSquad() self.squad_ai:DoSetDefaultMeleeStance() end -- Detach commander from broken/capturing if ((self.squad_ai:IsBroken() or self.squad_ai:IsCapturing()) and (self.squad_ai:IsInCombat() or self.squad_ai:WasRecentlyHurt())) then self.squad_ai:DoDetachSquad() self.squad_ai:DoSetDefaultMeleeStance() end end
and the attach code for CC commanders (expl. farseer) to
-- Assassinate win condition -- never attach to a squad / do not attach while dancing if (not cpu_manager.assassinate and self.squad_ai:GetMeleeStance() == SquadAI.MSTANCE_Assault) then if (self.squad_ai:IsInCombat() or self.squad_ai:WasRecentlyHurt()) then if (self:TryAttachSquad(false, true, 50, 150, self.m_fCommanderAttachHealth) == nil) then self:TryAttachSquadMelee() end end end
What's the difference to the old code ? The CC commander will not attach to CC squads by default but only in combat with self:TryAttachSquadMelee() if one is nearby and detach afterwards if out of combat. This will a) increase the chance to fight independantly and to tie up more ranged squads and b) release the comander to act independantly after combat if healthy. This will prevent the attached farseer fleet of foot bug too. He/she will still attach to ranged if hurt.