Make AI use event chainloading for basic structures and new trucks. This means that instead of calling

common AI functions from several places, which can lead to the CPU spending much time doing AI stuff
that frame, or setting the object to idle and wait for a repeat event to pick it up, which can lead to
long delays, it queues up another event for the next AI frame to continue processing.


git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@9133 4a71c877-e1ca-e34f-864e-861f7616d084
master
Per Inge Mathisen 2010-01-11 20:16:57 +00:00 committed by Git SVN Gateway
parent 58425f4144
commit 027cb31486
8 changed files with 96 additions and 176 deletions

View File

@ -221,9 +221,10 @@ trigger manageAllyHelpTr (every, 80);
trigger everySec (every, 10); trigger everySec (every, 10);
trigger manageDefendLocationTr (every, 70); trigger manageDefendLocationTr (every, 70);
trigger startLevelTr (CALL_START_NEXT_LEVEL); trigger startLevelTr (CALL_START_NEXT_LEVEL);
trigger launchFundamentalsTr (wait, 1); trigger chainloadTr (wait, 1);
/* Events */ /* Events */
event conDroids;
event multiMsgEv; event multiMsgEv;
event beaconEv; event beaconEv;
event watchBaseThreat; event watchBaseThreat;
@ -277,7 +278,6 @@ function int numEnemyAAInRange(int _x, int _y, int _range);
function BASEOBJ chooseVtolTarget(bool bExclusiveTarget); function BASEOBJ chooseVtolTarget(bool bExclusiveTarget);
function int getVtolTargetWeight(BASEOBJ _target); function int getVtolTargetWeight(BASEOBJ _target);
function bool vtolTargetAssigned(BASEOBJ _target); function bool vtolTargetAssigned(BASEOBJ _target);
function void buildTruck();
function int numBuildSameBuilding(STRUCTURESTAT _checkStat, int _x, int _y); function int numBuildSameBuilding(STRUCTURESTAT _checkStat, int _x, int _y);
function void expandBase(DROID _truck); function void expandBase(DROID _truck);
function int totalVtols(); function int totalVtols();
@ -382,19 +382,18 @@ event initialisedEvent(CALL_GAMEINIT)
fundamentalBeingBuilt = derrick; // to avoid ever being null fundamentalBeingBuilt = derrick; // to avoid ever being null
bRunning = false;
if(aiResponsibleForPlayer(me)) if(aiResponsibleForPlayer(me))
{ {
bRunning = true; bRunning = true;
} }
else else
{ {
bRunning = false;
shutDownAI(); shutDownAI();
} }
} }
function void buildFundamentals() event buildFundamentals(inactive)
{ {
count = 0; count = 0;
while (count < numFundamental) while (count < numFundamental)
@ -428,18 +427,14 @@ function void buildFundamentals()
count = count + 1; count = count + 1;
} }
fundamentalBeingBuilt = derrick; fundamentalBeingBuilt = derrick;
} setEventTrigger(buildFundamentals, inactive);
event launchFundamentals(inactive)
{
buildFundamentals();
setEventTrigger(launchFundamentals, inactive);
} }
event startLevel(startLevelTr) event startLevel(startLevelTr)
{ {
buildFundamentals(); setEventTrigger(buildFundamentals, chainloadTr);
buildTruck(); setEventTrigger(conDroids, chainloadTr);
setEventTrigger(startLevel, inactive);
} }
// decide what technology branch we will use // decide what technology branch we will use
@ -1386,7 +1381,7 @@ event structBuilt(structBuiltTr)
} }
else else
{ {
buildTruck(); setEventTrigger(conDroids, chainloadTr);
} }
} }
/* vtol factory or vtol factory module */ /* vtol factory or vtol factory module */
@ -1414,7 +1409,7 @@ event structBuilt(structBuiltTr)
// Check if available trucks need to build more absolute necessities right away. We need a trigger here because // Check if available trucks need to build more absolute necessities right away. We need a trigger here because
// droids involved in building have not yet come out of their build orders. // droids involved in building have not yet come out of their build orders.
setEventTrigger(launchFundamentals, launchFundamentalsTr); setEventTrigger(buildFundamentals, chainloadTr);
//see if we have just rebuilt a destroyed structure //see if we have just rebuilt a destroyed structure
_count = 0; _count = 0;
@ -1480,11 +1475,6 @@ event droidDestroyed(droidDestroyedTr)
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
// build more con droids. // build more con droids.
event conDroids(conDroidsTr) event conDroids(conDroidsTr)
{
buildTruck();
}
function void buildTruck()
{ {
local int _maxTrucks; local int _maxTrucks;
local STRUCTURE _factory; local STRUCTURE _factory;
@ -1545,9 +1535,9 @@ function void buildTruck()
_factory = enumStruct(); _factory = enumStruct();
} }
setEventTrigger(conDroids, conDroidsTr);
} }
//Build a droid //Build a droid
function bool buildUnit(TEMPLATE _tankTemplate, STRUCTURE _factory, STRUCTURESTAT _factoryType, bool _bIdleOnly) function bool buildUnit(TEMPLATE _tankTemplate, STRUCTURE _factory, STRUCTURESTAT _factoryType, bool _bIdleOnly)
{ {
@ -4136,8 +4126,8 @@ event consoleEv(consoleTr)
if(not bRunning) //make sure current machine is responsible for this AI and it's not already active if(not bRunning) //make sure current machine is responsible for this AI and it's not already active
{ {
console(getPlayerName(me) & " is active"); console(getPlayerName(me) & " is active");
reassignAI(); reassignAI();
setEventTrigger(startLevel, chainloadTr);
} }
} }
} }

View File

@ -221,9 +221,10 @@ trigger manageAllyHelpTr (every, 80);
trigger everySec (every, 10); trigger everySec (every, 10);
trigger manageDefendLocationTr (every, 70); trigger manageDefendLocationTr (every, 70);
trigger startLevelTr (CALL_START_NEXT_LEVEL); trigger startLevelTr (CALL_START_NEXT_LEVEL);
trigger launchFundamentalsTr (wait, 1); trigger chainloadTr (wait, 1);
/* Events */ /* Events */
event conDroids;
event multiMsgEv; event multiMsgEv;
event beaconEv; event beaconEv;
event watchBaseThreat; event watchBaseThreat;
@ -277,7 +278,6 @@ function int numEnemyAAInRange(int _x, int _y, int _range);
function BASEOBJ chooseVtolTarget(bool bExclusiveTarget); function BASEOBJ chooseVtolTarget(bool bExclusiveTarget);
function int getVtolTargetWeight(BASEOBJ _target); function int getVtolTargetWeight(BASEOBJ _target);
function bool vtolTargetAssigned(BASEOBJ _target); function bool vtolTargetAssigned(BASEOBJ _target);
function void buildTruck();
function int numBuildSameBuilding(STRUCTURESTAT _checkStat, int _x, int _y); function int numBuildSameBuilding(STRUCTURESTAT _checkStat, int _x, int _y);
function void expandBase(DROID _truck); function void expandBase(DROID _truck);
function int totalVtols(); function int totalVtols();
@ -382,19 +382,18 @@ event initialisedEvent(CALL_GAMEINIT)
fundamentalBeingBuilt = derrick; // to avoid ever being null fundamentalBeingBuilt = derrick; // to avoid ever being null
bRunning = false;
if(aiResponsibleForPlayer(me)) if(aiResponsibleForPlayer(me))
{ {
bRunning = true; bRunning = true;
} }
else else
{ {
bRunning = false;
shutDownAI(); shutDownAI();
} }
} }
function void buildFundamentals() event buildFundamentals(inactive)
{ {
count = 0; count = 0;
while (count < numFundamental) while (count < numFundamental)
@ -428,18 +427,14 @@ function void buildFundamentals()
count = count + 1; count = count + 1;
} }
fundamentalBeingBuilt = derrick; fundamentalBeingBuilt = derrick;
} setEventTrigger(buildFundamentals, inactive);
event launchFundamentals(inactive)
{
buildFundamentals();
setEventTrigger(launchFundamentals, inactive);
} }
event startLevel(startLevelTr) event startLevel(startLevelTr)
{ {
buildFundamentals(); setEventTrigger(buildFundamentals, chainloadTr);
buildTruck(); setEventTrigger(conDroids, chainloadTr);
setEventTrigger(startLevel, inactive);
} }
// decide what technology branch we will use // decide what technology branch we will use
@ -1386,7 +1381,7 @@ event structBuilt(structBuiltTr)
} }
else else
{ {
buildTruck(); setEventTrigger(conDroids, chainloadTr);
} }
} }
/* vtol factory or vtol factory module */ /* vtol factory or vtol factory module */
@ -1414,7 +1409,7 @@ event structBuilt(structBuiltTr)
// Check if available trucks need to build more absolute necessities right away. We need a trigger here because // Check if available trucks need to build more absolute necessities right away. We need a trigger here because
// droids involved in building have not yet come out of their build orders. // droids involved in building have not yet come out of their build orders.
setEventTrigger(launchFundamentals, launchFundamentalsTr); setEventTrigger(buildFundamentals, chainloadTr);
//see if we have just rebuilt a destroyed structure //see if we have just rebuilt a destroyed structure
_count = 0; _count = 0;
@ -1480,11 +1475,6 @@ event droidDestroyed(droidDestroyedTr)
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
// build more con droids. // build more con droids.
event conDroids(conDroidsTr) event conDroids(conDroidsTr)
{
buildTruck();
}
function void buildTruck()
{ {
local int _maxTrucks; local int _maxTrucks;
local STRUCTURE _factory; local STRUCTURE _factory;
@ -1545,9 +1535,9 @@ function void buildTruck()
_factory = enumStruct(); _factory = enumStruct();
} }
setEventTrigger(conDroids, conDroidsTr);
} }
//Build a droid //Build a droid
function bool buildUnit(TEMPLATE _tankTemplate, STRUCTURE _factory, STRUCTURESTAT _factoryType, bool _bIdleOnly) function bool buildUnit(TEMPLATE _tankTemplate, STRUCTURE _factory, STRUCTURESTAT _factoryType, bool _bIdleOnly)
{ {
@ -4136,8 +4126,8 @@ event consoleEv(consoleTr)
if(not bRunning) //make sure current machine is responsible for this AI and it's not already active if(not bRunning) //make sure current machine is responsible for this AI and it's not already active
{ {
console(getPlayerName(me) & " is active"); console(getPlayerName(me) & " is active");
reassignAI(); reassignAI();
setEventTrigger(startLevel, chainloadTr);
} }
} }
} }

View File

@ -221,9 +221,10 @@ trigger manageAllyHelpTr (every, 80);
trigger everySec (every, 10); trigger everySec (every, 10);
trigger manageDefendLocationTr (every, 70); trigger manageDefendLocationTr (every, 70);
trigger startLevelTr (CALL_START_NEXT_LEVEL); trigger startLevelTr (CALL_START_NEXT_LEVEL);
trigger launchFundamentalsTr (wait, 1); trigger chainloadTr (wait, 1);
/* Events */ /* Events */
event conDroids;
event multiMsgEv; event multiMsgEv;
event beaconEv; event beaconEv;
event watchBaseThreat; event watchBaseThreat;
@ -277,7 +278,6 @@ function int numEnemyAAInRange(int _x, int _y, int _range);
function BASEOBJ chooseVtolTarget(bool bExclusiveTarget); function BASEOBJ chooseVtolTarget(bool bExclusiveTarget);
function int getVtolTargetWeight(BASEOBJ _target); function int getVtolTargetWeight(BASEOBJ _target);
function bool vtolTargetAssigned(BASEOBJ _target); function bool vtolTargetAssigned(BASEOBJ _target);
function void buildTruck();
function int numBuildSameBuilding(STRUCTURESTAT _checkStat, int _x, int _y); function int numBuildSameBuilding(STRUCTURESTAT _checkStat, int _x, int _y);
function void expandBase(DROID _truck); function void expandBase(DROID _truck);
function int totalVtols(); function int totalVtols();
@ -382,19 +382,18 @@ event initialisedEvent(CALL_GAMEINIT)
fundamentalBeingBuilt = derrick; // to avoid ever being null fundamentalBeingBuilt = derrick; // to avoid ever being null
bRunning = false;
if(aiResponsibleForPlayer(me)) if(aiResponsibleForPlayer(me))
{ {
bRunning = true; bRunning = true;
} }
else else
{ {
bRunning = false;
shutDownAI(); shutDownAI();
} }
} }
function void buildFundamentals() event buildFundamentals(inactive)
{ {
count = 0; count = 0;
while (count < numFundamental) while (count < numFundamental)
@ -428,18 +427,14 @@ function void buildFundamentals()
count = count + 1; count = count + 1;
} }
fundamentalBeingBuilt = derrick; fundamentalBeingBuilt = derrick;
} setEventTrigger(buildFundamentals, inactive);
event launchFundamentals(inactive)
{
buildFundamentals();
setEventTrigger(launchFundamentals, inactive);
} }
event startLevel(startLevelTr) event startLevel(startLevelTr)
{ {
buildFundamentals(); setEventTrigger(buildFundamentals, chainloadTr);
buildTruck(); setEventTrigger(conDroids, chainloadTr);
setEventTrigger(startLevel, inactive);
} }
// decide what technology branch we will use // decide what technology branch we will use
@ -1386,7 +1381,7 @@ event structBuilt(structBuiltTr)
} }
else else
{ {
buildTruck(); setEventTrigger(conDroids, chainloadTr);
} }
} }
/* vtol factory or vtol factory module */ /* vtol factory or vtol factory module */
@ -1414,7 +1409,7 @@ event structBuilt(structBuiltTr)
// Check if available trucks need to build more absolute necessities right away. We need a trigger here because // Check if available trucks need to build more absolute necessities right away. We need a trigger here because
// droids involved in building have not yet come out of their build orders. // droids involved in building have not yet come out of their build orders.
setEventTrigger(launchFundamentals, launchFundamentalsTr); setEventTrigger(buildFundamentals, chainloadTr);
//see if we have just rebuilt a destroyed structure //see if we have just rebuilt a destroyed structure
_count = 0; _count = 0;
@ -1480,11 +1475,6 @@ event droidDestroyed(droidDestroyedTr)
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
// build more con droids. // build more con droids.
event conDroids(conDroidsTr) event conDroids(conDroidsTr)
{
buildTruck();
}
function void buildTruck()
{ {
local int _maxTrucks; local int _maxTrucks;
local STRUCTURE _factory; local STRUCTURE _factory;
@ -1545,9 +1535,9 @@ function void buildTruck()
_factory = enumStruct(); _factory = enumStruct();
} }
setEventTrigger(conDroids, conDroidsTr);
} }
//Build a droid //Build a droid
function bool buildUnit(TEMPLATE _tankTemplate, STRUCTURE _factory, STRUCTURESTAT _factoryType, bool _bIdleOnly) function bool buildUnit(TEMPLATE _tankTemplate, STRUCTURE _factory, STRUCTURESTAT _factoryType, bool _bIdleOnly)
{ {
@ -4136,8 +4126,8 @@ event consoleEv(consoleTr)
if(not bRunning) //make sure current machine is responsible for this AI and it's not already active if(not bRunning) //make sure current machine is responsible for this AI and it's not already active
{ {
console(getPlayerName(me) & " is active"); console(getPlayerName(me) & " is active");
reassignAI(); reassignAI();
setEventTrigger(startLevel, chainloadTr);
} }
} }
} }

View File

@ -221,9 +221,10 @@ trigger manageAllyHelpTr (every, 80);
trigger everySec (every, 10); trigger everySec (every, 10);
trigger manageDefendLocationTr (every, 70); trigger manageDefendLocationTr (every, 70);
trigger startLevelTr (CALL_START_NEXT_LEVEL); trigger startLevelTr (CALL_START_NEXT_LEVEL);
trigger launchFundamentalsTr (wait, 1); trigger chainloadTr (wait, 1);
/* Events */ /* Events */
event conDroids;
event multiMsgEv; event multiMsgEv;
event beaconEv; event beaconEv;
event watchBaseThreat; event watchBaseThreat;
@ -277,7 +278,6 @@ function int numEnemyAAInRange(int _x, int _y, int _range);
function BASEOBJ chooseVtolTarget(bool bExclusiveTarget); function BASEOBJ chooseVtolTarget(bool bExclusiveTarget);
function int getVtolTargetWeight(BASEOBJ _target); function int getVtolTargetWeight(BASEOBJ _target);
function bool vtolTargetAssigned(BASEOBJ _target); function bool vtolTargetAssigned(BASEOBJ _target);
function void buildTruck();
function int numBuildSameBuilding(STRUCTURESTAT _checkStat, int _x, int _y); function int numBuildSameBuilding(STRUCTURESTAT _checkStat, int _x, int _y);
function void expandBase(DROID _truck); function void expandBase(DROID _truck);
function int totalVtols(); function int totalVtols();
@ -382,19 +382,18 @@ event initialisedEvent(CALL_GAMEINIT)
fundamentalBeingBuilt = derrick; // to avoid ever being null fundamentalBeingBuilt = derrick; // to avoid ever being null
bRunning = false;
if(aiResponsibleForPlayer(me)) if(aiResponsibleForPlayer(me))
{ {
bRunning = true; bRunning = true;
} }
else else
{ {
bRunning = false;
shutDownAI(); shutDownAI();
} }
} }
function void buildFundamentals() event buildFundamentals(inactive)
{ {
count = 0; count = 0;
while (count < numFundamental) while (count < numFundamental)
@ -428,18 +427,14 @@ function void buildFundamentals()
count = count + 1; count = count + 1;
} }
fundamentalBeingBuilt = derrick; fundamentalBeingBuilt = derrick;
} setEventTrigger(buildFundamentals, inactive);
event launchFundamentals(inactive)
{
buildFundamentals();
setEventTrigger(launchFundamentals, inactive);
} }
event startLevel(startLevelTr) event startLevel(startLevelTr)
{ {
buildFundamentals(); setEventTrigger(buildFundamentals, chainloadTr);
buildTruck(); setEventTrigger(conDroids, chainloadTr);
setEventTrigger(startLevel, inactive);
} }
// decide what technology branch we will use // decide what technology branch we will use
@ -1386,7 +1381,7 @@ event structBuilt(structBuiltTr)
} }
else else
{ {
buildTruck(); setEventTrigger(conDroids, chainloadTr);
} }
} }
/* vtol factory or vtol factory module */ /* vtol factory or vtol factory module */
@ -1414,7 +1409,7 @@ event structBuilt(structBuiltTr)
// Check if available trucks need to build more absolute necessities right away. We need a trigger here because // Check if available trucks need to build more absolute necessities right away. We need a trigger here because
// droids involved in building have not yet come out of their build orders. // droids involved in building have not yet come out of their build orders.
setEventTrigger(launchFundamentals, launchFundamentalsTr); setEventTrigger(buildFundamentals, chainloadTr);
//see if we have just rebuilt a destroyed structure //see if we have just rebuilt a destroyed structure
_count = 0; _count = 0;
@ -1480,11 +1475,6 @@ event droidDestroyed(droidDestroyedTr)
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
// build more con droids. // build more con droids.
event conDroids(conDroidsTr) event conDroids(conDroidsTr)
{
buildTruck();
}
function void buildTruck()
{ {
local int _maxTrucks; local int _maxTrucks;
local STRUCTURE _factory; local STRUCTURE _factory;
@ -1545,9 +1535,9 @@ function void buildTruck()
_factory = enumStruct(); _factory = enumStruct();
} }
setEventTrigger(conDroids, conDroidsTr);
} }
//Build a droid //Build a droid
function bool buildUnit(TEMPLATE _tankTemplate, STRUCTURE _factory, STRUCTURESTAT _factoryType, bool _bIdleOnly) function bool buildUnit(TEMPLATE _tankTemplate, STRUCTURE _factory, STRUCTURESTAT _factoryType, bool _bIdleOnly)
{ {
@ -4136,8 +4126,8 @@ event consoleEv(consoleTr)
if(not bRunning) //make sure current machine is responsible for this AI and it's not already active if(not bRunning) //make sure current machine is responsible for this AI and it's not already active
{ {
console(getPlayerName(me) & " is active"); console(getPlayerName(me) & " is active");
reassignAI(); reassignAI();
setEventTrigger(startLevel, chainloadTr);
} }
} }
} }

View File

@ -221,9 +221,10 @@ trigger manageAllyHelpTr (every, 80);
trigger everySec (every, 10); trigger everySec (every, 10);
trigger manageDefendLocationTr (every, 70); trigger manageDefendLocationTr (every, 70);
trigger startLevelTr (CALL_START_NEXT_LEVEL); trigger startLevelTr (CALL_START_NEXT_LEVEL);
trigger launchFundamentalsTr (wait, 1); trigger chainloadTr (wait, 1);
/* Events */ /* Events */
event conDroids;
event multiMsgEv; event multiMsgEv;
event beaconEv; event beaconEv;
event watchBaseThreat; event watchBaseThreat;
@ -277,7 +278,6 @@ function int numEnemyAAInRange(int _x, int _y, int _range);
function BASEOBJ chooseVtolTarget(bool bExclusiveTarget); function BASEOBJ chooseVtolTarget(bool bExclusiveTarget);
function int getVtolTargetWeight(BASEOBJ _target); function int getVtolTargetWeight(BASEOBJ _target);
function bool vtolTargetAssigned(BASEOBJ _target); function bool vtolTargetAssigned(BASEOBJ _target);
function void buildTruck();
function int numBuildSameBuilding(STRUCTURESTAT _checkStat, int _x, int _y); function int numBuildSameBuilding(STRUCTURESTAT _checkStat, int _x, int _y);
function void expandBase(DROID _truck); function void expandBase(DROID _truck);
function int totalVtols(); function int totalVtols();
@ -382,19 +382,18 @@ event initialisedEvent(CALL_GAMEINIT)
fundamentalBeingBuilt = derrick; // to avoid ever being null fundamentalBeingBuilt = derrick; // to avoid ever being null
bRunning = false;
if(aiResponsibleForPlayer(me)) if(aiResponsibleForPlayer(me))
{ {
bRunning = true; bRunning = true;
} }
else else
{ {
bRunning = false;
shutDownAI(); shutDownAI();
} }
} }
function void buildFundamentals() event buildFundamentals(inactive)
{ {
count = 0; count = 0;
while (count < numFundamental) while (count < numFundamental)
@ -428,18 +427,14 @@ function void buildFundamentals()
count = count + 1; count = count + 1;
} }
fundamentalBeingBuilt = derrick; fundamentalBeingBuilt = derrick;
} setEventTrigger(buildFundamentals, inactive);
event launchFundamentals(inactive)
{
buildFundamentals();
setEventTrigger(launchFundamentals, inactive);
} }
event startLevel(startLevelTr) event startLevel(startLevelTr)
{ {
buildFundamentals(); setEventTrigger(buildFundamentals, chainloadTr);
buildTruck(); setEventTrigger(conDroids, chainloadTr);
setEventTrigger(startLevel, inactive);
} }
// decide what technology branch we will use // decide what technology branch we will use
@ -1386,7 +1381,7 @@ event structBuilt(structBuiltTr)
} }
else else
{ {
buildTruck(); setEventTrigger(conDroids, chainloadTr);
} }
} }
/* vtol factory or vtol factory module */ /* vtol factory or vtol factory module */
@ -1414,7 +1409,7 @@ event structBuilt(structBuiltTr)
// Check if available trucks need to build more absolute necessities right away. We need a trigger here because // Check if available trucks need to build more absolute necessities right away. We need a trigger here because
// droids involved in building have not yet come out of their build orders. // droids involved in building have not yet come out of their build orders.
setEventTrigger(launchFundamentals, launchFundamentalsTr); setEventTrigger(buildFundamentals, chainloadTr);
//see if we have just rebuilt a destroyed structure //see if we have just rebuilt a destroyed structure
_count = 0; _count = 0;
@ -1480,11 +1475,6 @@ event droidDestroyed(droidDestroyedTr)
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
// build more con droids. // build more con droids.
event conDroids(conDroidsTr) event conDroids(conDroidsTr)
{
buildTruck();
}
function void buildTruck()
{ {
local int _maxTrucks; local int _maxTrucks;
local STRUCTURE _factory; local STRUCTURE _factory;
@ -1545,9 +1535,9 @@ function void buildTruck()
_factory = enumStruct(); _factory = enumStruct();
} }
setEventTrigger(conDroids, conDroidsTr);
} }
//Build a droid //Build a droid
function bool buildUnit(TEMPLATE _tankTemplate, STRUCTURE _factory, STRUCTURESTAT _factoryType, bool _bIdleOnly) function bool buildUnit(TEMPLATE _tankTemplate, STRUCTURE _factory, STRUCTURESTAT _factoryType, bool _bIdleOnly)
{ {
@ -4136,8 +4126,8 @@ event consoleEv(consoleTr)
if(not bRunning) //make sure current machine is responsible for this AI and it's not already active if(not bRunning) //make sure current machine is responsible for this AI and it's not already active
{ {
console(getPlayerName(me) & " is active"); console(getPlayerName(me) & " is active");
reassignAI(); reassignAI();
setEventTrigger(startLevel, chainloadTr);
} }
} }
} }

View File

@ -221,9 +221,10 @@ trigger manageAllyHelpTr (every, 80);
trigger everySec (every, 10); trigger everySec (every, 10);
trigger manageDefendLocationTr (every, 70); trigger manageDefendLocationTr (every, 70);
trigger startLevelTr (CALL_START_NEXT_LEVEL); trigger startLevelTr (CALL_START_NEXT_LEVEL);
trigger launchFundamentalsTr (wait, 1); trigger chainloadTr (wait, 1);
/* Events */ /* Events */
event conDroids;
event multiMsgEv; event multiMsgEv;
event beaconEv; event beaconEv;
event watchBaseThreat; event watchBaseThreat;
@ -277,7 +278,6 @@ function int numEnemyAAInRange(int _x, int _y, int _range);
function BASEOBJ chooseVtolTarget(bool bExclusiveTarget); function BASEOBJ chooseVtolTarget(bool bExclusiveTarget);
function int getVtolTargetWeight(BASEOBJ _target); function int getVtolTargetWeight(BASEOBJ _target);
function bool vtolTargetAssigned(BASEOBJ _target); function bool vtolTargetAssigned(BASEOBJ _target);
function void buildTruck();
function int numBuildSameBuilding(STRUCTURESTAT _checkStat, int _x, int _y); function int numBuildSameBuilding(STRUCTURESTAT _checkStat, int _x, int _y);
function void expandBase(DROID _truck); function void expandBase(DROID _truck);
function int totalVtols(); function int totalVtols();
@ -382,19 +382,18 @@ event initialisedEvent(CALL_GAMEINIT)
fundamentalBeingBuilt = derrick; // to avoid ever being null fundamentalBeingBuilt = derrick; // to avoid ever being null
bRunning = false;
if(aiResponsibleForPlayer(me)) if(aiResponsibleForPlayer(me))
{ {
bRunning = true; bRunning = true;
} }
else else
{ {
bRunning = false;
shutDownAI(); shutDownAI();
} }
} }
function void buildFundamentals() event buildFundamentals(inactive)
{ {
count = 0; count = 0;
while (count < numFundamental) while (count < numFundamental)
@ -428,18 +427,14 @@ function void buildFundamentals()
count = count + 1; count = count + 1;
} }
fundamentalBeingBuilt = derrick; fundamentalBeingBuilt = derrick;
} setEventTrigger(buildFundamentals, inactive);
event launchFundamentals(inactive)
{
buildFundamentals();
setEventTrigger(launchFundamentals, inactive);
} }
event startLevel(startLevelTr) event startLevel(startLevelTr)
{ {
buildFundamentals(); setEventTrigger(buildFundamentals, chainloadTr);
buildTruck(); setEventTrigger(conDroids, chainloadTr);
setEventTrigger(startLevel, inactive);
} }
// decide what technology branch we will use // decide what technology branch we will use
@ -1386,7 +1381,7 @@ event structBuilt(structBuiltTr)
} }
else else
{ {
buildTruck(); setEventTrigger(conDroids, chainloadTr);
} }
} }
/* vtol factory or vtol factory module */ /* vtol factory or vtol factory module */
@ -1414,7 +1409,7 @@ event structBuilt(structBuiltTr)
// Check if available trucks need to build more absolute necessities right away. We need a trigger here because // Check if available trucks need to build more absolute necessities right away. We need a trigger here because
// droids involved in building have not yet come out of their build orders. // droids involved in building have not yet come out of their build orders.
setEventTrigger(launchFundamentals, launchFundamentalsTr); setEventTrigger(buildFundamentals, chainloadTr);
//see if we have just rebuilt a destroyed structure //see if we have just rebuilt a destroyed structure
_count = 0; _count = 0;
@ -1480,11 +1475,6 @@ event droidDestroyed(droidDestroyedTr)
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
// build more con droids. // build more con droids.
event conDroids(conDroidsTr) event conDroids(conDroidsTr)
{
buildTruck();
}
function void buildTruck()
{ {
local int _maxTrucks; local int _maxTrucks;
local STRUCTURE _factory; local STRUCTURE _factory;
@ -1545,9 +1535,9 @@ function void buildTruck()
_factory = enumStruct(); _factory = enumStruct();
} }
setEventTrigger(conDroids, conDroidsTr);
} }
//Build a droid //Build a droid
function bool buildUnit(TEMPLATE _tankTemplate, STRUCTURE _factory, STRUCTURESTAT _factoryType, bool _bIdleOnly) function bool buildUnit(TEMPLATE _tankTemplate, STRUCTURE _factory, STRUCTURESTAT _factoryType, bool _bIdleOnly)
{ {
@ -4136,8 +4126,8 @@ event consoleEv(consoleTr)
if(not bRunning) //make sure current machine is responsible for this AI and it's not already active if(not bRunning) //make sure current machine is responsible for this AI and it's not already active
{ {
console(getPlayerName(me) & " is active"); console(getPlayerName(me) & " is active");
reassignAI(); reassignAI();
setEventTrigger(startLevel, chainloadTr);
} }
} }
} }

View File

@ -221,9 +221,10 @@ trigger manageAllyHelpTr (every, 80);
trigger everySec (every, 10); trigger everySec (every, 10);
trigger manageDefendLocationTr (every, 70); trigger manageDefendLocationTr (every, 70);
trigger startLevelTr (CALL_START_NEXT_LEVEL); trigger startLevelTr (CALL_START_NEXT_LEVEL);
trigger launchFundamentalsTr (wait, 1); trigger chainloadTr (wait, 1);
/* Events */ /* Events */
event conDroids;
event multiMsgEv; event multiMsgEv;
event beaconEv; event beaconEv;
event watchBaseThreat; event watchBaseThreat;
@ -277,7 +278,6 @@ function int numEnemyAAInRange(int _x, int _y, int _range);
function BASEOBJ chooseVtolTarget(bool bExclusiveTarget); function BASEOBJ chooseVtolTarget(bool bExclusiveTarget);
function int getVtolTargetWeight(BASEOBJ _target); function int getVtolTargetWeight(BASEOBJ _target);
function bool vtolTargetAssigned(BASEOBJ _target); function bool vtolTargetAssigned(BASEOBJ _target);
function void buildTruck();
function int numBuildSameBuilding(STRUCTURESTAT _checkStat, int _x, int _y); function int numBuildSameBuilding(STRUCTURESTAT _checkStat, int _x, int _y);
function void expandBase(DROID _truck); function void expandBase(DROID _truck);
function int totalVtols(); function int totalVtols();
@ -382,19 +382,18 @@ event initialisedEvent(CALL_GAMEINIT)
fundamentalBeingBuilt = derrick; // to avoid ever being null fundamentalBeingBuilt = derrick; // to avoid ever being null
bRunning = false;
if(aiResponsibleForPlayer(me)) if(aiResponsibleForPlayer(me))
{ {
bRunning = true; bRunning = true;
} }
else else
{ {
bRunning = false;
shutDownAI(); shutDownAI();
} }
} }
function void buildFundamentals() event buildFundamentals(inactive)
{ {
count = 0; count = 0;
while (count < numFundamental) while (count < numFundamental)
@ -428,18 +427,14 @@ function void buildFundamentals()
count = count + 1; count = count + 1;
} }
fundamentalBeingBuilt = derrick; fundamentalBeingBuilt = derrick;
} setEventTrigger(buildFundamentals, inactive);
event launchFundamentals(inactive)
{
buildFundamentals();
setEventTrigger(launchFundamentals, inactive);
} }
event startLevel(startLevelTr) event startLevel(startLevelTr)
{ {
buildFundamentals(); setEventTrigger(buildFundamentals, chainloadTr);
buildTruck(); setEventTrigger(conDroids, chainloadTr);
setEventTrigger(startLevel, inactive);
} }
// decide what technology branch we will use // decide what technology branch we will use
@ -1386,7 +1381,7 @@ event structBuilt(structBuiltTr)
} }
else else
{ {
buildTruck(); setEventTrigger(conDroids, chainloadTr);
} }
} }
/* vtol factory or vtol factory module */ /* vtol factory or vtol factory module */
@ -1414,7 +1409,7 @@ event structBuilt(structBuiltTr)
// Check if available trucks need to build more absolute necessities right away. We need a trigger here because // Check if available trucks need to build more absolute necessities right away. We need a trigger here because
// droids involved in building have not yet come out of their build orders. // droids involved in building have not yet come out of their build orders.
setEventTrigger(launchFundamentals, launchFundamentalsTr); setEventTrigger(buildFundamentals, chainloadTr);
//see if we have just rebuilt a destroyed structure //see if we have just rebuilt a destroyed structure
_count = 0; _count = 0;
@ -1480,11 +1475,6 @@ event droidDestroyed(droidDestroyedTr)
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
// build more con droids. // build more con droids.
event conDroids(conDroidsTr) event conDroids(conDroidsTr)
{
buildTruck();
}
function void buildTruck()
{ {
local int _maxTrucks; local int _maxTrucks;
local STRUCTURE _factory; local STRUCTURE _factory;
@ -1545,9 +1535,9 @@ function void buildTruck()
_factory = enumStruct(); _factory = enumStruct();
} }
setEventTrigger(conDroids, conDroidsTr);
} }
//Build a droid //Build a droid
function bool buildUnit(TEMPLATE _tankTemplate, STRUCTURE _factory, STRUCTURESTAT _factoryType, bool _bIdleOnly) function bool buildUnit(TEMPLATE _tankTemplate, STRUCTURE _factory, STRUCTURESTAT _factoryType, bool _bIdleOnly)
{ {
@ -4136,8 +4126,8 @@ event consoleEv(consoleTr)
if(not bRunning) //make sure current machine is responsible for this AI and it's not already active if(not bRunning) //make sure current machine is responsible for this AI and it's not already active
{ {
console(getPlayerName(me) & " is active"); console(getPlayerName(me) & " is active");
reassignAI(); reassignAI();
setEventTrigger(startLevel, chainloadTr);
} }
} }
} }

View File

@ -221,9 +221,10 @@ trigger manageAllyHelpTr (every, 80);
trigger everySec (every, 10); trigger everySec (every, 10);
trigger manageDefendLocationTr (every, 70); trigger manageDefendLocationTr (every, 70);
trigger startLevelTr (CALL_START_NEXT_LEVEL); trigger startLevelTr (CALL_START_NEXT_LEVEL);
trigger launchFundamentalsTr (wait, 1); trigger chainloadTr (wait, 1);
/* Events */ /* Events */
event conDroids;
event multiMsgEv; event multiMsgEv;
event beaconEv; event beaconEv;
event watchBaseThreat; event watchBaseThreat;
@ -277,7 +278,6 @@ function int numEnemyAAInRange(int _x, int _y, int _range);
function BASEOBJ chooseVtolTarget(bool bExclusiveTarget); function BASEOBJ chooseVtolTarget(bool bExclusiveTarget);
function int getVtolTargetWeight(BASEOBJ _target); function int getVtolTargetWeight(BASEOBJ _target);
function bool vtolTargetAssigned(BASEOBJ _target); function bool vtolTargetAssigned(BASEOBJ _target);
function void buildTruck();
function int numBuildSameBuilding(STRUCTURESTAT _checkStat, int _x, int _y); function int numBuildSameBuilding(STRUCTURESTAT _checkStat, int _x, int _y);
function void expandBase(DROID _truck); function void expandBase(DROID _truck);
function int totalVtols(); function int totalVtols();
@ -382,19 +382,18 @@ event initialisedEvent(CALL_GAMEINIT)
fundamentalBeingBuilt = derrick; // to avoid ever being null fundamentalBeingBuilt = derrick; // to avoid ever being null
bRunning = false;
if(aiResponsibleForPlayer(me)) if(aiResponsibleForPlayer(me))
{ {
bRunning = true; bRunning = true;
} }
else else
{ {
bRunning = false;
shutDownAI(); shutDownAI();
} }
} }
function void buildFundamentals() event buildFundamentals(inactive)
{ {
count = 0; count = 0;
while (count < numFundamental) while (count < numFundamental)
@ -428,18 +427,14 @@ function void buildFundamentals()
count = count + 1; count = count + 1;
} }
fundamentalBeingBuilt = derrick; fundamentalBeingBuilt = derrick;
} setEventTrigger(buildFundamentals, inactive);
event launchFundamentals(inactive)
{
buildFundamentals();
setEventTrigger(launchFundamentals, inactive);
} }
event startLevel(startLevelTr) event startLevel(startLevelTr)
{ {
buildFundamentals(); setEventTrigger(buildFundamentals, chainloadTr);
buildTruck(); setEventTrigger(conDroids, chainloadTr);
setEventTrigger(startLevel, inactive);
} }
// decide what technology branch we will use // decide what technology branch we will use
@ -1386,7 +1381,7 @@ event structBuilt(structBuiltTr)
} }
else else
{ {
buildTruck(); setEventTrigger(conDroids, chainloadTr);
} }
} }
/* vtol factory or vtol factory module */ /* vtol factory or vtol factory module */
@ -1414,7 +1409,7 @@ event structBuilt(structBuiltTr)
// Check if available trucks need to build more absolute necessities right away. We need a trigger here because // Check if available trucks need to build more absolute necessities right away. We need a trigger here because
// droids involved in building have not yet come out of their build orders. // droids involved in building have not yet come out of their build orders.
setEventTrigger(launchFundamentals, launchFundamentalsTr); setEventTrigger(buildFundamentals, chainloadTr);
//see if we have just rebuilt a destroyed structure //see if we have just rebuilt a destroyed structure
_count = 0; _count = 0;
@ -1480,11 +1475,6 @@ event droidDestroyed(droidDestroyedTr)
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
// build more con droids. // build more con droids.
event conDroids(conDroidsTr) event conDroids(conDroidsTr)
{
buildTruck();
}
function void buildTruck()
{ {
local int _maxTrucks; local int _maxTrucks;
local STRUCTURE _factory; local STRUCTURE _factory;
@ -1545,9 +1535,9 @@ function void buildTruck()
_factory = enumStruct(); _factory = enumStruct();
} }
setEventTrigger(conDroids, conDroidsTr);
} }
//Build a droid //Build a droid
function bool buildUnit(TEMPLATE _tankTemplate, STRUCTURE _factory, STRUCTURESTAT _factoryType, bool _bIdleOnly) function bool buildUnit(TEMPLATE _tankTemplate, STRUCTURE _factory, STRUCTURESTAT _factoryType, bool _bIdleOnly)
{ {
@ -4136,8 +4126,8 @@ event consoleEv(consoleTr)
if(not bRunning) //make sure current machine is responsible for this AI and it's not already active if(not bRunning) //make sure current machine is responsible for this AI and it's not already active
{ {
console(getPlayerName(me) & " is active"); console(getPlayerName(me) & " is active");
reassignAI(); reassignAI();
setEventTrigger(startLevel, chainloadTr);
} }
} }
} }