diff --git a/data/base/multiplay/skirmish/player0.slo b/data/base/multiplay/skirmish/player0.slo index 0e5557977..3562c56d6 100644 --- a/data/base/multiplay/skirmish/player0.slo +++ b/data/base/multiplay/skirmish/player0.slo @@ -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 */ diff --git a/data/base/multiplay/skirmish/player0.vlo b/data/base/multiplay/skirmish/player0.vlo index b498da499..4e8688547 100644 --- a/data/base/multiplay/skirmish/player0.vlo +++ b/data/base/multiplay/skirmish/player0.vlo @@ -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" diff --git a/data/base/multiplay/skirmish/player1.slo b/data/base/multiplay/skirmish/player1.slo index 0e5557977..3562c56d6 100644 --- a/data/base/multiplay/skirmish/player1.slo +++ b/data/base/multiplay/skirmish/player1.slo @@ -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 */ diff --git a/data/base/multiplay/skirmish/player1.vlo b/data/base/multiplay/skirmish/player1.vlo index a33559e1e..73ca8a0d8 100644 --- a/data/base/multiplay/skirmish/player1.vlo +++ b/data/base/multiplay/skirmish/player1.vlo @@ -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" diff --git a/data/base/multiplay/skirmish/player2.slo b/data/base/multiplay/skirmish/player2.slo index 0e5557977..3562c56d6 100644 --- a/data/base/multiplay/skirmish/player2.slo +++ b/data/base/multiplay/skirmish/player2.slo @@ -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 */ diff --git a/data/base/multiplay/skirmish/player2.vlo b/data/base/multiplay/skirmish/player2.vlo index 13fe53d8d..e6e30b51a 100644 --- a/data/base/multiplay/skirmish/player2.vlo +++ b/data/base/multiplay/skirmish/player2.vlo @@ -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" diff --git a/data/base/multiplay/skirmish/player3.slo b/data/base/multiplay/skirmish/player3.slo index 0e5557977..3562c56d6 100644 --- a/data/base/multiplay/skirmish/player3.slo +++ b/data/base/multiplay/skirmish/player3.slo @@ -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 */ diff --git a/data/base/multiplay/skirmish/player3.vlo b/data/base/multiplay/skirmish/player3.vlo index 5b828029a..46438fe59 100644 --- a/data/base/multiplay/skirmish/player3.vlo +++ b/data/base/multiplay/skirmish/player3.vlo @@ -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" diff --git a/data/base/multiplay/skirmish/player4.slo b/data/base/multiplay/skirmish/player4.slo index 0e5557977..3562c56d6 100644 --- a/data/base/multiplay/skirmish/player4.slo +++ b/data/base/multiplay/skirmish/player4.slo @@ -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 */ diff --git a/data/base/multiplay/skirmish/player4.vlo b/data/base/multiplay/skirmish/player4.vlo index f07ecee5e..d235875f2 100644 --- a/data/base/multiplay/skirmish/player4.vlo +++ b/data/base/multiplay/skirmish/player4.vlo @@ -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" diff --git a/data/base/multiplay/skirmish/player5.slo b/data/base/multiplay/skirmish/player5.slo index 0e5557977..3562c56d6 100644 --- a/data/base/multiplay/skirmish/player5.slo +++ b/data/base/multiplay/skirmish/player5.slo @@ -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 */ diff --git a/data/base/multiplay/skirmish/player5.vlo b/data/base/multiplay/skirmish/player5.vlo index d077fde31..4bf5d8cfe 100644 --- a/data/base/multiplay/skirmish/player5.vlo +++ b/data/base/multiplay/skirmish/player5.vlo @@ -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" diff --git a/data/base/multiplay/skirmish/player6.slo b/data/base/multiplay/skirmish/player6.slo index 0e5557977..3562c56d6 100644 --- a/data/base/multiplay/skirmish/player6.slo +++ b/data/base/multiplay/skirmish/player6.slo @@ -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 */ diff --git a/data/base/multiplay/skirmish/player6.vlo b/data/base/multiplay/skirmish/player6.vlo index 8d468afb6..de2225db5 100644 --- a/data/base/multiplay/skirmish/player6.vlo +++ b/data/base/multiplay/skirmish/player6.vlo @@ -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" diff --git a/data/base/multiplay/skirmish/player7.slo b/data/base/multiplay/skirmish/player7.slo index 0e5557977..3562c56d6 100644 --- a/data/base/multiplay/skirmish/player7.slo +++ b/data/base/multiplay/skirmish/player7.slo @@ -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 */ diff --git a/data/base/multiplay/skirmish/player7.vlo b/data/base/multiplay/skirmish/player7.vlo index 3e791e17c..fba45afa2 100644 --- a/data/base/multiplay/skirmish/player7.vlo +++ b/data/base/multiplay/skirmish/player7.vlo @@ -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"