warzone2100/data/script/text/cam1-4a.slo

1237 lines
32 KiB
Plaintext

// SCRIPT file for Cam 1-4A
/* General Values */
public int player;
public int enemy1, 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;
private STRUCTURE newDroidFactory;
/* Win or lose */
public SOUND lostSnd;
public LEVEL NextLev;
public int timeLimit;
private GROUP allPlayer, nearLZ;
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;
/* Briefing stuff */
public INTMESSAGE MissionBrief, MissionBrief2;
//public INTMESSAGE NewParadigm_MSG1, NewParadigm_MSG2;
public SOUND incomingSnd;
public INTMESSAGE endMsg; //, winMsg;
/* LZ Message */
public INTMESSAGE LZ_MSG;
public SOUND LZSnd;
public INTMESSAGE obj1;
public TEXTSTRING RetLZMsg;
public TEXTSTRING ReinforceMsg;
public SOUND ReinforceSnd;
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 RESEARCHSTAT art1Comp;
private FEATURE art1ID;
*/
public int art2X, art2Y;
public STRUCTURE art2Get;
public SOUND art2Snd2;
public RESEARCHSTAT art2Comp;
private FEATURE art2ID;
public int art3X, art3Y;
public STRUCTURE art3Get;
public SOUND art3Snd2;
public RESEARCHSTAT art3Comp;
private FEATURE art3ID;
public int art4X, art4Y;
public STRUCTURE art4Get;
public SOUND art4Snd2;
public RESEARCHSTAT art4Comp;
private FEATURE art4ID;
/* 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;
public STRUCTUREID enm1aID, enm1bID;
public STRUCTURE enm1See, enm2See, enm3See;
public INTMESSAGE enm1Msg;
public SOUND enm1Snd1;
public SOUND enm1Snd2;
public INTMESSAGE enm3Msg;
public SOUND enm3Snd1;
public SOUND enm3Snd2;
public STRUCTURE enm2a, enm2b;
public STRUCTUREID enm2aID, enm2bID;
public INTMESSAGE enm2Msg;
public SOUND enm2Snd1;
public SOUND enm2Snd2;
/* AI STUFF */
// 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;
private INT attackX, attackY;
// temporary variables
private DROID newDroid;
private INT moveX,moveY;
private INT xdiff,ydiff;
private INT ld; //default leadership for enemy2
/* 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[10];
/* enemy1 */
private int enm1aState, enm1bState;
private bool enm1aDestroyed, enm1bDestroyed;
/* enemy2 */
private int enm2aState, enm2bState, enm2cState, enm2dState;
private bool enm2aDestroyed, enm2bDestroyed, enm2cDestroyed, enm2dDestroyed;
/* Values for build Commands */
public DROID enemyTruck1, enemyTruck2, enemyTruck3, enemyTruck4, enemyTruck5;
private int comTruck1, comTruck2, comTruck3;
private INT dist1, dist2, dist3; //used to calc closest repair truck!
/* Structures to be built */
public INT numStruc1, numStruc2, numStruc3;
public STRUCTURESTAT struc1[4], struc2[5], struc3[8];
public INT struc1X[4], struc1Y[4], struc2X[5], struc2Y[5], struc3X[8], struc3Y[8];
/* Starting Technology */
public int numtecE1, numtecE2;
public RESEARCHSTAT tecE1[2], tecE2[18];
/* Triggers: Win or Lose */
trigger winLoseTrig(every, 5);
trigger gameLostTrig(every, 20);
trigger RTLZStart(wait,0);
trigger RTLZFreq(every,300);
/* Triggers: Briefing */
trigger vidEndTrig(CALL_VIDEO_QUIT);
trigger obj1Trig(droidInRange(player, 4160, 3904, 5*128), 20);
/* Triggers: Artifacts */
/*
trigger art1TakeTrig(droidInRange(player, art1X, art1Y, 171), 5);
trigger art1PlaceTrig((art1Get==NULLOBJECT), 5);
*/
trigger art2TakeTrig(droidInRange(player, art2X, art2Y, 171), 5);
trigger art2PlaceTrig((art2Get==NULLOBJECT), 5);
trigger art3TakeTrig(droidInRange(player, art3X, art3Y, 171), 5);
trigger art3PlaceTrig((art3Get==NULLOBJECT), 5);
trigger art4TakeTrig(droidInRange(player, art4X, art4Y, 171), 5);
trigger art4PlaceTrig((art4Get==NULLOBJECT), 5);
/* Triggers: Enemy */
trigger enm1SeenTrig(seenStructInArea(player, enemy1, FALSE, 1600, 6464, 3776, 7872), 10);
trigger enm1DeadTrig(numStructsButNotWallsInArea(enemy1, 1600, 6464, 3776, 7872) == 0, 20);
trigger enm2SeenTrig(seenStructInArea(player, enemy2, FALSE, 2368, 960, 5952, 4416), 10);
trigger enm2DeadTrig(numStructsButNotWallsInArea(enemy2, 2368, 960, 5952, 4416) == 0, 20);
trigger enm3SeenTrig(seenStructInArea(player, enemy1, FALSE, 5696, 1472, 7872, 3264), 10);
trigger enm3DeadTrig(numStructsButNotWallsInArea(enemy1, 5696, 1472, 7872, 3264) == 0, 20);
//trigger LZTrig(droidInArea(player, 57*128, 35*128, 61*128, 39*128), 10);
trigger LZTrig(droidInArea(player, 7232, 4416, 7744, 4928), 10);
/* 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, 10*128),20);
trigger enm1aStartTrig(wait,100); //10 seconds before producing
trigger enm1aFactTrig(every,350);
trigger enm1bStartTrig(droidInRange(player,enm1b.x, enm1b.y, 10*128),20);
trigger enm1bFactTrig(every,350);
trigger enm2aStartTrig(droidInRange(player,enm2a.x, enm2a.y, 10*128),20);
trigger enm2aFactTrig(every,400);
trigger enm2bStartTrig(droidInRange(player,enm2b.x, enm2b.y, 10*128),20);
trigger enm2bFactTrig(every,400);
trigger buildTrig(every, 30);
//player near oil resources
trigger orderTrig1(droidInRange(player, 3136, 3392, 8*128), 20);
//LZ contains enemies?
trigger LZNoGoTrig((objectInArea(enemy1, 6656, 3840, 8192, 5376)) or
(objectInArea(enemy2, 6656, 3840, 8192, 5376)), 35);
//LZ clear of enemies?
trigger LZ_OKTrig((not objectInArea(enemy1, 6656, 3840, 8192, 5376)) and
(not objectInArea(enemy2, 6656, 3840, 8192, 5376)), 35);
trigger retLZTrig(numart == 3, 24);
/* Events: Start */
event enm1aFactEvnt;
event enm1bFactEvnt;
event enm2aFactEvnt;
event enm2bFactEvnt;
event reachedLZEvnt;
event LZNoGo;
event LZ_OK;
event periodicRTLZ;
event startEvnt(CALL_GAMEINIT)
{
centreViewPos(576, 6592);
//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
//set landing zone
setLandingZone(3,50,5,52);
//call in transport
flyTransporterIn(player, entryX, entryY, false);
setTransporterExit(player, exitX, exitY);
attackX = 512; //so enemies attack LZ
attackY = 6528;
//removeReticuleButton(BUILD);
//set up resource coords (since oil pools diappear when built on!!!)
//res1x=res1.x;
//res1y=res1.y;
setPowerLevel(pow1, enemy1);
setPowerLevel(pow2, enemy2);
//no reinforcements yet!!
setReinforcementTime(-1);
//changed so give LZ when base spotted! Rather than at start
//addMessage(LZ_MSG, PROX_MSG, player, false);
//addConsoleText(RetLZMsg, player);
//playSound(LZSnd, player);
//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 up initial attack force for NP
groupAddArea(enemy2Attack, enemy2, 3264, 3008, 3648, 3264);
groupAddArea(enemy2Attack, enemy2, 3392, 2112, 3776, 2624);
// 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:*/
/* Events: Artifacts */
/*
event art1TakeEvnt(inactive)
{
numart=numart+1;
//playSound(art1Snd2, player);
playSoundPos(art1Snd2, player, art1ID.x, art1ID.y, art1ID.z);
destroyFeature(art1ID);
enableResearch(art1Comp, player);
setEventTrigger(art1TakeEvnt, inactive);
}
event art1PlaceEvnt(art1PlaceTrig)
{
//place artifact crate, and allow check for prox
art1ID=addFeature(crate, art1X, art1Y);
setEventTrigger(art1TakeEvnt, art1TakeTrig);
setEventTrigger(art1PlaceEvnt, inactive);
}
*/
event art2TakeEvnt(inactive)
{
numart=numart+1;
//playSound(art2Snd2, player);
playSoundPos(art2Snd2, player, art2ID.x, art2ID.y, art2ID.z);
destroyFeature(art2ID);
enableResearch(art2Comp, player);
setEventTrigger(art2TakeEvnt, inactive);
}
event art2PlaceEvnt(art2PlaceTrig)
{
//place artifact crate, and allow check for prox
art2ID=addFeature(crate, art2X, art2Y);
setEventTrigger(art2TakeEvnt, art2TakeTrig);
setEventTrigger(art2PlaceEvnt, inactive);
}
event art3TakeEvnt(inactive)
{
numart=numart+1;
//playSound(art3Snd2, player);
playSoundPos(art3Snd2, player, art3ID.x, art3ID.y, art3ID.z);
destroyFeature(art3ID);
enableResearch(art3Comp, player);
setEventTrigger(art3TakeEvnt, inactive);
}
event art3PlaceEvnt(art3PlaceTrig)
{
//place artifact crate, and allow check for prox
art3ID=addFeature(crate, art3X, art3Y);
setEventTrigger(art3TakeEvnt, art3TakeTrig);
setEventTrigger(art3PlaceEvnt, inactive);
}
event art4TakeEvnt(inactive)
{
numart=numart+1;
//playSound(art4Snd2, player);
playSoundPos(art4Snd2, player, art4ID.x, art4ID.y, art4ID.z);
destroyFeature(art4ID);
enableResearch(art4Comp, player);
setEventTrigger(art4TakeEvnt, inactive);
}
event art4PlaceEvnt(art4PlaceTrig)
{
//place artifact crate, and allow check for prox
art4ID=addFeature(crate, art4X, art4Y);
setEventTrigger(art4TakeEvnt, art4TakeTrig);
setEventTrigger(art4PlaceEvnt, inactive);
}
/* Events: Enemies */
event enm1DeadEvnt(inactive)
{
killStructsInArea(enemy1, REF_WALL, 1600, 6464, 3776, 7872, TRUE, TRUE); //remove walls and features in base
killStructsInArea(enemy1, REF_WALLCORNER, 1600, 6464, 3776, 7872, TRUE, FALSE); //remove corner walls in base
removeMessage(enm1Msg, PROX_MSG, player);
//playSound(enm1Snd2, player);
playSoundPos(enm1Snd2, player, 2624, 7488, 0);
setEventTrigger(enm1DeadEvnt, inactive);
}
event enm1SeenEvnt(enm1SeenTrig)
{
addMessage(enm1Msg, PROX_MSG, player, false);
//playSound(enm1Snd1, player);
playSoundPos(enm1Snd1, player, 2624, 7488, 0);
setEventTrigger(enm1DeadEvnt, enm1DeadTrig);
setEventTrigger(enm1SeenEvnt, inactive);
}
event enm3DeadEvnt(inactive)
{
killStructsInArea(enemy1, REF_WALL, 5696, 1472, 7872, 3264, TRUE, TRUE); //remove walls and features in base
killStructsInArea(enemy1, REF_WALLCORNER, 5696, 1472, 7872, 3264, TRUE, FALSE); //remove corner walls in base
removeMessage(enm3Msg, PROX_MSG, player);
//playSound(enm3Snd2, player);
playSoundPos(enm3Snd2, player, 7104, 2496, 0);
setEventTrigger(enm3DeadEvnt, inactive);
}
event enm3SeenEvnt(enm3SeenTrig) //hidden Scav base!
{
addMessage(enm3Msg, PROX_MSG, player, false);
//playSound(enm3Snd1, player);
playSoundPos(enm3Snd1, player, 7104, 2496, 0);
setEventTrigger(enm3DeadEvnt, enm3DeadTrig);
setEventTrigger(enm3SeenEvnt, inactive);
}
event enm2DeadEvnt(inactive)
{
killStructsInArea(enemy2, REF_WALL, 2368, 960, 5952, 4416, TRUE, TRUE); //remove walls and features in base
killStructsInArea(enemy2, REF_WALLCORNER, 2368, 960, 5952, 4416, TRUE, FALSE); //remove corner walls in base
removeMessage(enm2Msg, PROX_MSG, player);
//playSound(enm2Snd2, player);
playSoundPos(enm2Snd2, player, 3648, 2240, 0);
setEventTrigger(enm2DeadEvnt, inactive);
}
event enm2SeenEvnt(enm2SeenTrig) //base 2 seen
{
addMessage(enm2Msg, PROX_MSG, player, false);
//playSound(enm2Snd1, player);
playSoundPos(enm2Snd1, player, 3648, 2240, 0);
//give LZ when base spotted!
addMessage(LZ_MSG, PROX_MSG, player, false);
//addConsoleText(RetLZMsg, player);
//playSound(LZSnd, player);
//playSoundPos(LZSnd, player, 7488, 4672, 0);
//set enemy factories producing!!!
setEventTrigger(enm1aFactEvnt, enm1aFactTrig);
setEventTrigger(enm1bFactEvnt, enm1bFactTrig);
setEventTrigger(enm2aFactEvnt, enm2aFactTrig);
setEventTrigger(enm2bFactEvnt, enm2bFactTrig);
attackX = 4032; //so enemies don't go all the way to 1st LZ
attackY = 4032;
setEventTrigger(reachedLZEvnt, LZTrig);
setEventTrigger(enm2DeadEvnt, enm2DeadTrig);
setEventTrigger(enm2SeenEvnt, inactive);
}
event wonYetEvnt;
event timeUp;
/* 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);
//enable research
//enableResearch(art1Comp, player);
enableResearch(art2Comp, player);
enableResearch(art3Comp, player);
enableResearch(art4Comp, 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(wonYetLZEvnt, inactive);
setEventTrigger(timeUp, inactive);
setEventTrigger(gameLost, gameLostTrig); //waits 2 seconds before ending
setEventTrigger(lostYetEvnt, inactive);
}
}
}
//out of time?
event timeUp(CALL_MISSION_TIME)
{
setEventTrigger(wonYetEvnt,inactive);
//setEventTrigger(wonYetLZEvnt, inactive);
setEventTrigger(lostYetEvnt,inactive);
setEventTrigger(gameLost, gameLostTrig); //waits 2 seconds before ending
setEventTrigger(timeUp, inactive);
}
/*
event wonYetEvnt(winLoseTrig) // have all enemies lost yet?
{
if (not anyDroidsLeft(enemy2))
{
if (not anyStructButWallsLeft(enemy2))
{
if (not anyDroidsLeft(enemy1))
{
if (not anyStructButWallsLeft(enemy1))
{
if (numart==3) // a victory condition
{
setEventTrigger(lostYetEvnt, inactive);
setEventTrigger(timeUp, inactive);
setEventTrigger(nextLevEvnt, winLoseTrig);
setEventTrigger(wonYetEvnt, inactive);
}
}
}
}
}
}
*/
event wonYetEvnt(inactive) // has player got to LZ (once enemy NP dead and collected all the artifacts?)
{
totDroids = numDroidsInArea(player, 0, 0, 64*128, 64*128);
//if (totDroids == numDroidsInArea(player, 6720, 3776, 7872, 5312))
//area increased a bit by popular demand!
if (totDroids == numDroidsInArea(player, 6592, 3392, 8192, 5568))
{
if (totDroids!=0)
{
setEventTrigger(lostYetEvnt, inactive);
setEventTrigger(timeUp, inactive);
setEventTrigger(nextLevEvnt, winLoseTrig);
setEventTrigger(wonYetEvnt, inactive);
}
}
}
//get player to return to LZ when NP and artifacts done
event retLZ(inactive) //checks for all artifacts
{
if (not anyDroidsLeft(enemy2))
{
if (not anyStructButWallsLeft(enemy2))
{
//add LZ blip and WAV message
addMessage(LZ_MSG, PROX_MSG, player, false);
// addConsoleText(RetLZMsg, player);
// playSound(LZSnd, player);
setEventTrigger(periodicRTLZ,RTLZStart);
setEventTrigger(retLZ, inactive);
setEventTrigger(wonYetEvnt, winLoseTrig);
}
}
}
event periodicRTLZ(inactive)
{
showConsoleText(RetLZMsg, player);
playSound(LZSnd, player);
setEventTrigger(periodicRTLZ,RTLZFreq);
}
event reachedLZEvnt(inactive) //check player has at least one droid in LZ, before allowing reinforcements
{
//Change LZ position to LZ#2
setLandingZone(57, 35, 59, 37);
attackX = 7424; //so enemies attack LZ
attackY = 4608;
removeMessage(LZ_MSG, PROX_MSG, player);
playSound(incomingSnd,0);
pause(40);
addMessage(MissionBrief2, MISS_MSG, 0, true);
//add extra Mission time limit
timeLimit = timeLimit + missionTimeRemaining();
setMissionTime(timeLimit);
//allow reinforce function to go here
setReinforcementTime(ReinforceTime);
//addConsoleText(ReinforceMsg, player);
setEventTrigger(reachedLZEvnt, inactive);
//set enemy factories producing!!!
setEventTrigger(enm1aFactEvnt, enm1aFactTrig);
setEventTrigger(enm1bFactEvnt, enm1bFactTrig);
setEventTrigger(enm2aFactEvnt, enm2aFactTrig);
setEventTrigger(enm2bFactEvnt, enm2bFactTrig);
setEventTrigger(LZNoGo, LZNoGoTrig); //allow LZ checks
setEventTrigger(retLZ, retLZTrig); //allow victory checks
}
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(obj1Trig)
{
removeMessage(obj1, PROX_MSG, player);
setEventTrigger(removeObj1, inactive);
}
/* AI EVENTS */
// event prototypes
//event enemy1AttackBase;
event setBuild1;
event setBuild2;
event setBuild3;
event startup(CALL_GAMEINIT)
{
//setass here since factory may be dead if done later!!!
setAssemblyPoint (enm1a, 2624, 6848);
setAssemblyPoint (enm1b, 6720, 1728);
setAssemblyPoint (enm2a, 3648, 2368);
setAssemblyPoint (enm2b, 4032, 1984);
//make scavengers allies with NP
createAlliance(enemy1, enemy2);
//make up starting forces
//set up Scavenger forces
}
// deal with a droid being built by enemy2
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, attackX, attackY);
}
}
// deal with a droid being built by enemy2
event enemy2build(CALL_NEWDROID, enemy2, ref newDroid,ref newDroidFactory)
{
//check for New Truck Built!!!!
if ((newDroid.droidType == DROID_CONSTRUCT) and (enemyTruck1 == NULLOBJECT))
{
enemyTruck1=newDroid;
setEventTrigger(setBuild1, buildTrig);
}
else if ((newDroid.droidType == DROID_CONSTRUCT) and (enemyTruck2 == NULLOBJECT))
{
enemyTruck2=newDroid;
setEventTrigger(setBuild2, buildTrig);
}
else if ((newDroid.droidType == DROID_CONSTRUCT) and (enemyTruck3 == NULLOBJECT))
{
enemyTruck3=newDroid;
setEventTrigger(setBuild3, buildTrig);
}
else
//just normal droid so add to attack etc.
{
groupAddDroid(enemy2Build, newDroid);
if (enemy2Build.members >= 4)
{
groupAddGroup(enemy2Attack, enemy2Build);
//do attack force decision here!
orderGroupLoc(enemy2Attack, DORDER_SCOUT, attackX, attackY);
}
}
}
/* events for build lists start here */
/* Enemy 1 Scavengers*/
//build list Scav South factory!
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);
}
/* New paradigm Factories */
//build list NP Heavy factory!
event enm2aFactEvnt(inactive)
{
enm2aDestroyed = buildingDestroyed (enm2aID, enemy2);
if (enm2aDestroyed)
{
setEventTrigger(enm2aFactEvnt, inactive);
}
else if (structureIdle(enm2a) and (enemy2Build.members+enemy2Attack.members)<enemy2Tot)
{
if (enm2aState == 0)
{
buildDroid (template2[5], enm2a, enemy2, 3);
enm2aState = 1;
}
else if (enm2aState== 1)
{
buildDroid (template2[2], enm2a, enemy2, 3);
enm2aState = 2;
}
else if (enm2aState == 2)
{
buildDroid (template2[4], enm2a, enemy2, 2);
enm2aState = 0;
}
else if (enm2aState == 3)
{
buildDroid (template2[9], enm2a, enemy2, 1); //build a replacement truck
enm2aState = 0; //set back to normal build
}
}
}
event enm2aStartEvnt(wait, 600) //start producing 1 minute after start of mission
{
setEventTrigger(enm2aFactEvnt, enm2aFactTrig);
setEventTrigger(enm2aStartEvnt, inactive);
}
//build list NP Medium Factory
// 0, 1 = produce Rocket Cyborg, chaingun cyborg
event enm2bFactEvnt(inactive)
{
enm2bDestroyed = buildingDestroyed (enm2bID, enemy2);
if (enm2bDestroyed)
{
setEventTrigger(enm2bFactEvnt, inactive);
}
else if (structureIdle(enm2b) and (enemy2Build.members+enemy2Attack.members)<enemy2Tot)
{
if (enm2bState == 0)
{
buildDroid (template2[6], enm2b, enemy2, 3);
enm2bState= 1;
}
else if (enm2bState== 1)
{
buildDroid (template2[7], enm2b, enemy2, 3);
enm2bState = 2;
}
else if (enm2bState == 2)
{
buildDroid (template2[8], enm2b, enemy2, 3);
enm2bState = 3;
}
else
{
buildDroid (template2[3], enm2b, enemy2, 3);
enm2bState= 0;
}
}
}
event enm2bStartEvnt(enm2bStartTrig)
{
setEventTrigger(enm2bFactEvnt, enm2bFactTrig);
setEventTrigger(enm2bStartEvnt, 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_MOVE, 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_MOVE, playerX, playerY);
//setEventTrigger(lastAttack2, inactive);
}
}
/* don't use this anymore since makes scout part too difficult!
event NPattack(CALL_STRUCT_ATTACKED, enemy1, ref hitStruc, ref attackerObj)
{
//make NP attack early if player attacks scav buildings
orderGroupLoc(enemy2Attack, DORDER_SCOUT, attackX, attackY);
setEventTrigger(enm2aFactEvnt, enm2aFactTrig);
setEventTrigger(enm2bFactEvnt, enm2bFactTrig);
setEventTrigger(NPattack, 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(enemy1Attack, enemy1Guard); //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 + 128;
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!
//don't empty for NP
while ((enemy2Guard.members < 4) and (tempx2 <= 2000))
{
groupAddArea(enemy2Guard, enemy2, hitStruc.x - tempx2, hitStruc.y - tempx2, hitStruc.x + tempx2, hitStruc.y + tempx2);
tempx2 = tempx2 + 128;
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 + 128);
}
//then send a repair droid
if (enemyTruck5!=NULLOBJECT) //not dead
{
orderDroidObj(enemyTruck5, DORDER_REPAIR, hitStruc);
}
else if (enemyTruck4!=NULLOBJECT)
{
orderDroidObj(enemyTruck4, DORDER_REPAIR, hitStruc);
}
else if (enemyTruck3!=NULLOBJECT)
{
orderDroidObj(enemyTruck3, DORDER_REPAIR, hitStruc);
}
else if (enemyTruck2!=NULLOBJECT)
{
orderDroidObj(enemyTruck2, DORDER_REPAIR, hitStruc);
}
else if (enemyTruck1!=NULLOBJECT)
{
orderDroidObj(enemyTruck1, DORDER_REPAIR, hitStruc);
}
}
}
/* Construction lists */
/* now with arrays!!!! */
event buildStruc1(enm2SeenTrig) //(res1SeenTrig)
{
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 buildStruc2(enm2SeenTrig) //res1SeenTrig)
{
if (enemyTruck2 == NULLOBJECT)
{
setEventTrigger(setBuild2, inactive);
setEventTrigger(buildStruc2, inactive);
}
else if (comTruck2 < numStruc2)
{
orderDroidStatsLoc(enemyTruck2, DORDER_BUILD, struc2[comTruck2], struc2X[comTruck2], struc2Y[comTruck2]);
}
setEventTrigger(setBuild2, buildTrig);
setEventTrigger(buildStruc2, inactive);
}
event setBuild2(inactive)
{
if (enemyTruck2 == NULLOBJECT)
{
setEventTrigger(setBuild2, inactive);
setEventTrigger(buildStruc2, inactive);
}
else if (enemyTruck2.order == DORDER_NONE)
{
comTruck2 = comTruck2+1;
setEventTrigger(buildStruc2, buildTrig);
setEventTrigger(setBuild2, inactive);
}
//check if finished
if (comTruck2 >= numStruc2)
{
setEventTrigger(setBuild2, inactive);
setEventTrigger(buildStruc2, inactive);
}
}
event buildStruc3(enm2SeenTrig) //(res1SeenTrig)
{
if (enemyTruck3 == NULLOBJECT)
{
setEventTrigger(setBuild3, inactive);
setEventTrigger(buildStruc3, inactive);
}
else if (comTruck3 < numStruc3)
{
orderDroidStatsLoc(enemyTruck3, DORDER_BUILD, struc3[comTruck3], struc3X[comTruck3], struc3Y[comTruck3]);
}
setEventTrigger(setBuild3, buildTrig);
setEventTrigger(buildStruc3, inactive);
}
event setBuild3(inactive)
{
if (enemyTruck3 == NULLOBJECT)
{
setEventTrigger(setBuild3, inactive);
setEventTrigger(buildStruc3, inactive);
}
else if (enemyTruck3.order == DORDER_NONE)
{
comTruck3=comTruck3+1;
setEventTrigger(buildStruc3, buildTrig);
setEventTrigger(setBuild3, inactive);
}
//check if finished
if (comTruck3 >= numStruc3)
{
setEventTrigger(setBuild3, inactive);
setEventTrigger(buildStruc3, inactive);
}
}
/* don't bother
event checkTrucks(every, 30)
{
//check for any trucks dead, and set to manufacturing a replacement
//chesk for able to use Trucks 4 or 5
if ((enemyTruck1 == NULLOBJECT) and (enemyTruck4 != NULLOBJECT))
{
enemyTruck1 = enemyTruck4;
enemyTruck4 = NULLOBJECT;
setEventTrigger(setBuild1, buildTrig);
}
else if ((enemyTruck1 == NULLOBJECT) and (enemyTruck5 != NULLOBJECT))
{
enemyTruck1 = enemyTruck5;
enemyTruck5 = NULLOBJECT;
setEventTrigger(setBuild1, buildTrig);
}
else if (enemyTruck1 == NULLOBJECT)
{
enm2aState = 3; //build another one!!
}
if ((enemyTruck2 == NULLOBJECT) and (enemyTruck4 != NULLOBJECT))
{
enemyTruck2 = enemyTruck4;
enemyTruck4 = NULLOBJECT;
setEventTrigger(setBuild2, buildTrig);
}
else if ((enemyTruck2 == NULLOBJECT) and (enemyTruck5 != NULLOBJECT))
{
enemyTruck2 = enemyTruck5;
enemyTruck5 = NULLOBJECT;
setEventTrigger(setBuild2, buildTrig);
}
else if (enemyTruck2 == NULLOBJECT)
{
enm2aState = 3; //build another one!!
}
if ((enemyTruck3 == NULLOBJECT) and (enemyTruck4 != NULLOBJECT))
{
enemyTruck3 = enemyTruck4;
enemyTruck4 = NULLOBJECT;
setEventTrigger(setBuild3, buildTrig);
}
else if ((enemyTruck3 == NULLOBJECT) and (enemyTruck5 != NULLOBJECT))
{
enemyTruck3 = enemyTruck5;
enemyTruck5 = NULLOBJECT;
setEventTrigger(setBuild3, buildTrig);
}
else if (enemyTruck3 == NULLOBJECT)
{
enm2aState = 3; //build another one!!
}
}
*/
event LZNoGo(inactive)
{
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, 7424, 4608, 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, 7424, 4608, 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;
}