warzone2100/data/script/text/cam1-7.slo

975 lines
26 KiB
Plaintext
Raw Normal View History

// SCRIPT file for Cam 1-7
/* General Values */
public int player;
public int enemy1, enemy2;
public int pow1, pow2;
private int numart; //blipFlag;
private STRUCTURE newDroidFactory;
/* structure limit stuff */
public STRUCTURESTAT factory, research, oilDerrick, powerGen;
//public STRUCTURESTAT powerModuleHack;
public STRUCTURESTAT command, comRelay;
public INT numPow, numExt, numFac, numRes;
/* Win or lose */
public SOUND lostSnd;
public LEVEL NextLev;
//public TEMPLATE transporter;
private int totDroids;
/* Base Under Attack Stuff */
private STRUCTURE hitStruc;
private BASEOBJ attackerObj;
private int t;
public SOUND attackSnd1;
/* Transport Entry/Exit coords */
public int entryX, entryY, exitX, exitY;
public TEMPLATE transporter; //required for enemy transports landing
public SOUND warnSnd;
public TEXTSTRING badMsg;
private DROID transportDroid, loadDroid;
private TEMPLATE reinforceTemplate;
private BOOL transFlag; //has transport been triggered?
/* Briefing stuff */
public INTMESSAGE MissionBrief, MissionBrief2;
public INTMESSAGE endMsg; //, winMsg;
public SOUND incomingSnd;
/* LZ Message */
public INTMESSAGE LZ_MSG;
public SOUND LZSnd;
public INTMESSAGE obj1;
public TEXTSTRING RetLZMsg;
public INT ReinforceTime;
public SOUND LZComp, LZClear;
private BOOL playerTransOnMap;
/* Proximity: Artifacts */
public FEATURESTAT crate;
public int art1X, art1Y;
public STRUCTURE art1Get;
public SOUND art1Snd2;
//public INTMESSAGE art1Msg;
public RESEARCHSTAT art1Comp;
public FEATURE art1ID;
/* 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;
/* Proximity: Enemy */
public STRUCTURE enm1a, enm1b, enm1c;
public STRUCTUREID enm1aID, enm1bID, enm1cID;
public STRUCTURE enm1See, enm2See, enm3See;
public INTMESSAGE enm1Msg;
public SOUND enm1Snd1;
public SOUND enm1Snd2;
public INTMESSAGE enm2Msg;
public SOUND enm2Snd1;
public SOUND enm2Snd2;
public INTMESSAGE enm3Msg;
public SOUND enm3Snd1;
public SOUND enm3Snd2;
/* AI STUFF */
/* Enemy Waypoints */
public INT numWay;
public INT wayX[4], wayY[4];
/* Enemy Groups*/
private GROUP Recovery1, Recovery2, artGroup;
private INT temp1, temp2, wayCount;
private FEATURE testID;
// enemy1 variables
private GROUP enemy1Build, enemy1Attack, enemy1Start, enemy1Fin, enemy1Force1, enemy1Force2;
private GROUP enemy2Build, enemy2Attack, enemy2Start, enemy2Fin, enemy1Guard, enemy2Guard;
private GROUP Strike1, Ambush1, Reserve1;
private GROUP Scav1, Scav2, Scav3;
private INT tempx1, tempx2, tempy1, tempy2;
private INT AmbushTot, Scav2Health; //for keeping track of casualties
public INT playerX,playerY;
private STRUCTURE attackedStruct;
private BASEOBJ attacker;
// temporary variables
private DROID newDroid;
private INT moveX,moveY;
private INT xdiff,ydiff;
private INT ld; //default leadership for enemy2
private BOOL briefFlag; //for additional briefing when NP have picked up artifact
/* values for build lists start here */
/* General Values */
public int enemy1Tot; //limit build to this number
public int enemy2Tot; //limit build to this number
/* Enemy Tactics */
public TEMPLATE template1[8], template2[14], template3[3];
/* enemy1 */
private int enm1aState, enm1bState, enm1cState;
private bool enm1aDestroyed, enm1bDestroyed, enm1cDestroyed;
/* Values for build Commands */
public DROID enemyTruck1;
private int comTruck1;
/* Structures to be built */
public INT numStruc1;
public STRUCTURESTAT struc1[6];
public INT struc1X[6], struc1Y[6];
/* Starting Technology */
public int numtecE1, numtecE2;
public RESEARCHSTAT tecE1[2], tecE2[21];
/* Triggers: Win or Lose */
//check no player droids outside LZ, and some within!! (since shouldn't use groups for player 0)
//trigger checkLZTrig((droidInArea(player, 0, 6592, 1600, 8192)) and (not droidInArea(player, 0, 0, 8192, 6592)) and (not droidInArea(player, 1600, 6592, 8192, 8192)), 10);
//trigger checkLZTrig((droidInArea(player, 0, 0, 8192, 8192)), 10);
trigger winLoseTrig(every, 10);
/* Triggers: Briefing */
trigger vidEndTrig(CALL_VIDEO_QUIT);
trigger obj1Trig(droidInRange(player, 4160, 3904, 5*128), 20);
/* Triggers: Artifacts */
//trigger art1SeenTrig(droidHasSeen(art1ID, player), 5);
//trigger art1SeenTrig(droidInRange(player, art1X, art1Y, 12*128), 10);
trigger art1TakeTrig(droidInRange(player, art1X, art1Y, 171), 10);
trigger art1PlaceTrig(every, 5);
trigger every10( every, 10);
/* Enemy Grab Artifact */
trigger art1EnmTakeTrig(droidInRange(enemy2, art1X, art1Y, 171), 10);
trigger enemyWayTrig(every, 10);
//trigger startGrabTrig(droidInArea(player, 0, 3392, 7872, 4800), 10);
trigger startGrabTrig(droidInArea(player, 2122, 3392, 7872, 5184), 10);
/* Triggers: Enemy */
trigger enm1SeenTrig(seenStructInArea(player, enemy1, FALSE, 3136, 4288, 5056, 7616), 10);
trigger enm1DeadTrig(numStructsButNotWallsInArea(enemy1, 3136, 4288, 5056, 7616) == 0, 20);
trigger enm2SeenTrig(seenStructInArea(player, enemy1, FALSE, 5696, 5312, 8000, 8000), 10);
trigger enm2DeadTrig(numStructsButNotWallsInArea(enemy1, 5696, 5312, 8000, 8000) == 0, 20);
trigger enm3SeenTrig(seenStructInArea(player, enemy1, FALSE, 3392, 448, 8000, 1984), 10);
trigger enm3DeadTrig(numStructsButNotWallsInArea(enemy1, 3392, 448, 8000, 1984) == 0, 20);
/* AI TRIGGERS */
trigger enemy1AttackPause( every, 3000 ); //5 mins
/* triggers for build lists start here */
/* Triggers: Enemy Tactics */
trigger enm1aStartTrig(droidInRange(player,enm1a.x, enm1a.y, 15*128),20);
trigger enm1aFactTrig(every,300);
trigger enm1bStartTrig(droidInRange(player,enm1b.x, enm1b.y, 15*128),20);
trigger enm1bFactTrig(every,300);
trigger enm1cStartTrig(droidInRange(player,enm1c.x, enm1c.y, 15*128),20);
trigger enm1cFactTrig(every,300);
trigger buildTrig(every, 30);
trigger retLZTrig(not anyDroidsLeft(enemy2), 24); //NP vehicles all dead?
trigger gameLostTrig (every, 20);
/* transport triggers */
trigger landTransTrig(droidInArea(player, 0, 0, 3392, 2368), 10);
trigger NPTRansLeft(CALL_TRANSPORTER_OFFMAP, enemy2);
trigger warnPlayerTrig(wait, 2); //extra brief
//LZ contains enemies?
trigger LZNoGoTrig((objectInArea(enemy1, 128, 6400, 1664, 7936)) or
(objectInArea(enemy2, 128, 6400, 1664, 7936)), 35);
//LZ clear of enemies?
trigger LZ_OKTrig((not objectInArea(enemy1, 128, 6400, 1664, 7936)) and
(not objectInArea(enemy2, 128, 6400, 1664, 7936)), 35);
trigger RTLZStart(wait,0);
trigger RTLZFreq(every,300);
/* Events: Start */
event wonYetEvnt;
event timeUp;
event art1EnmTakeEvnt;
event recoveryDead;
event enemyWayEvnt;
event startGrab2;
event setBuild1;
//event art1SeenEvnt;
event landTrans;
event LZNoGo;
event LZ_OK;
event periodicRTLZ;
event startEvnt(CALL_GAMEINIT)
{
centreViewPos(7*128, 56*128); //centre near LZ
//make scavengers and New paradigm allies (just in case!)
createAlliance(enemy1, enemy2);
//set scroll limits
// setScrollParams(0, 0, 64, 64); //limit scroll
//set zoom Level 64x64
setRadarZoom(1);
//stop player building on LZ#1
setLandingZone(6, 55, 8, 57);
//call in transport
flyTransporterIn(player, entryX, entryY, false);
setTransporterExit(player, exitX, exitY);
//add enemy transport (once!)
setNoGoArea(12, 10, 14, 12, enemy2);
transportDroid = addDroidToMissionList(transporter, enemy2);
setPowerLevel(pow1, enemy1);
setPowerLevel(pow2, enemy2);
//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, 0, player);
setStructureLimits(comRelay, 0, player);
enableStructure(command, player);
enableStructure(powerGen,0);
enableStructure(oilDerrick,0);
enableStructure(research,0);
enableStructure(factory,0);
//enableStructure(powerModuleHack, 0);
//set transport time
setReinforcementTime(ReinforceTime);
//add enemy transport!!
//addDroid(transporter, 1728, 1472, enemy2); //place enemy transporter!!!
//get Enemy Recovery Group to pick up artifact
groupAddArea(Recovery1, enemy2, 4544, 3520, 4800, 3776);
// player specific technology startups
count = 0;
while (count < numtecE1)
{
completeResearch(tecE1[count], enemy1);
count = count +1;
}
count = 0;
while (count < numtecE2)
{
completeResearch(tecE2[count], enemy2);
count = count +1;
}
setEventTrigger(startEvnt, inactive);
addMessage(MissionBrief, MISS_MSG, 0, false);
flashOff(INTELMAP);
}
/* Events: Artifacts */
event art1TakeEvnt(art1TakeTrig)
{
if (art1ID != NULLOBJECT)
{
//stop enemy taking it!! or doing anything else!
setEventTrigger(art1EnmTakeEvnt, inactive);
setEventTrigger(recoveryDead, inactive);
setEventTrigger(enemyWayEvnt, inactive);
//setEventTrigger(art1SeenEvnt, inactive);
numart=numart+1;
//playSound(art1Snd2, player);
playSoundPos(art1Snd2, player, art1ID.x, art1ID.y, art1ID.z);
destroyFeature(art1ID);
//if (blipFlag > 0)
//{
// removeMessage(art1Msg, PROX_MSG, player);
//}
enableResearch(art1Comp, player);
setEventTrigger(art1TakeEvnt, inactive);
}
}
/* Events: Enemies */
event enm1DeadEvnt(inactive)
{
killStructsInArea(enemy1, REF_WALL, 3136, 4288, 5056, 7616, TRUE, TRUE); //remove walls and features in base
killStructsInArea(enemy1, REF_WALLCORNER, 3136, 4288, 5056, 7616, TRUE, FALSE); //remove corner walls in base
removeMessage(enm1Msg, PROX_MSG, player);
//playSound(enm1Snd2, player);
playSoundPos(enm1Snd2, player, 4288, 4928, 0);
setEventTrigger(enm1DeadEvnt, inactive);
}
event enm1SeenEvnt(enm1SeenTrig)
{
addMessage(enm1Msg, PROX_MSG, player, false);
//playSound(enm1Snd1, player);
playSoundPos(enm1Snd1, player, 4288, 4928, 0);
setEventTrigger(enm1DeadEvnt, enm1DeadTrig);
setEventTrigger(enm1SeenEvnt, inactive);
}
event enm2DeadEvnt(inactive)
{
killStructsInArea(enemy1, REF_WALL, 5696, 5312, 8000, 8000, TRUE, TRUE); //remove walls and features in base
killStructsInArea(enemy1, REF_WALLCORNER, 5696, 5312, 8000, 8000, TRUE, FALSE); //remove corner walls in base
removeMessage(enm2Msg, PROX_MSG, player);
//playSound(enm2Snd2, player);
playSoundPos(enm2Snd2, player, 7232, 7104, 0);
setEventTrigger(enm2DeadEvnt, inactive);
}
event enm2SeenEvnt(enm2SeenTrig)
{
addMessage(enm2Msg, PROX_MSG, player, false);
//playSound(enm2Snd1, player);
playSoundPos(enm2Snd1, player, 7232, 7104, 0);
setEventTrigger(enm2DeadEvnt, enm2DeadTrig);
setEventTrigger(enm2SeenEvnt, inactive);
}
event enm3DeadEvnt(inactive)
{
killStructsInArea(enemy1, REF_WALL, 3392, 448, 8000, 1984, TRUE, TRUE); //remove walls and features in base
killStructsInArea(enemy1, REF_WALLCORNER, 3392, 448, 8000, 1984, TRUE, FALSE); //remove corner walls in base
removeMessage(enm3Msg, PROX_MSG, player);
//playSound(enm3Snd2, player);
playSoundPos(enm3Snd2, player, 7616, 576, 0);
setEventTrigger(enm3DeadEvnt, inactive);
}
event enm3SeenEvnt(enm3SeenTrig)
{
addMessage(enm3Msg, PROX_MSG, player, false);
//playSound(enm3Snd1, player);
playSoundPos(enm3Snd1, player, 7616, 576, 0);
setEventTrigger(enm3DeadEvnt, enm3DeadTrig);
setEventTrigger(enm3SeenEvnt, inactive);
}
/* 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
//setLandingZone(10, 51, 12, 53);
enableResearch(art1Comp, player);
removeMessage(MissionBrief, MISS_MSG, player);
startMission(BETWEEN, NextLev);
//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(timeUp, inactive);
setEventTrigger(gameLost, gameLostTrig);
setEventTrigger(lostYetEvnt, inactive);
}
}
}
//out of time?
event timeUp(CALL_MISSION_TIME)
{
setEventTrigger(wonYetEvnt,inactive);
setEventTrigger(lostYetEvnt,inactive);
setEventTrigger(gameLost, gameLostTrig); //waits 2 seconds before ending
setEventTrigger(timeUp, inactive);
}
event wonYetEvnt(retLZTrig) //All NP Droids dead //(winLoseTrig) //alternate victory condition, got artifact(s) and back at LZ
{
totDroids = numDroidsInArea(player, 0, 0, 64*128, 64*128);
//if (totDroids == numDroidsInArea(player, 5*128, 80*128, 13*128, 86*128))
if (totDroids == numDroidsInArea(player, 0, 6592, 1600, 8192))
{
if (totDroids!=0)
{
if (numart==1)
{
setEventTrigger(lostYetEvnt, inactive);
setEventTrigger(nextLevEvnt, winLoseTrig);
setEventTrigger(wonYetEvnt, 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 retLZ(retLZTrig) //ALl NP droids dead (winLoseTrig)
{
if (numart==1)
{
//add LZ blip and WAV message
addMessage(LZ_MSG, PROX_MSG, player, false);
setEventTrigger(periodicRTLZ,RTLZStart);
// addConsoleText(RetLZMsg, player);
//playSound(LZSnd, player);
// playSoundPos(LZSnd, player, 960, 7232, 0);
setEventTrigger(retLZ, inactive);
}
}
event periodicRTLZ(inactive)
{
showConsoleText(RetLZMsg, player);
playSoundPos(LZSnd, player, 960, 7232, 0);
setEventTrigger(periodicRTLZ,RTLZFreq);
}
event removeObj1(obj1Trig)
{
removeMessage(obj1, PROX_MSG, player);
setEventTrigger(removeObj1, inactive);
}
/* AI EVENTS */
event startup(init)
{
//setass here since factory may be dead if done later!!!
setAssemblyPoint (enm1a, 4288, 5770);
setAssemblyPoint (enm1b, 5824, 6080);
setAssemblyPoint (enm1c, 4800, 576);
//make up starting forces
//set up Scavenger forces
}
// deal with a droid being built by enemy1
event enemy1build(CALL_NEWDROID, enemy1, ref newDroid, ref newDroidFactory)
{
groupAddDroid(enemy1Build, newDroid);
if (enemy1Build.members >= 4)
{
groupAddGroup(enemy1Attack, enemy1Build);
//do attack force decision here!
orderGroupLoc(enemy1Attack, DORDER_SCOUT, 896, 7168); //attack player's LZ
}
}
/* events for build lists start here */
/* Enemy 1 Scavengers*/
event enm1aFactEvnt(inactive)
{
enm1aDestroyed = buildingDestroyed (enm1aID, enemy1);
if (enm1aDestroyed)
{
setEventTrigger(enm1aFactEvnt, inactive);
}
else if (structureIdle(enm1a) and (enemy1Build.members+enemy1Attack.members)<enemy1Tot)
{
if (enm1aState == 0)
{
buildDroid (template1[4], enm1a, enemy1, 1);
enm1aState = 1;
}
else if (enm1aState== 1)
{
buildDroid (template1[3], enm1a, enemy1, 1);
enm1aState = 2;
}
else if (enm1aState == 2)
{
buildDroid (template1[6], enm1a, enemy1, 1);
enm1aState = 3;
}
else
{
buildDroid (template1[1], enm1a, enemy1, 3);
enm1aState = 0;
}
}
}
event enm1aStartEvnt(enm1aStartTrig)
{
setEventTrigger(enm1aFactEvnt, enm1aFactTrig);
setEventTrigger(enm1aStartEvnt, inactive);
}
//build list Scav north Factory
event enm1bFactEvnt(inactive)
{
enm1bDestroyed = buildingDestroyed (enm1bID, enemy1);
if (enm1bDestroyed)
{
setEventTrigger(enm1bFactEvnt, inactive);
}
else if (structureIdle(enm1b) and (enemy1Build.members+enemy1Attack.members)<enemy1Tot)
{
if (enm1bState == 0)
{
buildDroid (template1[7], enm1b, enemy1, 1);
enm1bState = 1;
}
else if (enm1bState== 1)
{
buildDroid (template1[5], enm1b, enemy1, 1);
enm1bState = 2;
}
else if (enm1bState == 2)
{
buildDroid (template1[0], enm1b, enemy1, 3);
enm1bState = 3;
}
else
{
buildDroid (template1[2], enm1b, enemy1, 3);
enm1bState = 0;
}
}
}
event enm1bStartEvnt(enm1bStartTrig)
{
setEventTrigger(enm1bFactEvnt, enm1bFactTrig);
setEventTrigger(enm1bStartEvnt, inactive);
}
event lastAttack1(every, 50)
{
//make enemy attack player's base if all enemy buildings destroyed
if (not anyStructButWallsLeft(enemy1))
{
groupAddArea(enemy1Fin, enemy1, 0, 0, 64*64, 64*64);
orderGroupLoc(enemy1Fin, DORDER_SCOUT, playerX, playerY);
//setEventTrigger(lastAttack1, inactive);
}
}
event lastAttack2(every, 50)
{
//make enemy easier to find if all his buildings destroyed
if (not anyStructButWallsLeft(enemy2))
{
groupAddArea(enemy2Fin, enemy1, 0, 0, 64*64, 64*64);
orderGroupLoc(enemy2Fin, DORDER_SCOUT, playerX, playerY);
//setEventTrigger(lastAttack2, inactive);
}
}
//Generic-ish go investigate nearby structures if under attack!
event enm1Hit(CALL_STRUCT_ATTACKED, enemy1, ref hitStruc, ref attackerObj)
{
//playSound(attackSnd1, 0); //quick check
//get force nearby
if (hitStruc!=NULLOBJECT)
{
//find at least 4 vehicles to defend structure first
tempx1 = 1 * 128;
groupAddGroup(enemy1Guard, enemy1Attack); //empty the group first!
while ((enemy1Guard.members < 4) and (tempx1 <= 1280))
{
groupAddArea(enemy1Guard, enemy1, hitStruc.x - tempx1, hitStruc.y - tempx1, hitStruc.x + tempx1, hitStruc.y + tempx1);
tempx1 = tempx1 + 32;
tempy1 = enemy1Attack.members; //hack to recalculate members in enemy1Guard!!!
}
if (attackerObj != NULLOBJECT)
{
//attack attacker (if he exists)!!
orderGroupObj(enemy1Guard, DORDER_ATTACK, attackerObj);
orderGroupLoc(enemy1Guard, DORDER_SCOUT, attackerObj.x, attackerObj.y);
}
else
{
//defend structure!!
orderGroupLoc(enemy1Guard, DORDER_SCOUT, hitStruc.x, hitStruc.y);
}
}
}
event enm2Hit(CALL_STRUCT_ATTACKED, enemy2, ref hitStruc, ref attackerObj)
{
//Find a free Truck to Repair Object (in Theory!)
//playSound(attackSnd1, 0); //quick check
if (hitStruc!=NULLOBJECT)
{
//find at least 4 vehicles to defend structure first
tempx2 = 1 * 128;
groupAddGroup(enemy2Guard, enemy2Attack); //empty the group first!
while ((enemy2Guard.members < 4) and (tempx2 <= 1280))
{
groupAddArea(enemy2Guard, enemy2, hitStruc.x - tempx2, hitStruc.y - tempx2, hitStruc.x + tempx2, hitStruc.y + tempx2);
tempx2 = tempx2 + 32;
tempy2 = enemy2Attack.members; //hack to recalculate members in enemy2Guard!!!
}
if (attackerObj != NULLOBJECT)
{
//attack attacker (if he exists)!!
orderGroupObj(enemy2Guard, DORDER_ATTACK, attackerObj);
orderGroupLoc(enemy2Guard, DORDER_SCOUT, attackerObj.x, attackerObj.y);
}
else
{
//defend structure!!
orderGroupLoc(enemy2Guard, DORDER_SCOUT, hitStruc.x, hitStruc.y);
}
//then send a repair droid
if (enemyTruck1!=NULLOBJECT) //not dead
{
orderDroidObj(enemyTruck1, DORDER_REPAIR, hitStruc);
}
}
}
/* Construction lists */
/* now with arrays!!!! */
event buildStruc1(wait, 300)
{
if (enemyTruck1==NULLOBJECT)
{
setEventTrigger(setBuild1, inactive);
setEventTrigger(buildStruc1, inactive);
}
else if (comTruck1<numStruc1)
{
orderDroidStatsLoc(enemyTruck1, DORDER_BUILD, struc1[comTruck1], struc1X[comTruck1], struc1Y[comTruck1]);
}
setEventTrigger(setBuild1, buildTrig);
setEventTrigger(buildStruc1, inactive);
}
event setBuild1(inactive)
{
if (enemyTruck1==NULLOBJECT)
{
setEventTrigger(setBuild1, inactive);
setEventTrigger(buildStruc1, inactive);
}
else if (enemyTruck1.order == DORDER_NONE)
{
comTruck1 = comTruck1+1;
setEventTrigger(buildStruc1, buildTrig);
setEventTrigger(setBuild1, inactive);
}
//check if finished
if (comTruck1 >= numStruc1)
{
setEventTrigger(setBuild1, inactive);
setEventTrigger(buildStruc1, inactive);
}
}
event warnPlayer(inactive)
{
playSound(incomingSnd, player);
pause(20);
addMessage(MissionBrief2, MISS_MSG, 0, true);
setEventTrigger(warnPlayer, inactive);
}
/* Get enemy to grab the artifact */
event art1EnmTakeEvnt(art1EnmTakeTrig)
{
//check if enemy recovery group has got artifact
temp1 = Recovery1.members;
groupAddArea(Recovery2, enemy2, art1X - 171, art1Y - 171, art1X + 171, art1Y + 171);
temp2 = Recovery2.members; //hack to recalc Recovery1 members also!
if ((temp1 > Recovery1.members) and (temp2 > 0))
{
if (art1ID != NULLOBJECT)
{
//stop player from taking it!
setEventTrigger(art1TakeEvnt, inactive);
//or seeing it!
//setEventTrigger(art1SeenEvnt, inactive);
setEventTrigger(art1EnmTakeEvnt, inactive);
//add taker back to group
//groupAddGroup(Recovery1, Recovery2);
//artTake id the droid with the ball!!!
groupAddGroup(artGroup, Recovery2);
//remove artifact
destroyFeature(art1ID);
if (not briefFlag)
{
briefFlag = TRUE;
setEventTrigger(warnPlayer, warnPlayerTrig);
}
//flag check for all of this group dead, so can drop artifact!!
setEventTrigger(recoveryDead, art1PlaceTrig);
setEventTrigger(enemyWayEvnt, enemyWayTrig);
//go to LZ hopefully!
if (wayCount < numWay)
{
orderGroupLoc(Recovery1, DORDER_SCOUT, wayX[wayCount], wayY[wayCount]);
orderGroupLoc(artGroup, DORDER_MOVE, wayX[wayCount], wayY[wayCount]);
}
}
}
}
event enemyWayEvnt(inactive)
{
if (wayCount < numWay)
{
//check if artGroup has got to next waypoint
//if ( (artGroup.members > 0) and (artGroup.x >= wayX[wayCount] - 256) and (artGroup.y >= wayY[wayCount] - 256) and (artGroup.x <= wayX[wayCount] + 256) and (artGroup.y <= wayY[wayCount] + 256))
if ((artGroup.members > 0) and (idleGroup(artGroup) == artGroup.members ))
{
//add back to group
wayCount = wayCount + 1;
if (wayCount < numWay)
{
orderGroupLoc(Recovery1, DORDER_MOVE, wayX[wayCount], wayY[wayCount]); //don't use scout, get distracted!
orderGroupLoc(artGroup, DORDER_MOVE, wayX[wayCount], wayY[wayCount]);
}
else
{
//got to last waypoint, so player has lost!!!
//land transport to pick them up
//hold position
groupAddGroup(Recovery1, Recovery2);
groupAddGroup(Recovery1, artGroup);
setGroupSecondary(Recovery1, DSO_HALTTYPE, DSS_HALT_HOLD);
setEventTrigger(landTrans, landTransTrig);
setEventTrigger(enemyWayEvnt, inactive);
}
}
}
else
{
setEventTrigger(enemyWayEvnt, inactive);
}
}
event recoveryDead(inactive)
{
//check to see if the artGroup has died
if (artGroup.members == 0)
{
//place artifact!!
art1ID=addFeature(crate, art1X, art1Y);
//allow player to snatch it
setEventTrigger(art1TakeEvnt, art1TakeTrig);
//allow remaining recovery group to snatch it!!
orderGroupLoc(Recovery1, DORDER_MOVE, art1X, art1Y); //OK on scout?
setEventTrigger(enemyWayEvnt, inactive);
setEventTrigger(art1EnmTakeEvnt, art1EnmTakeTrig);
//need to make a new recovery force to try to snatch it back if all dead(later!)
setEventTrigger(recoveryDead, inactive);
}
else
{
//mark groups position, so can drop artifact if dead
art1X = artGroup.x;
art1Y = artGroup.y;
}
}
event startGrab(startGrabTrig)
{
//start grab earlier if player nearby!
orderGroupLoc(Recovery1, DORDER_MOVE, art1X, art1Y);
setEventTrigger(startGrab2, inactive);
setEventTrigger(startGrab, inactive);
}
event startGrab2(wait, 1200)
{
//delay for 2 mins before they go for the grab!
orderGroupLoc(Recovery1, DORDER_MOVE, art1X, art1Y);
setEventTrigger(startGrab, inactive);
setEventTrigger(startGrab2, inactive);
}
/* Transports */
/* group landed enemy units and get going! */
event groupTrans(CALL_TRANSPORTER_LANDED, Recovery1, enemy2)
{
setEventTrigger(recoveryDead, inactive); //don't leave artufact behind!
setEventTrigger(gameLost, NPTRansLeft);
setEventTrigger(wonYetEvnt,inactive); //player has lost, so can't win!
//need to make this group vanish along with the artifact group
//Recovery1, Recovery2, artGroup;
//vanish all these!
initIterateGroup(Recovery1);
count = 0;
while (count < Recovery1.members)
{
loadDroid = iterateGroup(Recovery1);
vanishUnit(loadDroid);
count = count + 1;
}
//playSound(warnSnd, player);
playSoundPos(warnSnd, player, 1728, 1472, 0);
showConsoleText(badMsg, player); //text version
pause(10);
}
event landTrans(inactive)
{
//call enemy transport in when artifact group gets to LZ
if (transportDroid != NULLOBJECT)
{
transFlag = TRUE;
loadDroid = addDroidToMissionList(template2[0], enemy2);
if (loadDroid != NULLOBJECT)
{
addDroidToTransporter(transportDroid, loadDroid);
//call in transport
setTransporterExit(enemy2, 32, 62);
flyTransporterIn(enemy2, 46, 1, false);
}
}
setEventTrigger(landTrans, inactive);
}
event LZNoGo(LZNoGoTrig)
{
if (not playerTransOnMap) //make sure transport not already landing!
{
//check LZ area for enemy structures and/or vehicles (in Trigger)
//playSound(LZComp, player); //"LZ Compromised"
playSoundPos(LZComp, player, 896, 7168, 0);
//disable transport landing
setReinforcementTime(LZ_COMPROMISED_TIME); //(set to 30 mins)
//allow check for clear!
setEventTrigger(LZ_OK,LZ_OKTrig);
setEventTrigger(LZNoGo, inactive);
}
}
event LZ_OK(inactive)
{
//check LZ area clear of enemy structures and/or vehicles (in Trigger)
//playSound(LZClear, player); //"LZ Clear"
playSoundPos(LZClear, player, 896, 7168, 0);
//allow reinforcements now LZ clear
setReinforcementTime(ReinforceTime); //(set back to normal)
setEventTrigger(LZNoGo, LZNoGoTrig);
setEventTrigger(LZ_OK, inactive);
}
event transOn(CALL_TRANSPORTER_REINFORCE)
{
playerTransOnMap = TRUE;
}
event transOff(CALL_TRANSPORTER_OFFMAP, player)
{
playerTransOnMap = FALSE;
}