Author Topic: Outpost 2 Coding 101: Week 9  (Read 15353 times)

Offline Venera

  • Full Member
  • ***
  • Posts: 120
Outpost 2 Coding 101: Week 9
« Reply #25 on: November 20, 2011, 12:08:39 AM »
I believe I followed this lesson right and created a code to rebuild my ConVecs.  If I destroy those ConVecs, they won't be rebuilt.  Can someone help me?

Code: [Select]
/* Setup Enemy Construction Group */
 BuildingGroup ebuild;

 ebuild = CreateBuildingGroup(Player[1]);
 MAP_RECT ConVecBox(123+32, 42-1, 128+32, 43-1);
 ebuild.SetRect(ConVecBox);
 ebuild.TakeUnit(scriptGlobal.estructf);
 ebuild.TakeUnit(scriptGlobal.convec1);
 ebuild.TakeUnit(scriptGlobal.convec2);
 ebuild.TakeUnit(scriptGlobal.convec3);
 ebuild.SetTargCount(mapConVec, mapNone, 3);

 ebuild.RecordBuilding(LOCATION(125+32, 24-1), mapVehicleFactory, mapNone);
 ebuild.RecordBuilding(LOCATION(117+32, 39-1), mapCommonOreSmelter, mapNone);
 ebuild.RecordBuilding(LOCATION(112+32, 39-1), mapCommonOreSmelter, mapNone);
 ebuild.RecordBuilding(LOCATION(115+32, 24-1), mapTokamak, mapNone);
 ebuild.RecordBuilding(LOCATION(118+32, 24-1), mapTokamak, mapNone);
 ebuild.RecordBuilding(LOCATION(116+32, 29-1), mapAgridome, mapNone);
 ebuild.RecordBuilding(LOCATION(121+32, 29-1), mapNursery, mapNone);
 ebuild.RecordBuilding(LOCATION(116+32, 32-1), mapStandardLab, mapNone);
 ebuild.RecordBuilding(LOCATION(121+32, 32-1), mapRobotCommand, mapNone);
 ebuild.RecordBuilding(LOCATION(116+32, 35-1), mapAgridome, mapNone);
 ebuild.RecordBuilding(LOCATION(121+32, 35-1), mapUniversity, mapNone);

 /* Rebuild Mines */
 BuildingGroup mine1;

 mine1 = CreateBuildingGroup(Player[1]);
 MAP_RECT minerbox(110+32, 42-1, 115+32, 43-1);
 mine1.SetRect(minerbox);
 mine1.TakeUnit(scriptGlobal.robominer1);
 mine1.TakeUnit(scriptGlobal.eminer1);
 mine1.TakeUnit(scriptGlobal.evecf);
 mine1.SetTargCount(mapRoboMiner, mapNone, 1);
 mine1.SetTargCount(mapCommonOreMine, mapNone, 1);

 mine1.RecordBuilding(LOCATION(120+32, 47-1), mapCommonOreMine, mapNone);

/* Setup Enemy Mining */
MiningGroup emine1;
MiningGroup emine2;

emine1 = CreateMiningGroup(Player[1]);
emine1.Setup(scriptGlobal.eminer1, scriptGlobal.esmelt1, MAP_RECT(119+32, 46-1, 122+32, 48-1));

TethysGame::CreateUnit(scriptGlobal.etruck1, mapCargoTruck, LOCATION(114+32, 42-1), 1, mapNone, 0);
scriptGlobal.etruck1.DoSetLights(1);
emine1.TakeUnit(scriptGlobal.etruck1);
TethysGame::CreateUnit(scriptGlobal.etruck2, mapCargoTruck, LOCATION(116+32, 42-1), 1, mapNone, 0);
scriptGlobal.etruck2.DoSetLights(1);
emine1.TakeUnit(scriptGlobal.etruck2);
emine1.SetTargCount(mapCargoTruck, mapNone, 2);

emine2 = CreateMiningGroup(Player[1]);
emine2.Setup(scriptGlobal.eminer1, scriptGlobal.esmelt2, MAP_RECT(114+32, 40-1, 115+32, 41-1));
TethysGame::CreateUnit(scriptGlobal.etruck3, mapCargoTruck, LOCATION(118+32, 42-1), 1, mapNone, 0);
scriptGlobal.etruck3.DoSetLights(1);
emine2.TakeUnit(scriptGlobal.etruck3);
TethysGame::CreateUnit(scriptGlobal.etruck4, mapCargoTruck, LOCATION(114+32, 42-1), 1, mapNone, 0);
scriptGlobal.etruck4.DoSetLights(1);
emine2.TakeUnit(scriptGlobal.etruck4);
emine2.SetTargCount(mapCargoTruck, mapNone, 2);

/* Rebuild Vehicles */
BuildingGroup Reinforce;

Reinforce = CreateBuildingGroup(Player[1]);
Reinforce.TakeUnit(scriptGlobal.evecf);

Reinforce.RecordVehReinforceGroup(ebuild, 3000);
« Last Edit: May 17, 2018, 09:59:38 PM by leeor_net »