SD.buildGroup2 = CreateBuildingGroup(Player[1]);
SD.buildGroup2.SetRect(MAP_RECT(12+31, 108-1, 28+31, 114-1));
SD.buildGroup2.TakeUnit(SD.ConVec3);
SD.buildGroup2.TakeUnit(SD.ConVec4);
SD.buildGroup2.SetDeleteWhenEmpty(1);
CreateTimeTrigger(1, 1, 1000, "Base2a");
CreateTimeTrigger(1, 1, 13000, "Base2");
SD.CheckSecondSF = CreateTimeTrigger(1, 0, 10, "AI_SFCheck");
SCRIPT_API void Base2a()
{
Unit ConVec3 ,ConVec4, SF2;
SD.buildGroup2b = CreateBuildingGroup(Player[1]);
SD.buildGroup2b.SetRect(MAP_RECT(185+31, 19-1, 194+31, 28-1));
SD.buildGroup2b.RecordBuilding(LOCATION(191+31, 23-1), mapCommandCenter, mapNone);
SD.buildGroup2b.RecordBuilding(LOCATION(191+31, 26-1), mapStructureFactory, mapNone);
SD.buildGroup2b.TakeAllUnits(SD.buildGroup2);
SD.buildGroup2b.TakeUnit(SD.SF2);
}
SCRIPT_API void Base2()
{
Unit ConVec3 ,ConVec4, SF2;
SD.buildGroup2c = CreateBuildingGroup(Player[1]);
SD.buildGroup2c.SetRect(MAP_RECT(185+31, 19-1, 194+31, 28-1));
SD.buildGroup2c.TakeAllUnits(SD.buildGroup2b);
SD.buildGroup2c.TakeUnit(SD.SF2);
SD.buildGroup2c.RecordBuilding(LOCATION(196+31, 22-1), mapVehicleFactory, mapNone);
}
SCRIPT_API void AI_SFCheck()
{
// Let's use an enumerator
Unit SF2;
PlayerBuildingEnum unitEnum(1, mapNone);
while (unitEnum.GetNext(SF2) )
{
// Check if this is the unit we want (make sure it's an SF and in the right spot)
if ( (SF2.GetType() == mapStructureFactory) && (SF2.Location().x == 191+31) && (SF2.Location().y == 26-1) )
{
// We've found it! Record it and destroy this trigger.
SD.SF2 = SF2;
SD.CheckSecondSF.Destroy();
}
}
}
You need to Create a group after the StructureFactory is done with a TimeTrigger.