Significantly improve default AI no bases behaviour by making sure starting

trucks cooperate on an initial factory. Implements most of and closes ticket:1171


git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@8704 4a71c877-e1ca-e34f-864e-861f7616d084
master
Per Inge Mathisen 2009-12-15 23:23:14 +00:00 committed by Git SVN Gateway
parent 0e0ebd2c21
commit 89679c361a
16 changed files with 415 additions and 119 deletions

View File

@ -98,7 +98,7 @@ public STRUCTURESTAT vtolTarget[10],rebuildStat[TECHS][2];
// structures
private int baseX,baseY,minx,miny,maxx,maxy;
public int numStructs,numIncendrys,numDefStructs,numExtraStructs[TECHS],numWallWeaps,numBaseStruct,numLightCyborgs;
public int numStructs,numIncendrys,numDefStructs,numExtraStructs[TECHS],numWallWeaps,numBaseStruct,numLightCyborgs,numFundamental;
private STRUCTURESTAT structChoice[5];
public STRUCTURESTAT incendrys[8],structs[13],defStructs[26],extraStructs[TECHS][6],wallWeaps[11];
public STRUCTURESTAT sensorTower,wall,cornerWall,resLab,powGen,playerHQ,lassat,factory,derrick,cybFactory,
@ -218,6 +218,7 @@ trigger watchBaseThreatTr (every, 120);
trigger manageAllyHelpTr (every, 80);
trigger everySec (every, 10);
trigger manageDefendLocationTr (every, 70);
trigger startLevelTr (CALL_START_NEXT_LEVEL);
/* Events */
event multiMsgEv;
@ -390,7 +391,6 @@ event initialisedEvent(CALL_GAMEINIT)
if(aiResponsibleForPlayer(me))
{
bRunning = true;
buildTruck();
}
else
{
@ -398,6 +398,44 @@ event initialisedEvent(CALL_GAMEINIT)
}
}
event startLevel(startLevelTr)
{
if (!bRunning)
{
exit;
}
count = 0;
while (count < numFundamental)
{
// check that struct.
structure = getStructure(structs[count], me);
if(structure == NULLOBJECT) // if missing build it.
{
if (isStructureAvailable(structs[count], me))
{
buildX = baseX; // pick a location
buildY = baseY;
boolResult = pickStructLocationB(structs[count], ref buildX, ref buildY,me,0);
if(boolResult == TRUE)
{
initIterateGroup(buildGroup); // find idle droids in build group.
droid = iterateGroup(buildGroup);
while (droid != NULLOBJECT)
{
if ((droid.order == DORDER_NONE or droid.order == DORDER_RTB) and droidCanReach(droid, buildX, buildY))
{
orderDroidStatsLoc(droid, DORDER_BUILD, structs[count], buildX, buildY); // build it
}
droid = iterateGroup(buildGroup);
}
}
}
}
count = count + 1;
}
buildTruck();
}
// decide what technology branch we will use
function void setTechBranch(int _tech)
{
@ -1347,14 +1385,15 @@ event structBuilt(structBuiltTr)
local FEATURE _oilResource;
local int _count,_count2;
if(structure == NULLOBJECT || droid == NULLOBJECT){
if (structure == NULLOBJECT || droid == NULLOBJECT)
{
exit;
}
/* factory or factory module */
if(structure.stattype == REF_FACTORY)
{
if( isStructureAvailable(facModule,me) and (skGetFactoryCapacity(structure) < 2 ))
if( isStructureAvailable(facModule,me) and (skGetFactoryCapacity(structure) < 2 ) and (getDroidCount(me) > 4))
{
orderDroidStatsLoc(droid, DORDER_BUILD,facModule, structure.x,structure.y); // upgrade it.
}
@ -3032,11 +3071,7 @@ function void shutDownAI()
event reassignPlayers(reassignTr)
{
if(count == me)
{
dbg(" AI 0 is reassigningAI to dropped player ", me);
//reassignAI();
}
dbg("Reassign event is ignored", me);
}
function void reassignAI()
@ -3091,6 +3126,7 @@ function void reassignAI()
setEventTrigger(structBuilt, structBuiltTr);
setEventTrigger(structureDestroyed, structureDestroyedTr);
setEventTrigger(rebuildStructureEv, rebuildStructureTr);
setEventTrigger(startLevel, startLevelTr);
}
/* Returns true if we just received a beacon from a certain player */

View File

@ -10,7 +10,7 @@ run
branchDefault int 0
branchVTOL int 1
me int 0 // this player is player x.
me int 0 // this player is player x.
//default branch
numScouts[0] int 3 // min number of droids in group to aim for.
@ -141,12 +141,13 @@ run
facModule STRUCTURESTAT "A0FacMod1"
resModule STRUCTURESTAT "A0ResearchModule1"
// Essential structs.
// Essential and fundamental structs. Fundamental => what you build on level start
numStructs int 13
structs[0] STRUCTURESTAT "A0PowerGenerator"
structs[1] STRUCTURESTAT "A0LightFactory"
structs[2] STRUCTURESTAT "A0CommandCentre"
structs[3] STRUCTURESTAT "A0ResearchFacility"
numFundamental int 5
structs[0] STRUCTURESTAT "A0LightFactory"
structs[1] STRUCTURESTAT "A0ResearchFacility"
structs[2] STRUCTURESTAT "A0PowerGenerator"
structs[3] STRUCTURESTAT "A0CommandCentre"
structs[4] STRUCTURESTAT "A0CyborgFactory"
structs[5] STRUCTURESTAT "Sys-CB-Tower01"

View File

@ -98,7 +98,7 @@ public STRUCTURESTAT vtolTarget[10],rebuildStat[TECHS][2];
// structures
private int baseX,baseY,minx,miny,maxx,maxy;
public int numStructs,numIncendrys,numDefStructs,numExtraStructs[TECHS],numWallWeaps,numBaseStruct,numLightCyborgs;
public int numStructs,numIncendrys,numDefStructs,numExtraStructs[TECHS],numWallWeaps,numBaseStruct,numLightCyborgs,numFundamental;
private STRUCTURESTAT structChoice[5];
public STRUCTURESTAT incendrys[8],structs[13],defStructs[26],extraStructs[TECHS][6],wallWeaps[11];
public STRUCTURESTAT sensorTower,wall,cornerWall,resLab,powGen,playerHQ,lassat,factory,derrick,cybFactory,
@ -218,6 +218,7 @@ trigger watchBaseThreatTr (every, 120);
trigger manageAllyHelpTr (every, 80);
trigger everySec (every, 10);
trigger manageDefendLocationTr (every, 70);
trigger startLevelTr (CALL_START_NEXT_LEVEL);
/* Events */
event multiMsgEv;
@ -390,7 +391,6 @@ event initialisedEvent(CALL_GAMEINIT)
if(aiResponsibleForPlayer(me))
{
bRunning = true;
buildTruck();
}
else
{
@ -398,6 +398,44 @@ event initialisedEvent(CALL_GAMEINIT)
}
}
event startLevel(startLevelTr)
{
if (!bRunning)
{
exit;
}
count = 0;
while (count < numFundamental)
{
// check that struct.
structure = getStructure(structs[count], me);
if(structure == NULLOBJECT) // if missing build it.
{
if (isStructureAvailable(structs[count], me))
{
buildX = baseX; // pick a location
buildY = baseY;
boolResult = pickStructLocationB(structs[count], ref buildX, ref buildY,me,0);
if(boolResult == TRUE)
{
initIterateGroup(buildGroup); // find idle droids in build group.
droid = iterateGroup(buildGroup);
while (droid != NULLOBJECT)
{
if ((droid.order == DORDER_NONE or droid.order == DORDER_RTB) and droidCanReach(droid, buildX, buildY))
{
orderDroidStatsLoc(droid, DORDER_BUILD, structs[count], buildX, buildY); // build it
}
droid = iterateGroup(buildGroup);
}
}
}
}
count = count + 1;
}
buildTruck();
}
// decide what technology branch we will use
function void setTechBranch(int _tech)
{
@ -1347,14 +1385,15 @@ event structBuilt(structBuiltTr)
local FEATURE _oilResource;
local int _count,_count2;
if(structure == NULLOBJECT || droid == NULLOBJECT){
if (structure == NULLOBJECT || droid == NULLOBJECT)
{
exit;
}
/* factory or factory module */
if(structure.stattype == REF_FACTORY)
{
if( isStructureAvailable(facModule,me) and (skGetFactoryCapacity(structure) < 2 ))
if( isStructureAvailable(facModule,me) and (skGetFactoryCapacity(structure) < 2 ) and (getDroidCount(me) > 4))
{
orderDroidStatsLoc(droid, DORDER_BUILD,facModule, structure.x,structure.y); // upgrade it.
}
@ -3032,11 +3071,7 @@ function void shutDownAI()
event reassignPlayers(reassignTr)
{
if(count == me)
{
dbg(" AI 0 is reassigningAI to dropped player ", me);
//reassignAI();
}
dbg("Reassign event is ignored", me);
}
function void reassignAI()
@ -3091,6 +3126,7 @@ function void reassignAI()
setEventTrigger(structBuilt, structBuiltTr);
setEventTrigger(structureDestroyed, structureDestroyedTr);
setEventTrigger(rebuildStructureEv, rebuildStructureTr);
setEventTrigger(startLevel, startLevelTr);
}
/* Returns true if we just received a beacon from a certain player */

View File

@ -141,12 +141,13 @@ run
facModule STRUCTURESTAT "A0FacMod1"
resModule STRUCTURESTAT "A0ResearchModule1"
// Essential structs.
// Essential and fundamental structs. Fundamental => what you build on level start
numStructs int 13
structs[0] STRUCTURESTAT "A0PowerGenerator"
structs[1] STRUCTURESTAT "A0LightFactory"
structs[2] STRUCTURESTAT "A0CommandCentre"
structs[3] STRUCTURESTAT "A0ResearchFacility"
numFundamental int 5
structs[0] STRUCTURESTAT "A0LightFactory"
structs[1] STRUCTURESTAT "A0ResearchFacility"
structs[2] STRUCTURESTAT "A0PowerGenerator"
structs[3] STRUCTURESTAT "A0CommandCentre"
structs[4] STRUCTURESTAT "A0CyborgFactory"
structs[5] STRUCTURESTAT "Sys-CB-Tower01"

View File

@ -98,7 +98,7 @@ public STRUCTURESTAT vtolTarget[10],rebuildStat[TECHS][2];
// structures
private int baseX,baseY,minx,miny,maxx,maxy;
public int numStructs,numIncendrys,numDefStructs,numExtraStructs[TECHS],numWallWeaps,numBaseStruct,numLightCyborgs;
public int numStructs,numIncendrys,numDefStructs,numExtraStructs[TECHS],numWallWeaps,numBaseStruct,numLightCyborgs,numFundamental;
private STRUCTURESTAT structChoice[5];
public STRUCTURESTAT incendrys[8],structs[13],defStructs[26],extraStructs[TECHS][6],wallWeaps[11];
public STRUCTURESTAT sensorTower,wall,cornerWall,resLab,powGen,playerHQ,lassat,factory,derrick,cybFactory,
@ -218,6 +218,7 @@ trigger watchBaseThreatTr (every, 120);
trigger manageAllyHelpTr (every, 80);
trigger everySec (every, 10);
trigger manageDefendLocationTr (every, 70);
trigger startLevelTr (CALL_START_NEXT_LEVEL);
/* Events */
event multiMsgEv;
@ -390,7 +391,6 @@ event initialisedEvent(CALL_GAMEINIT)
if(aiResponsibleForPlayer(me))
{
bRunning = true;
buildTruck();
}
else
{
@ -398,6 +398,44 @@ event initialisedEvent(CALL_GAMEINIT)
}
}
event startLevel(startLevelTr)
{
if (!bRunning)
{
exit;
}
count = 0;
while (count < numFundamental)
{
// check that struct.
structure = getStructure(structs[count], me);
if(structure == NULLOBJECT) // if missing build it.
{
if (isStructureAvailable(structs[count], me))
{
buildX = baseX; // pick a location
buildY = baseY;
boolResult = pickStructLocationB(structs[count], ref buildX, ref buildY,me,0);
if(boolResult == TRUE)
{
initIterateGroup(buildGroup); // find idle droids in build group.
droid = iterateGroup(buildGroup);
while (droid != NULLOBJECT)
{
if ((droid.order == DORDER_NONE or droid.order == DORDER_RTB) and droidCanReach(droid, buildX, buildY))
{
orderDroidStatsLoc(droid, DORDER_BUILD, structs[count], buildX, buildY); // build it
}
droid = iterateGroup(buildGroup);
}
}
}
}
count = count + 1;
}
buildTruck();
}
// decide what technology branch we will use
function void setTechBranch(int _tech)
{
@ -1347,14 +1385,15 @@ event structBuilt(structBuiltTr)
local FEATURE _oilResource;
local int _count,_count2;
if(structure == NULLOBJECT || droid == NULLOBJECT){
if (structure == NULLOBJECT || droid == NULLOBJECT)
{
exit;
}
/* factory or factory module */
if(structure.stattype == REF_FACTORY)
{
if( isStructureAvailable(facModule,me) and (skGetFactoryCapacity(structure) < 2 ))
if( isStructureAvailable(facModule,me) and (skGetFactoryCapacity(structure) < 2 ) and (getDroidCount(me) > 4))
{
orderDroidStatsLoc(droid, DORDER_BUILD,facModule, structure.x,structure.y); // upgrade it.
}
@ -3032,11 +3071,7 @@ function void shutDownAI()
event reassignPlayers(reassignTr)
{
if(count == me)
{
dbg(" AI 0 is reassigningAI to dropped player ", me);
//reassignAI();
}
dbg("Reassign event is ignored", me);
}
function void reassignAI()
@ -3091,6 +3126,7 @@ function void reassignAI()
setEventTrigger(structBuilt, structBuiltTr);
setEventTrigger(structureDestroyed, structureDestroyedTr);
setEventTrigger(rebuildStructureEv, rebuildStructureTr);
setEventTrigger(startLevel, startLevelTr);
}
/* Returns true if we just received a beacon from a certain player */

View File

@ -10,7 +10,7 @@ run
branchDefault int 0
branchVTOL int 1
me int 2 // this player is player x.
me int 2 // this player is player x.
//default branch
numScouts[0] int 3 // min number of droids in group to aim for.
@ -141,12 +141,13 @@ run
facModule STRUCTURESTAT "A0FacMod1"
resModule STRUCTURESTAT "A0ResearchModule1"
// Essential structs.
// Essential and fundamental structs. Fundamental => what you build on level start
numStructs int 13
structs[0] STRUCTURESTAT "A0PowerGenerator"
structs[1] STRUCTURESTAT "A0LightFactory"
structs[2] STRUCTURESTAT "A0CommandCentre"
structs[3] STRUCTURESTAT "A0ResearchFacility"
numFundamental int 5
structs[0] STRUCTURESTAT "A0LightFactory"
structs[1] STRUCTURESTAT "A0ResearchFacility"
structs[2] STRUCTURESTAT "A0PowerGenerator"
structs[3] STRUCTURESTAT "A0CommandCentre"
structs[4] STRUCTURESTAT "A0CyborgFactory"
structs[5] STRUCTURESTAT "Sys-CB-Tower01"

View File

@ -98,7 +98,7 @@ public STRUCTURESTAT vtolTarget[10],rebuildStat[TECHS][2];
// structures
private int baseX,baseY,minx,miny,maxx,maxy;
public int numStructs,numIncendrys,numDefStructs,numExtraStructs[TECHS],numWallWeaps,numBaseStruct,numLightCyborgs;
public int numStructs,numIncendrys,numDefStructs,numExtraStructs[TECHS],numWallWeaps,numBaseStruct,numLightCyborgs,numFundamental;
private STRUCTURESTAT structChoice[5];
public STRUCTURESTAT incendrys[8],structs[13],defStructs[26],extraStructs[TECHS][6],wallWeaps[11];
public STRUCTURESTAT sensorTower,wall,cornerWall,resLab,powGen,playerHQ,lassat,factory,derrick,cybFactory,
@ -218,6 +218,7 @@ trigger watchBaseThreatTr (every, 120);
trigger manageAllyHelpTr (every, 80);
trigger everySec (every, 10);
trigger manageDefendLocationTr (every, 70);
trigger startLevelTr (CALL_START_NEXT_LEVEL);
/* Events */
event multiMsgEv;
@ -390,7 +391,6 @@ event initialisedEvent(CALL_GAMEINIT)
if(aiResponsibleForPlayer(me))
{
bRunning = true;
buildTruck();
}
else
{
@ -398,6 +398,44 @@ event initialisedEvent(CALL_GAMEINIT)
}
}
event startLevel(startLevelTr)
{
if (!bRunning)
{
exit;
}
count = 0;
while (count < numFundamental)
{
// check that struct.
structure = getStructure(structs[count], me);
if(structure == NULLOBJECT) // if missing build it.
{
if (isStructureAvailable(structs[count], me))
{
buildX = baseX; // pick a location
buildY = baseY;
boolResult = pickStructLocationB(structs[count], ref buildX, ref buildY,me,0);
if(boolResult == TRUE)
{
initIterateGroup(buildGroup); // find idle droids in build group.
droid = iterateGroup(buildGroup);
while (droid != NULLOBJECT)
{
if ((droid.order == DORDER_NONE or droid.order == DORDER_RTB) and droidCanReach(droid, buildX, buildY))
{
orderDroidStatsLoc(droid, DORDER_BUILD, structs[count], buildX, buildY); // build it
}
droid = iterateGroup(buildGroup);
}
}
}
}
count = count + 1;
}
buildTruck();
}
// decide what technology branch we will use
function void setTechBranch(int _tech)
{
@ -1347,14 +1385,15 @@ event structBuilt(structBuiltTr)
local FEATURE _oilResource;
local int _count,_count2;
if(structure == NULLOBJECT || droid == NULLOBJECT){
if (structure == NULLOBJECT || droid == NULLOBJECT)
{
exit;
}
/* factory or factory module */
if(structure.stattype == REF_FACTORY)
{
if( isStructureAvailable(facModule,me) and (skGetFactoryCapacity(structure) < 2 ))
if( isStructureAvailable(facModule,me) and (skGetFactoryCapacity(structure) < 2 ) and (getDroidCount(me) > 4))
{
orderDroidStatsLoc(droid, DORDER_BUILD,facModule, structure.x,structure.y); // upgrade it.
}
@ -3032,11 +3071,7 @@ function void shutDownAI()
event reassignPlayers(reassignTr)
{
if(count == me)
{
dbg(" AI 0 is reassigningAI to dropped player ", me);
//reassignAI();
}
dbg("Reassign event is ignored", me);
}
function void reassignAI()
@ -3091,6 +3126,7 @@ function void reassignAI()
setEventTrigger(structBuilt, structBuiltTr);
setEventTrigger(structureDestroyed, structureDestroyedTr);
setEventTrigger(rebuildStructureEv, rebuildStructureTr);
setEventTrigger(startLevel, startLevelTr);
}
/* Returns true if we just received a beacon from a certain player */

View File

@ -10,7 +10,7 @@ run
branchDefault int 0
branchVTOL int 1
me int 3 // this player is player x.
me int 3 // this player is player x.
//default branch
numScouts[0] int 3 // min number of droids in group to aim for.
@ -141,12 +141,13 @@ run
facModule STRUCTURESTAT "A0FacMod1"
resModule STRUCTURESTAT "A0ResearchModule1"
// Essential structs.
// Essential and fundamental structs. Fundamental => what you build on level start
numStructs int 13
structs[0] STRUCTURESTAT "A0PowerGenerator"
structs[1] STRUCTURESTAT "A0LightFactory"
structs[2] STRUCTURESTAT "A0CommandCentre"
structs[3] STRUCTURESTAT "A0ResearchFacility"
numFundamental int 5
structs[0] STRUCTURESTAT "A0LightFactory"
structs[1] STRUCTURESTAT "A0ResearchFacility"
structs[2] STRUCTURESTAT "A0PowerGenerator"
structs[3] STRUCTURESTAT "A0CommandCentre"
structs[4] STRUCTURESTAT "A0CyborgFactory"
structs[5] STRUCTURESTAT "Sys-CB-Tower01"

View File

@ -98,7 +98,7 @@ public STRUCTURESTAT vtolTarget[10],rebuildStat[TECHS][2];
// structures
private int baseX,baseY,minx,miny,maxx,maxy;
public int numStructs,numIncendrys,numDefStructs,numExtraStructs[TECHS],numWallWeaps,numBaseStruct,numLightCyborgs;
public int numStructs,numIncendrys,numDefStructs,numExtraStructs[TECHS],numWallWeaps,numBaseStruct,numLightCyborgs,numFundamental;
private STRUCTURESTAT structChoice[5];
public STRUCTURESTAT incendrys[8],structs[13],defStructs[26],extraStructs[TECHS][6],wallWeaps[11];
public STRUCTURESTAT sensorTower,wall,cornerWall,resLab,powGen,playerHQ,lassat,factory,derrick,cybFactory,
@ -218,6 +218,7 @@ trigger watchBaseThreatTr (every, 120);
trigger manageAllyHelpTr (every, 80);
trigger everySec (every, 10);
trigger manageDefendLocationTr (every, 70);
trigger startLevelTr (CALL_START_NEXT_LEVEL);
/* Events */
event multiMsgEv;
@ -390,7 +391,6 @@ event initialisedEvent(CALL_GAMEINIT)
if(aiResponsibleForPlayer(me))
{
bRunning = true;
buildTruck();
}
else
{
@ -398,6 +398,44 @@ event initialisedEvent(CALL_GAMEINIT)
}
}
event startLevel(startLevelTr)
{
if (!bRunning)
{
exit;
}
count = 0;
while (count < numFundamental)
{
// check that struct.
structure = getStructure(structs[count], me);
if(structure == NULLOBJECT) // if missing build it.
{
if (isStructureAvailable(structs[count], me))
{
buildX = baseX; // pick a location
buildY = baseY;
boolResult = pickStructLocationB(structs[count], ref buildX, ref buildY,me,0);
if(boolResult == TRUE)
{
initIterateGroup(buildGroup); // find idle droids in build group.
droid = iterateGroup(buildGroup);
while (droid != NULLOBJECT)
{
if ((droid.order == DORDER_NONE or droid.order == DORDER_RTB) and droidCanReach(droid, buildX, buildY))
{
orderDroidStatsLoc(droid, DORDER_BUILD, structs[count], buildX, buildY); // build it
}
droid = iterateGroup(buildGroup);
}
}
}
}
count = count + 1;
}
buildTruck();
}
// decide what technology branch we will use
function void setTechBranch(int _tech)
{
@ -1347,14 +1385,15 @@ event structBuilt(structBuiltTr)
local FEATURE _oilResource;
local int _count,_count2;
if(structure == NULLOBJECT || droid == NULLOBJECT){
if (structure == NULLOBJECT || droid == NULLOBJECT)
{
exit;
}
/* factory or factory module */
if(structure.stattype == REF_FACTORY)
{
if( isStructureAvailable(facModule,me) and (skGetFactoryCapacity(structure) < 2 ))
if( isStructureAvailable(facModule,me) and (skGetFactoryCapacity(structure) < 2 ) and (getDroidCount(me) > 4))
{
orderDroidStatsLoc(droid, DORDER_BUILD,facModule, structure.x,structure.y); // upgrade it.
}
@ -3032,11 +3071,7 @@ function void shutDownAI()
event reassignPlayers(reassignTr)
{
if(count == me)
{
dbg(" AI 0 is reassigningAI to dropped player ", me);
//reassignAI();
}
dbg("Reassign event is ignored", me);
}
function void reassignAI()
@ -3091,6 +3126,7 @@ function void reassignAI()
setEventTrigger(structBuilt, structBuiltTr);
setEventTrigger(structureDestroyed, structureDestroyedTr);
setEventTrigger(rebuildStructureEv, rebuildStructureTr);
setEventTrigger(startLevel, startLevelTr);
}
/* Returns true if we just received a beacon from a certain player */

View File

@ -10,7 +10,7 @@ run
branchDefault int 0
branchVTOL int 1
me int 4 // this player is player x.
me int 4 // this player is player x.
//default branch
numScouts[0] int 3 // min number of droids in group to aim for.
@ -141,12 +141,13 @@ run
facModule STRUCTURESTAT "A0FacMod1"
resModule STRUCTURESTAT "A0ResearchModule1"
// Essential structs.
// Essential and fundamental structs. Fundamental => what you build on level start
numStructs int 13
structs[0] STRUCTURESTAT "A0PowerGenerator"
structs[1] STRUCTURESTAT "A0LightFactory"
structs[2] STRUCTURESTAT "A0CommandCentre"
structs[3] STRUCTURESTAT "A0ResearchFacility"
numFundamental int 5
structs[0] STRUCTURESTAT "A0LightFactory"
structs[1] STRUCTURESTAT "A0ResearchFacility"
structs[2] STRUCTURESTAT "A0PowerGenerator"
structs[3] STRUCTURESTAT "A0CommandCentre"
structs[4] STRUCTURESTAT "A0CyborgFactory"
structs[5] STRUCTURESTAT "Sys-CB-Tower01"

View File

@ -98,7 +98,7 @@ public STRUCTURESTAT vtolTarget[10],rebuildStat[TECHS][2];
// structures
private int baseX,baseY,minx,miny,maxx,maxy;
public int numStructs,numIncendrys,numDefStructs,numExtraStructs[TECHS],numWallWeaps,numBaseStruct,numLightCyborgs;
public int numStructs,numIncendrys,numDefStructs,numExtraStructs[TECHS],numWallWeaps,numBaseStruct,numLightCyborgs,numFundamental;
private STRUCTURESTAT structChoice[5];
public STRUCTURESTAT incendrys[8],structs[13],defStructs[26],extraStructs[TECHS][6],wallWeaps[11];
public STRUCTURESTAT sensorTower,wall,cornerWall,resLab,powGen,playerHQ,lassat,factory,derrick,cybFactory,
@ -218,6 +218,7 @@ trigger watchBaseThreatTr (every, 120);
trigger manageAllyHelpTr (every, 80);
trigger everySec (every, 10);
trigger manageDefendLocationTr (every, 70);
trigger startLevelTr (CALL_START_NEXT_LEVEL);
/* Events */
event multiMsgEv;
@ -390,7 +391,6 @@ event initialisedEvent(CALL_GAMEINIT)
if(aiResponsibleForPlayer(me))
{
bRunning = true;
buildTruck();
}
else
{
@ -398,6 +398,44 @@ event initialisedEvent(CALL_GAMEINIT)
}
}
event startLevel(startLevelTr)
{
if (!bRunning)
{
exit;
}
count = 0;
while (count < numFundamental)
{
// check that struct.
structure = getStructure(structs[count], me);
if(structure == NULLOBJECT) // if missing build it.
{
if (isStructureAvailable(structs[count], me))
{
buildX = baseX; // pick a location
buildY = baseY;
boolResult = pickStructLocationB(structs[count], ref buildX, ref buildY,me,0);
if(boolResult == TRUE)
{
initIterateGroup(buildGroup); // find idle droids in build group.
droid = iterateGroup(buildGroup);
while (droid != NULLOBJECT)
{
if ((droid.order == DORDER_NONE or droid.order == DORDER_RTB) and droidCanReach(droid, buildX, buildY))
{
orderDroidStatsLoc(droid, DORDER_BUILD, structs[count], buildX, buildY); // build it
}
droid = iterateGroup(buildGroup);
}
}
}
}
count = count + 1;
}
buildTruck();
}
// decide what technology branch we will use
function void setTechBranch(int _tech)
{
@ -1347,14 +1385,15 @@ event structBuilt(structBuiltTr)
local FEATURE _oilResource;
local int _count,_count2;
if(structure == NULLOBJECT || droid == NULLOBJECT){
if (structure == NULLOBJECT || droid == NULLOBJECT)
{
exit;
}
/* factory or factory module */
if(structure.stattype == REF_FACTORY)
{
if( isStructureAvailable(facModule,me) and (skGetFactoryCapacity(structure) < 2 ))
if( isStructureAvailable(facModule,me) and (skGetFactoryCapacity(structure) < 2 ) and (getDroidCount(me) > 4))
{
orderDroidStatsLoc(droid, DORDER_BUILD,facModule, structure.x,structure.y); // upgrade it.
}
@ -3032,11 +3071,7 @@ function void shutDownAI()
event reassignPlayers(reassignTr)
{
if(count == me)
{
dbg(" AI 0 is reassigningAI to dropped player ", me);
//reassignAI();
}
dbg("Reassign event is ignored", me);
}
function void reassignAI()
@ -3091,6 +3126,7 @@ function void reassignAI()
setEventTrigger(structBuilt, structBuiltTr);
setEventTrigger(structureDestroyed, structureDestroyedTr);
setEventTrigger(rebuildStructureEv, rebuildStructureTr);
setEventTrigger(startLevel, startLevelTr);
}
/* Returns true if we just received a beacon from a certain player */

View File

@ -10,7 +10,7 @@ run
branchDefault int 0
branchVTOL int 1
me int 5 // this player is player x.
me int 5 // this player is player x.
//default branch
numScouts[0] int 3 // min number of droids in group to aim for.
@ -141,12 +141,13 @@ run
facModule STRUCTURESTAT "A0FacMod1"
resModule STRUCTURESTAT "A0ResearchModule1"
// Essential structs.
// Essential and fundamental structs. Fundamental => what you build on level start
numStructs int 13
structs[0] STRUCTURESTAT "A0PowerGenerator"
structs[1] STRUCTURESTAT "A0LightFactory"
structs[2] STRUCTURESTAT "A0CommandCentre"
structs[3] STRUCTURESTAT "A0ResearchFacility"
numFundamental int 5
structs[0] STRUCTURESTAT "A0LightFactory"
structs[1] STRUCTURESTAT "A0ResearchFacility"
structs[2] STRUCTURESTAT "A0PowerGenerator"
structs[3] STRUCTURESTAT "A0CommandCentre"
structs[4] STRUCTURESTAT "A0CyborgFactory"
structs[5] STRUCTURESTAT "Sys-CB-Tower01"

View File

@ -98,7 +98,7 @@ public STRUCTURESTAT vtolTarget[10],rebuildStat[TECHS][2];
// structures
private int baseX,baseY,minx,miny,maxx,maxy;
public int numStructs,numIncendrys,numDefStructs,numExtraStructs[TECHS],numWallWeaps,numBaseStruct,numLightCyborgs;
public int numStructs,numIncendrys,numDefStructs,numExtraStructs[TECHS],numWallWeaps,numBaseStruct,numLightCyborgs,numFundamental;
private STRUCTURESTAT structChoice[5];
public STRUCTURESTAT incendrys[8],structs[13],defStructs[26],extraStructs[TECHS][6],wallWeaps[11];
public STRUCTURESTAT sensorTower,wall,cornerWall,resLab,powGen,playerHQ,lassat,factory,derrick,cybFactory,
@ -218,6 +218,7 @@ trigger watchBaseThreatTr (every, 120);
trigger manageAllyHelpTr (every, 80);
trigger everySec (every, 10);
trigger manageDefendLocationTr (every, 70);
trigger startLevelTr (CALL_START_NEXT_LEVEL);
/* Events */
event multiMsgEv;
@ -390,7 +391,6 @@ event initialisedEvent(CALL_GAMEINIT)
if(aiResponsibleForPlayer(me))
{
bRunning = true;
buildTruck();
}
else
{
@ -398,6 +398,44 @@ event initialisedEvent(CALL_GAMEINIT)
}
}
event startLevel(startLevelTr)
{
if (!bRunning)
{
exit;
}
count = 0;
while (count < numFundamental)
{
// check that struct.
structure = getStructure(structs[count], me);
if(structure == NULLOBJECT) // if missing build it.
{
if (isStructureAvailable(structs[count], me))
{
buildX = baseX; // pick a location
buildY = baseY;
boolResult = pickStructLocationB(structs[count], ref buildX, ref buildY,me,0);
if(boolResult == TRUE)
{
initIterateGroup(buildGroup); // find idle droids in build group.
droid = iterateGroup(buildGroup);
while (droid != NULLOBJECT)
{
if ((droid.order == DORDER_NONE or droid.order == DORDER_RTB) and droidCanReach(droid, buildX, buildY))
{
orderDroidStatsLoc(droid, DORDER_BUILD, structs[count], buildX, buildY); // build it
}
droid = iterateGroup(buildGroup);
}
}
}
}
count = count + 1;
}
buildTruck();
}
// decide what technology branch we will use
function void setTechBranch(int _tech)
{
@ -1347,14 +1385,15 @@ event structBuilt(structBuiltTr)
local FEATURE _oilResource;
local int _count,_count2;
if(structure == NULLOBJECT || droid == NULLOBJECT){
if (structure == NULLOBJECT || droid == NULLOBJECT)
{
exit;
}
/* factory or factory module */
if(structure.stattype == REF_FACTORY)
{
if( isStructureAvailable(facModule,me) and (skGetFactoryCapacity(structure) < 2 ))
if( isStructureAvailable(facModule,me) and (skGetFactoryCapacity(structure) < 2 ) and (getDroidCount(me) > 4))
{
orderDroidStatsLoc(droid, DORDER_BUILD,facModule, structure.x,structure.y); // upgrade it.
}
@ -3032,11 +3071,7 @@ function void shutDownAI()
event reassignPlayers(reassignTr)
{
if(count == me)
{
dbg(" AI 0 is reassigningAI to dropped player ", me);
//reassignAI();
}
dbg("Reassign event is ignored", me);
}
function void reassignAI()
@ -3091,6 +3126,7 @@ function void reassignAI()
setEventTrigger(structBuilt, structBuiltTr);
setEventTrigger(structureDestroyed, structureDestroyedTr);
setEventTrigger(rebuildStructureEv, rebuildStructureTr);
setEventTrigger(startLevel, startLevelTr);
}
/* Returns true if we just received a beacon from a certain player */

View File

@ -10,7 +10,7 @@ run
branchDefault int 0
branchVTOL int 1
me int 6 // this player is player x.
me int 6 // this player is player x.
//default branch
numScouts[0] int 3 // min number of droids in group to aim for.
@ -141,12 +141,13 @@ run
facModule STRUCTURESTAT "A0FacMod1"
resModule STRUCTURESTAT "A0ResearchModule1"
// Essential structs.
// Essential and fundamental structs. Fundamental => what you build on level start
numStructs int 13
structs[0] STRUCTURESTAT "A0PowerGenerator"
structs[1] STRUCTURESTAT "A0LightFactory"
structs[2] STRUCTURESTAT "A0CommandCentre"
structs[3] STRUCTURESTAT "A0ResearchFacility"
numFundamental int 5
structs[0] STRUCTURESTAT "A0LightFactory"
structs[1] STRUCTURESTAT "A0ResearchFacility"
structs[2] STRUCTURESTAT "A0PowerGenerator"
structs[3] STRUCTURESTAT "A0CommandCentre"
structs[4] STRUCTURESTAT "A0CyborgFactory"
structs[5] STRUCTURESTAT "Sys-CB-Tower01"

View File

@ -98,7 +98,7 @@ public STRUCTURESTAT vtolTarget[10],rebuildStat[TECHS][2];
// structures
private int baseX,baseY,minx,miny,maxx,maxy;
public int numStructs,numIncendrys,numDefStructs,numExtraStructs[TECHS],numWallWeaps,numBaseStruct,numLightCyborgs;
public int numStructs,numIncendrys,numDefStructs,numExtraStructs[TECHS],numWallWeaps,numBaseStruct,numLightCyborgs,numFundamental;
private STRUCTURESTAT structChoice[5];
public STRUCTURESTAT incendrys[8],structs[13],defStructs[26],extraStructs[TECHS][6],wallWeaps[11];
public STRUCTURESTAT sensorTower,wall,cornerWall,resLab,powGen,playerHQ,lassat,factory,derrick,cybFactory,
@ -218,6 +218,7 @@ trigger watchBaseThreatTr (every, 120);
trigger manageAllyHelpTr (every, 80);
trigger everySec (every, 10);
trigger manageDefendLocationTr (every, 70);
trigger startLevelTr (CALL_START_NEXT_LEVEL);
/* Events */
event multiMsgEv;
@ -390,7 +391,6 @@ event initialisedEvent(CALL_GAMEINIT)
if(aiResponsibleForPlayer(me))
{
bRunning = true;
buildTruck();
}
else
{
@ -398,6 +398,44 @@ event initialisedEvent(CALL_GAMEINIT)
}
}
event startLevel(startLevelTr)
{
if (!bRunning)
{
exit;
}
count = 0;
while (count < numFundamental)
{
// check that struct.
structure = getStructure(structs[count], me);
if(structure == NULLOBJECT) // if missing build it.
{
if (isStructureAvailable(structs[count], me))
{
buildX = baseX; // pick a location
buildY = baseY;
boolResult = pickStructLocationB(structs[count], ref buildX, ref buildY,me,0);
if(boolResult == TRUE)
{
initIterateGroup(buildGroup); // find idle droids in build group.
droid = iterateGroup(buildGroup);
while (droid != NULLOBJECT)
{
if ((droid.order == DORDER_NONE or droid.order == DORDER_RTB) and droidCanReach(droid, buildX, buildY))
{
orderDroidStatsLoc(droid, DORDER_BUILD, structs[count], buildX, buildY); // build it
}
droid = iterateGroup(buildGroup);
}
}
}
}
count = count + 1;
}
buildTruck();
}
// decide what technology branch we will use
function void setTechBranch(int _tech)
{
@ -1347,14 +1385,15 @@ event structBuilt(structBuiltTr)
local FEATURE _oilResource;
local int _count,_count2;
if(structure == NULLOBJECT || droid == NULLOBJECT){
if (structure == NULLOBJECT || droid == NULLOBJECT)
{
exit;
}
/* factory or factory module */
if(structure.stattype == REF_FACTORY)
{
if( isStructureAvailable(facModule,me) and (skGetFactoryCapacity(structure) < 2 ))
if( isStructureAvailable(facModule,me) and (skGetFactoryCapacity(structure) < 2 ) and (getDroidCount(me) > 4))
{
orderDroidStatsLoc(droid, DORDER_BUILD,facModule, structure.x,structure.y); // upgrade it.
}
@ -3032,11 +3071,7 @@ function void shutDownAI()
event reassignPlayers(reassignTr)
{
if(count == me)
{
dbg(" AI 0 is reassigningAI to dropped player ", me);
//reassignAI();
}
dbg("Reassign event is ignored", me);
}
function void reassignAI()
@ -3091,6 +3126,7 @@ function void reassignAI()
setEventTrigger(structBuilt, structBuiltTr);
setEventTrigger(structureDestroyed, structureDestroyedTr);
setEventTrigger(rebuildStructureEv, rebuildStructureTr);
setEventTrigger(startLevel, startLevelTr);
}
/* Returns true if we just received a beacon from a certain player */

View File

@ -10,7 +10,7 @@ run
branchDefault int 0
branchVTOL int 1
me int 7 // this player is player x.
me int 7 // this player is player x.
//default branch
numScouts[0] int 3 // min number of droids in group to aim for.
@ -141,12 +141,13 @@ run
facModule STRUCTURESTAT "A0FacMod1"
resModule STRUCTURESTAT "A0ResearchModule1"
// Essential structs.
// Essential and fundamental structs. Fundamental => what you build on level start
numStructs int 13
structs[0] STRUCTURESTAT "A0PowerGenerator"
structs[1] STRUCTURESTAT "A0LightFactory"
structs[2] STRUCTURESTAT "A0CommandCentre"
structs[3] STRUCTURESTAT "A0ResearchFacility"
numFundamental int 5
structs[0] STRUCTURESTAT "A0LightFactory"
structs[1] STRUCTURESTAT "A0ResearchFacility"
structs[2] STRUCTURESTAT "A0PowerGenerator"
structs[3] STRUCTURESTAT "A0CommandCentre"
structs[4] STRUCTURESTAT "A0CyborgFactory"
structs[5] STRUCTURESTAT "Sys-CB-Tower01"