Anyone else having trouble with Factory TechLabs / Reactors?

Started by hd, March 26, 2010, 07:57:46 PM

Previous topic - Next topic

hd

I cannot, for the life of me, seem to get these built by the AI.

I'm using:
AISetStock(player, 1, c_TB_FactoryTechLab);
AISetStock(player, 1, c_TB_FactoryReactor);

They never build, ever.

hd

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.

Kernel64

Is there any other techlabs processing on another structure like a barracks?

I'm guessing it's possible that barracks techlabs may make the second condition false, so maybe that's where the problem is?

hd

I was just about to post that apparently c_TB_FactoryTechLab in AITechCount counts ALL tech labs, regardless of what they're attached to. Which is very, very annoying. Even removing the second condition won't build one if there's already a tech lab using AISetStock(player, 1, c_TB_FactoryTechLab);

Kernel64

Well, if that's the case, at least it's good that we can specify where the techlab goes. Be it for a rax or factory. At least we can work with it, and count techlabs vs rax+fac. But then again, that's where issues come pumping in.

I don't know. Haven't done terrans yet.

hd

So I've discovered a few things...

TechTreeUnitCount(player, unit or building, const) will return the correct number of tech labs or reactors, so if used in conjunction with AISetStock, you can have it build the correct amount automatically as demonstrated below.

AISetStock(player, 1 + TechTreeUnitCount(player, c_TB_BarracksReactor, c_techCountInProgressOrBetter), c_TB_FactoryReactor);

This will build 1 Factory Reactor regardless of how many Barracks Reactors you have.