warzone2100/data/script/text/cam1a-c.slo

995 lines
29 KiB
Plaintext
Raw Normal View History

// cam1A-C script
/* General Values */
public int player;
public int enemy1;
public int enemy2;
public int pow1, pow2;
private int numart;
/* structure limit stuff */
public STRUCTURESTAT factory, research, oilDerrick, powerGen;
//public STRUCTURESTAT powerModuleHack;
public STRUCTURESTAT command, comRelay;
public INT numPow, numExt, numFac, numRes;
/* Briefing stuff */
public INTMESSAGE MissionBrief, MissionBrief2;
public INTMESSAGE endMsg; //, winMsg;
public TEMPLATE transporter; //required for enemy transports landing
private DROID transportDroid, loadDroid;
private BOOL transOnMap;
/* Win or lose */
public SOUND lostSnd;
public LEVEL NextLev;
public INT timeLimit;
//public INTMESSAGE obj1;
/* Base Under Attack Stuff */
private STRUCTURE hitStruc;
private BASEOBJ attackerObj;
private int t;
public SOUND attackSnd1;
/* player Bonus Research topics given at end of mission */
public int numResP0;
public RESEARCHSTAT resP0[20]; //need to be declared with value >= numResP0, numResP1, etc.
private INT count;
/* Reinforcement Lists for New Paradigm */
public INT numLZ;
public INT enemyLZX[5], enemyLZY[5];
public INTMESSAGE enemyLZM[5];
public SOUND warnSnd;
private INT reinforceType, reinforceCount, sortieTot, sortieCount, temp1, LZ, LZMess, numTries;
private TEMPLATE reinforceTemplate;
private GROUP transTemp, NPgroup[15]; //needs to be (numLZ * numTargets) for array
private DROID newDroid;
/* ground troops reinforcement lists */
public INT numReinf, reinfNum[3], n1, n2, m1, m2;
public TEMPLATE reinfTemp[3];
public INT reinfPosX1, reinfPosY1, reinfPosX2, reinfPosY2;
private GROUP reinfGroup[2];
//templates
/* Enemy Tactics */
public TEMPLATE template2[13], template3[3];
/* Map Targets/Waypoints for New Paradigm */
public INT numTargets, targetX[15], targetY[15]; //need (numLZ * numTargets) for array
private INT n, targetXoff[15], targetYoff[15]; //for checking near target
private INT targetChoice, targetType, temp;
/* Starting Technology */
public int numtecE2;
public RESEARCHSTAT tecE2[20];
/* Triggers: Win or Lose */
trigger winLoseTrig(every, 5);
trigger winLoseTrig2((numStructsInArea(player, 7360, 5696, 10688, 8640) >= 3), 10);
trigger gameLostTrig(every, 20);
/* Reinforcement triggers */
trigger NPTransTrig(every, 100); //every 10 secs
trigger NPTransTrig2(every, 20); //every 2 seconds for retries
trigger NPTransTrig3(every, 450); //every 45 secs
//trigger obj1Trig(structInArea(player, 7360, 5696, 10688, 8640), 20);
trigger checkSector1Trig((numObjectsInArea(player, enemyLZX[0] - 1280, enemyLZY[0] - 1280, enemyLZX[0] + 1280, enemyLZY[0] + 1280) > 0), 300);
trigger checkSector2Trig((numObjectsInArea(player, enemyLZX[1] - 1280, enemyLZY[1] - 1280, enemyLZX[1] + 1280, enemyLZY[1] + 1280) > 0), 300);
trigger checkSector3Trig((numObjectsInArea(player, enemyLZX[2] - 1280, enemyLZY[2] - 1280, enemyLZX[2] + 1280, enemyLZY[2] + 1280) > 0), 300);
trigger checkSector4Trig((numObjectsInArea(player, enemyLZX[3] - 1280, enemyLZY[3] - 1280, enemyLZX[3] + 1280, enemyLZY[3] + 1280) > 0), 300);
trigger checkSector5Trig((numObjectsInArea(player, enemyLZX[4] - 1280, enemyLZY[4] - 1280, enemyLZX[4] + 1280, enemyLZY[4] + 1280) > 0), 300);
trigger clearedSector1Trig((numObjectsInArea(player, enemyLZX[0] - 1280, enemyLZY[0] - 1280, enemyLZX[0] + 1280, enemyLZY[0] + 1280) == 0), 100);
trigger clearedSector2Trig((numObjectsInArea(player, enemyLZX[1] - 1280, enemyLZY[1] - 1280, enemyLZX[1] + 1280, enemyLZY[1] + 1280) == 0), 100);
trigger clearedSector3Trig((numObjectsInArea(player, enemyLZX[2] - 1280, enemyLZY[2] - 1280, enemyLZX[2] + 1280, enemyLZY[2] + 1280) == 0), 100);
trigger clearedSector4Trig((numObjectsInArea(player, enemyLZX[3] - 1280, enemyLZY[3] - 1280, enemyLZX[3] + 1280, enemyLZY[3] + 1280) == 0), 100);
trigger clearedSector5Trig((numObjectsInArea(player, enemyLZX[4] - 1280, enemyLZY[4] - 1280, enemyLZX[4] + 1280, enemyLZY[4] + 1280) == 0), 100);
trigger reinfSector1Trig(((numObjectsInArea(player, reinfPosX1 - 64, reinfPosY1 - 64, reinfPosX1 + 64, reinfPosY1 + 64) == 0) and (numObjectsInArea(enemy2, reinfPosX1 - 64, reinfPosY1 - 64, reinfPosX1 + 64, reinfPosY1 + 64) == 0)), 30);
trigger reinfSector2Trig(((numObjectsInArea(player, reinfPosX2 - 64, reinfPosY2 - 64, reinfPosX2 + 64, reinfPosY2 + 64) == 0) and (numObjectsInArea(enemy2, reinfPosX2 - 64, reinfPosY2 - 64, reinfPosX2 + 64, reinfPosY2 + 64) == 0)), 30);
//trigger reinfSector1Trig(every, 30);
//trigger reinfSector2Trig(every, 30);
trigger sortieDelayTrig(wait, 600); //wait 60 seconds before testing
trigger nextSortieTrig(every, 100); //check every 10 seconds
event wonYetEvnt;
event checkSector1;
event clearedSector1;
event checkSector2;
event clearedSector2;
event checkSector3;
event clearedSector3;
event checkSector4;
event clearedSector4;
event checkSector5;
event clearedSector5;
event reinfSector1;
event reinfSector2;
event sortieDelay;
event timeUp;
event start2Evnt(CALL_VIDEO_QUIT)
{
//remove first part of two part message, and play second part
removeMessage(MissionBrief, MISS_MSG, 0);
setEventTrigger(start2Evnt, inactive);
//test how close to edge can go!
//addDroid(scorpRkt, reinfPosX2, reinfPosY2, enemy2);
addMessage(MissionBrief2, MISS_MSG, 0, true);
}
event startEvnt(CALL_GAMEINIT)
{
//set scroll limits
centreViewPos(11*128, 52*128);
// setScrollParams(0, 0, 128, 128); //limit scroll
//set zoom Level 128x128
setRadarZoom(0);
//stop player building on LZ
setLandingZone(10, 51, 12, 53);
addMessage(MissionBrief, MISS_MSG, 0, true);
//createAlliance(enemy1, enemy2);
setPowerLevel(pow1, enemy1);
setPowerLevel(pow2, enemy2);
setEventTrigger(startEvnt, inactive);
//Blip Given at start
//addMessage(obj1, PROX_MSG, player, false);
//allow to build stuff
setStructureLimits (powerGen,numPow,0);
setStructureLimits (oilDerrick,numExt,0);
setStructureLimits (research,numRes,0);
setStructureLimits (factory,numFac,0);
setStructureLimits(command, 1, player);
setStructureLimits(comRelay, 1, player);
enableStructure(command, player);
enableStructure(powerGen,0);
enableStructure(oilDerrick,0);
enableStructure(research,0);
enableStructure(factory,0);
//enableStructure(powerModuleHack, 0);
//set no time limits (can carry over from previous missions if not set!)
setReinforcementTime(-1);
setMissionTime(timeLimit); //set Mission time limit
// player specific technology startups
count = 0;
while (count < numtecE2)
{
completeResearch(tecE2[count], enemy2);
count = count +1;
}
LZMess = numLZ+1; //force to recalc
randomiseSeed();
/*
//also don't allow building on 1CA's enemy LZs!
count = 0;
while (count < numLZ)
{
setNoGoArea((enemyLZX[count]/128) - 1, (enemyLZY[count]/128) - 1, (enemyLZX[count]/128) + 1, (enemyLZY[count]/128) + 1, count + 2); //count+2 so doesn't set NP's LZ (since changes later!)
count = count + 1;
}
*/
//add enemy transport (once!)
setNoGoArea((enemyLZX[0] / 128) - 1, (enemyLZY[0] / 128) - 1, (enemyLZX[0] / 128) + 1, (enemyLZY[0] / 128) + 1, enemy2);
transportDroid = addDroidToMissionList(transporter, enemy2);
}
/* Events: Win or Lose */
event nextLevEvnt(inactive) //assumes victory already checked
{
pause(20); //increased to allow all audio before won
// give bonus research (if req'd)
count = 0;
while (count < numResP0)
{
enableResearch(resP0[count], 0);
count = count +1;
}
gameLevel=gameLevel+1; //flag next part of map
//removeMessage(MissionBrief2, MISS_MSG, player);
startMission(BETWEEN, NextLev); //SUB1-4A next so BETWEEN rather than OFF_KEEP
//End game here for now! (don't try next mission)
//gameOver(true);
setEventTrigger(nextLevEvnt, inactive);
}
event gameLost(inactive)
{
// addMessage(endMsg, MISS_MSG, 0, true);
// pause(10);
// gameOver(false);
gameOverMessage(endMsg, MISS_MSG, 0, false);
setEventTrigger(gameLost, inactive);
}
event lostYetEvnt(winLoseTrig)
{
if (not anyDroidsLeft(player))
{
if (not anyStructButWallsLeft(player))
{
setEventTrigger(wonYetEvnt,inactive);
setEventTrigger(gameLost, gameLostTrig); //waits 2 seconds before ending
setEventTrigger(lostYetEvnt, inactive);
setEventTrigger(timeUp, inactive);
}
}
}
event wonYetEvnt(inactive) // have all enemies lost yet?
{
if (not anyDroidsLeft(enemy2))
{
if (not anyStructButWallsLeft(enemy2))
{
setEventTrigger(lostYetEvnt, inactive);
setEventTrigger(nextLevEvnt, winLoseTrig);
setEventTrigger(wonYetEvnt, inactive);
setEventTrigger(timeUp, inactive);
}
}
}
event cheatEvnt(CALL_MISSION_START) //cheat button ctrl M
{
setEventTrigger(nextLevEvnt, winLoseTrig);
setEventTrigger(cheatEvnt, inactive);
}
/* Base Under Attack */
event baseHit(CALL_STRUCT_ATTACKED, selectedPlayer, ref hitStruc, ref attackerObj)
{
if (t >= 20)
{
t=0;
if (hitStruc != NULLOBJECT)
{
playSoundPos(attackSnd1, selectedPlayer, hitStruc.x, hitStruc.y, hitStruc.z); //show position if still alive
}
else
{
playSound(attackSnd1, selectedPlayer);
}
}
}
event everySec(every, 10)
{
t=t+1;
}
event seeBaseHit(CALL_MISSION_END)
{
//go to where the structure being attacked is on CTRL B
if (hitStruc!=NULLOBJECT)
{
centreView(hitStruc);
t=0; //flag known about!
}
}
/*
event removeObj1(winLoseTrig2)
{
//remove if forward base established
removeMessage(obj1, PROX_MSG, player);
setEventTrigger(removeObj1, inactive);
}
*/
/* make NP Transport "land" */
event NPTransEvnt(NPTransTrig)
{
//check we have a transporter to load!
if (transportDroid != NULLOBJECT)
{
if (not transOnMap) //make sure transporter not still on map!
{
if (LZ < numLZ)
{
//check no player droids or structures near NP LZ, before landing
if ((not droidInArea(player, enemyLZX[LZ] - 512, enemyLZY[LZ] - 512, enemyLZX[LZ] + 512, enemyLZY[LZ] + 512)) and (not structInArea(player, enemyLZX[LZ] - 512, enemyLZY[LZ] - 512, enemyLZX[LZ] + 512, enemyLZY[LZ] + 512))
and (not droidInArea(enemy2, enemyLZX[LZ] - 200, enemyLZY[LZ] - 200, enemyLZX[LZ] + 200, enemyLZY[LZ] + 200)))
{
if (LZMess < numLZ)
{
//remove last warning (if any!)
removeMessage(enemyLZM[LZMess], PROX_MSG, player);
}
//numTries = 0; //reset number of tries
//warn player!!
addMessage(enemyLZM[LZ], PROX_MSG, player, false);
LZMess = LZ; //store so can remove later
//set landing zone first
setNoGoArea((enemyLZX[LZ] / 128) - 1, (enemyLZY[LZ] / 128) - 1, (enemyLZX[LZ] / 128) + 1, (enemyLZY[LZ] / 128) + 1, enemy2);
//place paratroops
//addDroid(template3[0], enemyLZX[LZ] - 128, enemyLZY[LZ] - 128, enemy2);
//addDroid(template3[0], enemyLZX[LZ], enemyLZY[LZ] - 128, enemy2);
//addDroid(template3[1], enemyLZX[LZ] + 128, enemyLZY[LZ] - 128, enemy2);
//addDroid(template3[1], enemyLZX[LZ] + 128, enemyLZY[LZ], enemy2);
//addDroid(template3[2], enemyLZX[LZ] - 128, enemyLZY[LZ] + 128, enemy2);
//addDroid(template3[2], enemyLZX[LZ], enemyLZY[LZ] + 128, enemy2);
loadDroid = addDroidToMissionList(template3[0], enemy2);
if (loadDroid != NULLOBJECT)
{
numTries = 0; //reset number of tries
addDroidToTransporter(transportDroid, loadDroid);
transOnMap = TRUE;
}
else
{
numTries = numTries + 10; //let code know can't land
}
loadDroid = addDroidToMissionList(template3[0], enemy2);
if (loadDroid != NULLOBJECT)
{
addDroidToTransporter(transportDroid, loadDroid);
}
loadDroid = addDroidToMissionList(template3[1], enemy2);
if (loadDroid != NULLOBJECT)
{
addDroidToTransporter(transportDroid, loadDroid);
}
loadDroid = addDroidToMissionList(template3[1], enemy2);
if (loadDroid != NULLOBJECT)
{
addDroidToTransporter(transportDroid, loadDroid);
}
loadDroid = addDroidToMissionList(template3[2], enemy2);
if (loadDroid != NULLOBJECT)
{
addDroidToTransporter(transportDroid, loadDroid);
}
loadDroid = addDroidToMissionList(template3[2], enemy2);
if (loadDroid != NULLOBJECT)
{
addDroidToTransporter(transportDroid, loadDroid);
}
//call in transport, using random-ish positions
setTransporterExit(enemy2, 126, 50 + random(32));
flyTransporterIn(enemy2, 126, 50 + random(32), false);
//transOnMap = TRUE;
//not sure about this, but moved proper check to groupTrans event
if (targetChoice < 3) //check for next LZ
{
//can only set new trigger once, so hopefully this won't override longer delay set earlier!
setEventTrigger(NPTransEvnt, NPTransTrig3);
}
}
else
{
//try again soon
setEventTrigger(NPTransEvnt, NPTransTrig2);
numTries = numTries + 1;
}
if (numTries > 5) //try 5 times before moving on to next LZ!
{
numTries = 0;
LZ = LZ +1;
//setEventTrigger(NPTransEvnt, inactive);
}
}
else
{
removeMessage(enemyLZM[LZMess], PROX_MSG, player); //remove last LZ message
setEventTrigger(NPTransEvnt, inactive); //don't allow any more!
setEventTrigger(wonYetEvnt, winLoseTrig); //allow victory conditions
}
}
}
else
{
//if haven't managed to get a transporter - this allows the player to win
setEventTrigger(wonYetEvnt, winLoseTrig); //allow victory conditions
}
}
event groupTrans(CALL_TRANSPORTER_LANDED, NPgroup[(LZ * numTargets) + targetChoice], enemy2)
{
//playSound(warnSnd, player);
playSoundPos(warnSnd, player, enemyLZX[LZMess] * 128, enemyLZY[LZMess] * 128, 0);
pause(10);
//now get going!
//groupAddArea(NPgroup[(LZ * numTargets) + targetChoice], enemy2, enemyLZX[LZ] - 128, enemyLZY[LZ] - 128, enemyLZX[LZ] + 256, enemyLZY[LZ] + 256);
//keep track of total in this sortie
sortieTot = sortieTot + NPgroup[(LZ * numTargets) + targetChoice].members;
orderGroupLoc(NPgroup[(LZ * numTargets) + targetChoice], DORDER_SCOUT, targetX[(LZ * numTargets) + targetChoice], targetY[(LZ * numTargets) + targetChoice]);
targetChoice = targetChoice + 1;
if (targetChoice >= 3) //check for next LZ
{
LZ = LZ + 1;
targetChoice = 0;
//longer delay before next attack
//playSound(wonSnd,0);
setEventTrigger(NPTransEvnt, inactive);
setEventTrigger(sortieDelay, sortieDelayTrig);
}
else
{
//can only set new trigger once, so hopefully this won't override longer delay set earlier!
setEventTrigger(NPTransEvnt, NPTransTrig3);
}
//do checks here so can trigger forces from edge of map...
if (LZ == 1)
{
setEventTrigger(checkSector1, checkSector1Trig);
setEventTrigger(clearedSector1, clearedSector1Trig);
setEventTrigger(reinfSector1, reinfSector1Trig);
}
if (LZ == 2)
{
setEventTrigger(checkSector2, checkSector2Trig);
setEventTrigger(clearedSector2, clearedSector2Trig);
setEventTrigger(reinfSector2, reinfSector2Trig);
}
if (LZ == 3)
{
setEventTrigger(checkSector3, checkSector3Trig);
setEventTrigger(clearedSector3, clearedSector3Trig);
//setEventTrigger(reinfSector3, reinfSector3Trig);
}
if (LZ == 4)
{
setEventTrigger(checkSector4, checkSector4Trig);
setEventTrigger(clearedSector4, clearedSector4Trig);
//setEventTrigger(reinfSector4, reinfSector4Trig);
}
if (LZ >= 5)
{
setEventTrigger(checkSector5, checkSector5Trig);
setEventTrigger(clearedSector5, clearedSector5Trig);
//setEventTrigger(reinfSector5, reinfSector5Trig);
}
}
event nextSortie(inactive)
{
//check status of current sortie
temp1 = (NPgroup[LZ - 1].members + NPgroup[LZ].members + NPgroup[LZ + 1].members);
sortieCount = sortieCount + 1; //keep track of number of tries
if (sortieCount > 12) //wait another 2 minutes before forcing the next one
{
temp1 = 0; //force new sortie if waited too long!
}
if (temp1 <= sortieTot / 2)
{
sortieTot = 0;
setEventTrigger(NPTransEvnt, NPTransTrig);
setEventTrigger(nextSortie, inactive);
}
}
event sortieDelay(inactive)
{
//now set up check for sortie health level
setEventTrigger(nextSortie, nextSortieTrig);
setEventTrigger(sortieDelay, inactive);
}
/*
event moveTrans(inactive)
{
//have Scouts got close to target?
groupAddArea(transTemp, enemy2, targetX[targetChoice] - 512, targetY[targetChoice] - 512, targetX[targetChoice] + 512, targetY[targetChoice] + 512);
if (transTemp.members > 0)
{
targetChoice = targetChoice + numTargets; //go from near to mid to far
if (targetChoice >= numTargets * 3)
{
//choose new target randomly
targetChoice=random(numTargets);
}
groupAddGroup(transScout, transTemp);
//get going to next one!!
orderGroupLoc(transScout, DORDER_SCOUT, targetX[targetChoice], targetY[targetChoice]);
}
//have Heavies got close to target?
groupAddArea(transTemp, enemy2, targetX[targetChoice] - 512, targetY[targetChoice] - 512, targetX[targetChoice] + 512, targetY[targetChoice] + 512);
if (transTemp.members > 0)
{
targetChoice = targetChoice + numTargets; //go from near to mid to far
if (targetChoice >= numTargets * 3)
{
//choose new target randomly
targetChoice=random(numTargets);
}
groupAddGroup(transHeavy, transTemp);
//get going to next one!!
orderGroupLoc(transHeavy, DORDER_SCOUT, targetX[targetChoice], targetY[targetChoice]);
}
}
*/
event clearedSector1(inactive)
{
//playSound(wonSnd,0);
//choose a new sector now this one clear!
n = 0;
while (n < 3)
{
//do random walk type thing
enemyLZX[0] = enemyLZX[0] + random(128 * 20) - (128 * 10);
enemyLZY[0] = enemyLZY[0] + random(128 * 30) - (128 * 20);
if (enemyLZX[0] < 1000)
{
enemyLZX[0] = random(128 * 20) + 1000;
}
if (enemyLZX[0] > 16000)
{
enemyLZX[0] = 16000 - random(128 * 20);
}
if (enemyLZY[0] < 1000)
{
enemyLZY[0] = random(128 * 20) + 1000;
}
if (enemyLZY[0] > 16000)
{
enemyLZY[0] = 16000 - random(128 * 20);
}
orderGroupLoc(NPgroup[n], DORDER_SCOUT, enemyLZX[0], enemyLZY[0]);
targetX[n] = enemyLZX[0];
targetY[n] = enemyLZY[0];
n = n + 1;
}
}
event checkSector1(inactive)
{
n = 0;
orderGroupLoc(reinfGroup[0], DORDER_SCOUT, targetX[n], targetY[n]);
while (n < 3)
{
//check if group got near to destination
/* bad way of doing this
groupAddArea(transTemp, enemy2, targetX[n] - 512, targetY[n] - 512, targetX[n] + 512, targetY[n] + 512);
if (transTemp.members > 0)
{
//give group new destination within 10 tiles of main
groupAddGroup(NPgroup[n], transTemp);
*/
if (idleGroup(NPgroup[n]) >= (NPgroup[n].members / 2))
{
targetX[n] = enemyLZX[0] + random(128 * 20) - (128 * 10);
targetY[n] = enemyLZY[0] + random(128 * 20) - (128 * 10);
if (enemyLZX[0] + targetX[n] < 1000)
{
targetX[n] = enemyLZX[0] + 1000;
}
if (enemyLZX[0] + targetX[n] > 16000)
{
targetX[n] = 16000 - enemyLZX[0];
}
if (enemyLZY[0] + targetY[n] < 1000)
{
targetY[n] = enemyLZY[0] + 1000;
}
if (enemyLZY[0] + targetY[n] > 16000)
{
targetY[n] = 16000 - enemyLZY[0];
}
orderGroupLoc(NPgroup[n], DORDER_SCOUT, targetX[n], targetY[n]);
}
n = n + 1;
}
}
event clearedSector2(inactive)
{
//playSound(wonSnd,0);
//choose a new sector now this one clear!
n = 3;
while (n < 6)
{
//do random walk type thing
enemyLZX[1] = enemyLZX[1] + random(128 * 30) - (128 * 20);
enemyLZY[1] = enemyLZY[1] + random(128 * 30) - (128 * 15);
if (enemyLZX[1] < 1000)
{
enemyLZX[1] = random(128 * 20) + 1000;
}
if (enemyLZX[1] > 16000)
{
enemyLZX[1] = 16000 - random(128 * 20);
}
if (enemyLZY[1] < 1000)
{
enemyLZY[1] = random(128 * 20) + 1000;
}
if (enemyLZY[1] > 16000)
{
enemyLZY[1] = 16000 - random(128 * 20);
}
orderGroupLoc(NPgroup[n], DORDER_SCOUT, enemyLZX[1], enemyLZY[1]);
targetX[n] = enemyLZX[1];
targetY[n] = enemyLZY[1];
n = n + 1;
}
}
event checkSector2(inactive)
{
n = 3;
orderGroupLoc(reinfGroup[1], DORDER_SCOUT, targetX[n], targetY[n]);
while (n < 6)
{
//check if group got near to destination
/* bad way of doing this
groupAddArea(transTemp, enemy2, targetX[n] - 512, targetY[n] - 512, targetX[n] + 512, targetY[n] + 512);
if (transTemp.members > 0)
{
//give group new destination within 10 tiles of main
groupAddGroup(NPgroup[n], transTemp);
*/
if (idleGroup(NPgroup[n]) >= (NPgroup[n].members / 2))
{
targetX[n] = enemyLZX[1] + random(128 * 20) - (128 * 10);
targetY[n] = enemyLZY[1] + random(128 * 20) - (128 * 10);
if (enemyLZX[1] + targetX[n] < 1000)
{
targetX[n] = enemyLZX[1] + 1000;
}
if (enemyLZX[1] + targetX[n] > 16000)
{
targetX[n] = 16000 - enemyLZX[1];
}
if (enemyLZY[1] + targetY[n] < 1000)
{
targetY[n] = enemyLZY[1] + 1000;
}
if (enemyLZY[1] + targetY[n] > 16000)
{
targetY[n] = 16000 - enemyLZY[1];
}
orderGroupLoc(NPgroup[n], DORDER_SCOUT, targetX[n], targetY[n]);
}
n = n + 1;
}
}
event clearedSector3(inactive)
{
//playSound(wonSnd,0);
//choose a new sector now this one clear!
n = 6;
while (n < 9)
{
//do random walk type thing
enemyLZX[2] = enemyLZX[2] + random(128 * 30) - (128 * 15);
enemyLZY[2] = enemyLZY[2] + random(128 * 30) - (128 * 15);
if (enemyLZX[2] < 1000)
{
enemyLZX[2] = random(128 * 20) + 1000;
}
if (enemyLZX[2] > 16000)
{
enemyLZX[2] = 16000 - random(128 * 20);
}
if (enemyLZY[2] < 1000)
{
enemyLZY[2] = random(128 * 20) + 1000;
}
if (enemyLZY[2] > 16000)
{
enemyLZY[2] = 16000 - random(128 * 20);
}
orderGroupLoc(NPgroup[n], DORDER_SCOUT, enemyLZX[2], enemyLZY[2]);
targetX[n] = enemyLZX[2];
targetY[n] = enemyLZY[2];
n = n + 1;
}
}
event checkSector3(inactive)
{
n = 6;
//orderGroupLoc(reinfGroup[0], DORDER_SCOUT, targetX[n], targetY[n]);
while (n < 9)
{
//check if group got near to destination
/* bad way of doing this
groupAddArea(transTemp, enemy2, targetX[n] - 512, targetY[n] - 512, targetX[n] + 512, targetY[n] + 512);
if (transTemp.members > 0)
{
//give group new destination within 10 tiles of main
groupAddGroup(NPgroup[n], transTemp);
*/
if (idleGroup(NPgroup[n]) >= (NPgroup[n].members / 2))
{
targetX[n] = enemyLZX[2] + random(128 * 20) - (128 * 10);
targetY[n] = enemyLZY[2] + random(128 * 20) - (128 * 10);
if (enemyLZX[2] + targetX[n] < 1000)
{
targetX[n] = enemyLZX[2] + 1000;
}
if (enemyLZX[2] + targetX[n] > 16000)
{
targetX[n] = 16000 - enemyLZX[2];
}
if (enemyLZY[2] + targetY[n] < 1000)
{
targetY[n] = enemyLZY[2] + 1000;
}
if (enemyLZY[2] + targetY[n] > 16000)
{
targetY[n] = 16000 - enemyLZY[2];
}
orderGroupLoc(NPgroup[n], DORDER_SCOUT, targetX[n], targetY[n]);
}
n = n + 1;
}
}
event clearedSector4(inactive)
{
//playSound(wonSnd,0);
//choose a new sector now this one clear!
n = 9;
while (n < 12)
{
//do random walk type thing
enemyLZX[3] = enemyLZX[3] + random(128 * 10) - (128 * 5);
enemyLZY[3] = enemyLZY[3] + random(128 * 30) - (128 * 15); //bias South
if (enemyLZX[3] < 1000)
{
enemyLZX[3] = random(128 * 20) + 1000;
}
if (enemyLZX[3] > 16000)
{
enemyLZX[3] = 16000 - random(128 * 20);
}
if (enemyLZY[3] < 1000)
{
enemyLZY[3] = random(128 * 20) + 1000;
}
if (enemyLZY[3] > 16000)
{
enemyLZY[3] = 16000 - random(128 * 20);
}
orderGroupLoc(NPgroup[n], DORDER_SCOUT, enemyLZX[3], enemyLZY[3]);
targetX[n] = enemyLZX[3];
targetY[n] = enemyLZY[3];
n = n + 1;
}
}
event checkSector4(inactive)
{
n = 9;
//orderGroupLoc(reinfGroup[0], DORDER_SCOUT, targetX[n], targetY[n]);
while (n < 12)
{
//check if group got near to destination
/* bad way of doing this
groupAddArea(transTemp, enemy2, targetX[n] - 512, targetY[n] - 512, targetX[n] + 512, targetY[n] + 512);
if (transTemp.members > 0)
{
//give group new destination within 10 tiles of main
groupAddGroup(NPgroup[n], transTemp);
*/
if (idleGroup(NPgroup[n]) >= (NPgroup[n].members / 2))
{
targetX[n] = enemyLZX[3] + random(128 * 20) - (128 * 10);
targetY[n] = enemyLZY[3] + random(128 * 20) - (128 * 10);
if (enemyLZX[3] + targetX[n] < 1000)
{
targetX[n] = enemyLZX[3] + 1000;
}
if (enemyLZX[3] + targetX[n] > 16000)
{
targetX[n] = 16000 - enemyLZX[3];
}
if (enemyLZY[3] + targetY[n] < 1000)
{
targetY[n] = enemyLZY[3] + 1000;
}
if (enemyLZY[3] + targetY[n] > 16000)
{
targetY[n] = 16000 - enemyLZY[3];
}
orderGroupLoc(NPgroup[n], DORDER_SCOUT, targetX[n], targetY[n]);
}
n = n + 1;
}
}
event clearedSector5(inactive)
{
//playSound(wonSnd,0);
//choose a new sector now this one clear!
n = 12;
while (n < 15)
{
//do random walk type thing
enemyLZX[4] = enemyLZX[4] + random(128 * 20) - (128 * 20);
enemyLZY[4] = enemyLZY[4] + random(128 * 30) - (128 * 12);
if (enemyLZX[4] < 1000)
{
enemyLZX[4] = random(128 * 20) + 1000;
}
if (enemyLZX[4] > 16000)
{
enemyLZX[4] = 16000 - random(128 * 20);
}
if (enemyLZY[4] < 1000)
{
enemyLZY[4] = random(128 * 20) + 1000;
}
if (enemyLZY[4] > 16000)
{
enemyLZY[4] = 16000 - random(128 * 20);
}
orderGroupLoc(NPgroup[n], DORDER_SCOUT, enemyLZX[4], enemyLZY[4]);
targetX[n] = enemyLZX[4];
targetY[n] = enemyLZY[4];
n = n + 1;
}
}
event checkSector5(inactive)
{
n = 12;
//orderGroupLoc(reinfGroup[0], DORDER_SCOUT, targetX[n], targetY[n]);
while (n < 15)
{
//check if group got near to destination
/* Bad way of doing this
groupAddArea(transTemp, enemy2, targetX[n] - 512, targetY[n] - 512, targetX[n] + 512, targetY[n] + 512);
if (transTemp.members > 0)
{
//give group new destination within 10 tiles of main
groupAddGroup(NPgroup[n], transTemp);
*/
if (idleGroup(NPgroup[n]) >= (NPgroup[n].members / 2))
{
targetX[n] = enemyLZX[4] + random(128 * 20) - (128 * 10);
targetY[n] = enemyLZY[4] + random(128 * 20) - (128 * 10);
if (enemyLZX[4] + targetX[n] < 1000)
{
targetX[n] = enemyLZX[4] + 1000;
}
if (enemyLZX[4] + targetX[n] > 16000)
{
targetX[n] = 16000 - enemyLZX[4];
}
if (enemyLZY[4] + targetY[n] < 1000)
{
targetY[n] = enemyLZY[4] + 1000;
}
if (enemyLZY[4] + targetY[n] > 16000)
{
targetY[n] = 16000 - enemyLZY[4];
}
orderGroupLoc(NPgroup[n], DORDER_SCOUT, targetX[n], targetY[n]);
}
n = n + 1;
}
}
//keep reinforcements moving
event reinfMove(every, 55)
{
if ((reinfGroup[0].members > 0) and (idleGroup(reinfGroup[0]) >= reinfGroup[0].members /2))
{
temp = random(numTargets);
orderGroupLoc(reinfGroup[0], DORDER_SCOUT, targetX[temp], targetY[temp]);
}
if ((reinfGroup[1].members > 0) and (idleGroup(reinfGroup[1]) >= reinfGroup[1].members /2))
{
temp = 14; //random(numTargets);
orderGroupLoc(reinfGroup[1], DORDER_SCOUT, targetX[temp], targetY[temp]);
}
}
event reinfSector1(inactive)
{
if (n1 < numReinf)
{
if (m1 < reinfNum[n1])
{
/* Bad way of doing this!
addDroid(reinfTemp[n1], reinfPosX1, reinfPosY1, enemy2);
groupAddArea(reinfGroup[0], enemy2, reinfPosX1 - 64, reinfPosY1 - 64, reinfPosX1 + 64, reinfPosY1 + 64);
orderGroupLoc(reinfGroup[0], DORDER_SCOUT, targetX[0], targetY[0]);
*/
newDroid = addDroid(reinfTemp[n1], reinfPosX1, reinfPosY1, enemy2);
if (newDroid != NULLOBJECT)
{
orderDroidLoc(newDroid, DORDER_SCOUT, targetX[14], targetY[14]);
groupAddDroid(reinfGroup[0], newDroid);
}
//increment count even if we don't get a droid otherwise we'll sit in an infinite loop!
m1 = m1 + 1; //keep track of number required for this template
}
else
{
m1 = 0;
n1 = n1 + 1; //update template for next pass
}
}
else
{
setEventTrigger(reinfSector1, inactive);
}
}
event reinfSector2(inactive)
{
//playSound(wonSnd,0);
if (n2 < numReinf)
{
if (m2 < reinfNum[n2])
{
/* Bad way of doing this!
addDroid(reinfTemp[n2], reinfPosX2, reinfPosY2, enemy2);
groupAddArea(reinfGroup[1], enemy2, reinfPosX2 - 64, reinfPosY2 - 64, reinfPosX2 + 64, reinfPosY2 + 64);
orderGroupLoc(reinfGroup[1], DORDER_SCOUT, targetX[4], targetY[4]);
*/
newDroid = addDroid(reinfTemp[n2], reinfPosX2, reinfPosY2, enemy2);
if (newDroid != NULLOBJECT)
{
orderDroidLoc(newDroid, DORDER_SCOUT, targetX[14], targetY[14]);
groupAddDroid(reinfGroup[1], newDroid);
}
//increment count even if we don't get a droid otherwise we'll sit in an infinite loop!
m2 = m2 + 1; //keep track of number required for this template
}
else
{
m2 = 0;
n2 = n2 + 1; //update template for next pass
}
}
else
{
setEventTrigger(reinfSector2, inactive);
}
}
event transOff(CALL_TRANSPORTER_OFFMAP, enemy2)
{
transOnMap = FALSE;
}
event timeUp(CALL_MISSION_TIME)
{
setEventTrigger(wonYetEvnt,inactive);
setEventTrigger(lostYetEvnt,inactive);
setEventTrigger(gameLost, gameLostTrig);
setEventTrigger(timeUp, inactive);
}