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

1239 lines
32 KiB
Plaintext

// SCRIPT file for Cam 1-5
/* General Values */
public int player;
public int enemy1, enemy2;
public int pow1, pow2;
private int numart;
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;
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;
public TEMPLATE transporter; //required for enemy transports landing
public SOUND warnSnd;
private DROID transportDroid, loadDroid;
private TEMPLATE reinforceTemplate;
private BOOL transFlag; //has transport been triggered?
/* Reinforcement Lists for New Paradigm */
public INT numScout, numHeavy;
public TEMPLATE scout[3], heavy[3];
/* Briefing stuff */
public INTMESSAGE MissionBrief;
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;
public int art5X, art5Y;
public STRUCTURE art5Get;
public SOUND art5Snd2;
public RESEARCHSTAT art5Comp;
private FEATURE art5ID;
*/
public int art6X, art6Y;
public STRUCTURE art6Get;
public SOUND art6Snd2;
public RESEARCHSTAT art6Comp;
private FEATURE art6ID;
public int art7X, art7Y;
public STRUCTURE art7Get;
public SOUND art7Snd2;
public RESEARCHSTAT art7Comp;
private FEATURE art7ID;
/* 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;
public SOUND enm4Snd2;
public STRUCTURE enm2a, enm2b, enm2c;
public STRUCTUREID enm2aID, enm2bID, enm2cID;
/* AI STUFF */
// enemy1 variables
private GROUP enemy1Build, enemy1Attack, enemy1Fin;
private GROUP enemy2Build, enemy2Attack, enemy2Fin, enemy1Guard, enemy2Guard;
private GROUP Scav1, Scav2, Scav3, Scav4, Scav5;
private GROUP NewP1, NewP2, NewP3, NewP4, NewP5;
private INT temp1, temp2, tempx1, tempx2, tempy1, tempy2;
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 INT attackX, attackY;
/* 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], template3[2];
/* enemy1 */
private int enm1aState, enm1bState, enm1cState;
private bool enm1aDestroyed, enm1bDestroyed, enm1cDestroyed;
/* enemy2 */
private int enm2aState, enm2bState, enm2cState, enm2dState;
private bool enm2aDestroyed, enm2bDestroyed, enm2cDestroyed, enm2dDestroyed;
/* Starting Technology */
public int numtecE1, numtecE2;
public RESEARCHSTAT tecE1[2], tecE2[20];
/* Triggers: Win or Lose */
trigger winLoseTrig(every, 5);
trigger gameLostTrig(every, 20);
/* Triggers: Briefing */
trigger vidEndTrig(CALL_VIDEO_QUIT);
//trigger obj1Trig(droidInRange(player, 5440, 2752, 5*128), 20);
trigger obj1Trig(numStructsButNotWallsInArea(enemy2, 3520, 1728, 6976, 5056) == 0, 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);
trigger art5TakeTrig(droidInRange(player, art5X, art5Y, 171), 5);
trigger art5PlaceTrig((art5Get==NULLOBJECT), 5);
*/
trigger art6TakeTrig(droidInRange(player, art6X, art6Y, 171), 5);
trigger art6PlaceTrig((art6Get==NULLOBJECT), 5);
trigger art7TakeTrig(droidInRange(player, art7X, art7Y, 171), 5);
trigger art7PlaceTrig((art7Get==NULLOBJECT), 5);
/* Triggers: Enemy */
//trigger enm1SeenTrig(droidHasSeen(enm1See, player), 5);
trigger enm1SeenTrig(seenStructInArea(player, enemy1, FALSE, 2240, 192, 4160, 1728), 10);
trigger enm1DeadTrig(numStructsButNotWallsInArea(enemy1, 2240, 192, 4160, 1728) == 0, 20);
//trigger enm2SeenTrig(droidHasSeen(enm2See, player), 5);
trigger enm2SeenTrig(seenStructInArea(player, enemy1, FALSE, 3392, 6848, 4928, 8000), 10);
trigger enm2DeadTrig(numStructsButNotWallsInArea(enemy1, 3392, 6848, 4928, 8000) == 0, 20);
//trigger enm3SeenTrig(droidHasSeen(enm3See, player), 5);
trigger enm3SeenTrig(seenStructInArea(player, enemy1, FALSE, 5056, 6592, 6464, 8000), 10);
trigger enm3DeadTrig(numStructsButNotWallsInArea(enemy1, 5056, 6592, 6464, 8000) == 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 enm2aStartTrig(droidInRange(player,enm2a.x, enm2a.y, 15*128),20);
trigger enm2aFactTrig(every,300);
trigger enm2bStartTrig(droidInRange(player,enm2b.x, enm2b.y, 15*128),20);
trigger enm2bFactTrig(every,300);
trigger enm2cStartTrig(droidInRange(player,enm2c.x, enm2c.y, 15*128),20);
trigger enm2cFactTrig(every,300);
trigger buildTrig(every, 30);
/* transport triggers */
trigger landTransTrig(every, 3000); //5min delay
trigger landTransTrig2(wait, 100); //10 second delay
trigger stopTransTrig(numStructsButNotWallsInArea(enemy2, 5824, 2240, 6592, 3008) == 0, 20);
trigger groupTransTrig(CALL_TRANSPORTER_LANDED, enemy2Build, enemy2);
//LZ contains enemies?
trigger LZNoGoTrig((objectInArea(enemy1, 0, 6400, 1536, 7936)) or
(objectInArea(enemy2, 0, 6400, 1536, 7936)), 35);
//LZ clear of enemies?
trigger LZ_OKTrig((not objectInArea(enemy1, 0, 6400, 1536, 7936)) and
(not objectInArea(enemy2, 0, 6400, 1536, 7936)), 35);
/* Events: Start */
event landTrans;
event stopTrans;
event LZNoGo;
event LZ_OK;
event startEvnt(CALL_GAMEINIT)
{
centreViewPos(6*128, 56*128);
//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(5, 55, 7, 57);
//call in transport
//flyTransporterIn(player, entryX, entryY, false);
flyTransporterIn(player, 62, 33, true); //fly over enemy base
setTransporterExit(player, exitX, exitY);
//add enemy transport (once!)
setNoGoArea(47, 19, 49, 21, enemy2);
transportDroid = addDroidToMissionList(transporter, enemy2);
attackX = 768; //to attack LZ
attackY = 7168;
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);
//set transport time
setReinforcementTime(ReinforceTime);
// 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;
}
//Give Briefing (again!)
setEventTrigger(startEvnt, inactive);
addMessage(MissionBrief, MISS_MSG, 0, false);
flashOff(INTELMAP);
}
/* Events: Artifacts */
event art1TakeEvnt(inactive)
{
numart=numart+1;
//playSound(art1Snd2, player);
playSoundPos(art1Snd2, player, art1ID.x, art1ID.y, art1ID.z);
destroyFeature(art1ID);
//removeMessage(art1Msg, PROX_MSG, player);
enableResearch(art1Comp, player);
setEventTrigger(art1TakeEvnt, inactive);
}
event art1PlaceEvnt(art1PlaceTrig)
{
//place artifact crate, and allow check for prox
art1ID=addFeature(crate, art1X, art1Y);
//setEventTrigger(art1SeenEvnt, art1SeenTrig);
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);
//removeMessage(art2Msg, PROX_MSG, player);
enableResearch(art2Comp, player);
setEventTrigger(art2TakeEvnt, inactive);
}
event art2PlaceEvnt(art2PlaceTrig)
{
//place artifact crate, and allow check for prox
art2ID=addFeature(crate, art2X, art2Y);
//setEventTrigger(art2SeenEvnt, art2SeenTrig);
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);
//removeMessage(art3Msg, PROX_MSG, player);
enableResearch(art3Comp, player);
setEventTrigger(art3TakeEvnt, inactive);
}
event art3PlaceEvnt(art3PlaceTrig)
{
//place artifact crate, and allow check for prox
art3ID=addFeature(crate, art3X, art3Y);
//setEventTrigger(art3SeenEvnt, art3SeenTrig);
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);
//removeMessage(art4Msg, PROX_MSG, player);
enableResearch(art4Comp, player);
setEventTrigger(art4TakeEvnt, inactive);
}
event art4PlaceEvnt(art4PlaceTrig)
{
//place artifact crate, and allow check for prox
art4ID=addFeature(crate, art4X, art4Y);
//setEventTrigger(art4SeenEvnt, art4SeenTrig);
setEventTrigger(art4TakeEvnt, art4TakeTrig);
setEventTrigger(art4PlaceEvnt, inactive);
}
event art5TakeEvnt(inactive)
{
numart=numart+1;
//playSound(art5Snd2, player);
playSoundPos(art5Snd2, player, art5ID.x, art5ID.y, art5ID.z);
destroyFeature(art5ID);
//removeMessage(art5Msg, PROX_MSG, player);
enableResearch(art5Comp, player);
setEventTrigger(art5TakeEvnt, inactive);
}
event art5PlaceEvnt(art5PlaceTrig)
{
//place artifact crate, and allow check for prox
art5ID=addFeature(crate, art5X, art5Y);
//setEventTrigger(art5SeenEvnt, art5SeenTrig);
setEventTrigger(art5TakeEvnt, art5TakeTrig);
setEventTrigger(art5PlaceEvnt, inactive);
}
*/
event art6TakeEvnt(inactive)
{
numart=numart+1;
//playSound(art6Snd2, player);
playSoundPos(art6Snd2, player, art6ID.x, art6ID.y, art6ID.z);
destroyFeature(art6ID);
//removeMessage(art6Msg, PROX_MSG, player);
enableResearch(art6Comp, player);
setEventTrigger(art6TakeEvnt, inactive);
}
event art6PlaceEvnt(art6PlaceTrig)
{
//place artifact crate, and allow check for prox
art6ID=addFeature(crate, art6X, art6Y);
//setEventTrigger(art6SeenEvnt, art6SeenTrig);
setEventTrigger(art6TakeEvnt, art6TakeTrig);
setEventTrigger(art6PlaceEvnt, inactive);
}
event art7TakeEvnt(inactive)
{
numart=numart+1;
//playSound(art7Snd2, player);
playSoundPos(art7Snd2, player, art7ID.x, art7ID.y, art7ID.z);
destroyFeature(art7ID);
//removeMessage(art7Msg, PROX_MSG, player);
enableResearch(art7Comp, player);
setEventTrigger(art7TakeEvnt, inactive);
}
event art7PlaceEvnt(art7PlaceTrig)
{
//place artifact crate, and allow check for prox
art7ID=addFeature(crate, art7X, art7Y);
//setEventTrigger(art7SeenEvnt, art7SeenTrig);
setEventTrigger(art7TakeEvnt, art7TakeTrig);
setEventTrigger(art7PlaceEvnt, inactive);
}
/* Events: Enemies */
event enm1DeadEvnt(inactive)
{
killStructsInArea(enemy1, REF_WALL, 2240, 192, 4160, 1728, TRUE, TRUE); //remove walls and features in base
killStructsInArea(enemy1, REF_WALLCORNER, 2240, 192, 4160, 1728, TRUE, FALSE); //remove corner walls in base
removeMessage(enm1Msg, PROX_MSG, player);
//playSound(enm1Snd2, player);
playSoundPos(enm1Snd2, player, 3264, 704, 0);
setEventTrigger(enm1DeadEvnt, inactive);
}
event enm1SeenEvnt(enm1SeenTrig)
{
addMessage(enm1Msg, PROX_MSG, player, false);
//playSound(enm1Snd1, player);
playSoundPos(enm1Snd1, player, 3264, 704, 0);
setEventTrigger(enm1DeadEvnt, enm1DeadTrig);
setEventTrigger(enm1SeenEvnt, inactive);
}
event enm2DeadEvnt(inactive)
{
killStructsInArea(enemy1, REF_WALL, 3392, 6848, 4928, 8000, TRUE, TRUE); //remove walls and features in base
killStructsInArea(enemy1, REF_WALLCORNER, 3392, 6848, 4928, 8000, TRUE, FALSE); //remove corner walls in base
removeMessage(enm2Msg, PROX_MSG, player);
//playSound(enm2Snd2, player);
playSoundPos(enm2Snd2, player, 4160, 7616, 0);
setEventTrigger(enm2DeadEvnt, inactive);
}
event enm2SeenEvnt(enm2SeenTrig)
{
addMessage(enm2Msg, PROX_MSG, player, false);
//playSound(enm2Snd1, player);
playSoundPos(enm2Snd1, player, 4160, 7616, 0);
setEventTrigger(enm2DeadEvnt, enm2DeadTrig);
setEventTrigger(enm2SeenEvnt, inactive);
}
event enm3DeadEvnt(inactive)
{
killStructsInArea(enemy1, REF_WALL, 5056, 6592, 6464, 8000, TRUE, TRUE); //remove walls and features in base
killStructsInArea(enemy1, REF_WALLCORNER, 5056, 6592, 6464, 8000, TRUE, FALSE); //remove corner walls in base
removeMessage(enm3Msg, PROX_MSG, player);
//playSound(enm3Snd2, player);
playSoundPos(enm3Snd2, player, 5696, 7488, 0);
setEventTrigger(enm3DeadEvnt, inactive);
}
event enm3SeenEvnt(enm3SeenTrig)
{
addMessage(enm3Msg, PROX_MSG, player, false);
//playSound(enm3Snd1, player);
playSoundPos(enm3Snd1, player, 5696, 7488, 0);
setEventTrigger(enm3DeadEvnt, enm3DeadTrig);
setEventTrigger(enm3SeenEvnt, inactive);
}
event enm4DeadEvnt(obj1Trig)
{
killStructsInArea(enemy2, REF_WALL, 3520, 1728, 6976, 5056, TRUE, TRUE); //remove walls and features in base
killStructsInArea(enemy2, REF_WALLCORNER, 3520, 1728, 6976, 5056, TRUE, FALSE); //remove corner walls in base
removeMessage(obj1, PROX_MSG, player);
//playSound(enm2Snd2, player); //what to play?
playSoundPos(enm4Snd2, player, 5440, 2752, 0);
setEventTrigger(enm4DeadEvnt, inactive);
}
/* No blip given for NP Base? Objective blip
event enm2DeadEvnt(inactive)
{
if (not anyStructButWallsLeft(enemy2))
{
removeMessage(enm2Msg, PROX_MSG, player);
playSound(enm2Snd2, player);
setEventTrigger(enm2DeadEvnt, inactive);
}
}
event enm2SeenEvnt(enm2SeenTrig) //base 2 seen
{
addMessage(enm2Msg, PROX_MSG, player, false);
playSound(enm2Snd1, player);
setEventTrigger(enm2DeadEvnt, enm2DeadTrig);
setEventTrigger(enm2SeenEvnt, inactive);
}
*/
event wonYetEvnt;
event timeUp;
/* Events: Win or Lose */
event nextLevEvnt(inactive) //assumes victory already checked
{
pause(20);
// 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);
enableResearch(art2Comp, player);
//enableResearch(art3Comp, player);
//enableResearch(art4Comp, player);
//enableResearch(art5Comp, player);
enableResearch(art6Comp, player);
enableResearch(art7Comp, player);
//removeMessage(MissionBrief, MISS_MSG, player);
startMission(CAMP_EXPAND, 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 (numart==4) // a victory condition
{
setEventTrigger(lostYetEvnt, inactive);
setEventTrigger(timeUp, 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(winLoseTrig)
{
if (numart==1)
{
//add LZ blip and WAV message
//addMessage(LZ_MSG, PROX_MSG, player, false);
addConsoleText(RetLZMsg, player);
playSound(LZSnd, player);
setEventTrigger(retLZ, inactive);
}
}
*/
/*
event removeObj1(obj1Trig)
{
removeMessage(obj1, PROX_MSG, player);
setEventTrigger(removeObj1, inactive);
}
*/
/* AI EVENTS */
// event prototypes
//event enemy1AttackBase;
event startup(CALL_GAMEINIT)
{
//setass here since factory may be dead if done later!!!
setAssemblyPoint (enm1a, 3136, 1600);
setAssemblyPoint (enm1b, 4928, 7488); //6336, 7616);
setAssemblyPoint (enm1c, 6336, 7616);
//setAssemblyPoint (enm2a, 12736, 14016);
//setAssemblyPoint (enm2b, 12736, 14016);
//setAssemblyPoint (enm2c, 12736, 14016);
//make up starting forces
/*
//See if have to set for whole army first?
setRetreatForce(enemy1, 99);
setRetreatLeadership(enemy1, 50);
setRetreatPoint(enemy1, 6*128, 56*128);
*/
//set up Scavenger forces
groupAddArea(Scav1, enemy1, 320, 3776, 576, 4288);
groupAddArea(Scav2, enemy1, 320, 2240, 576, 2880);
groupAddArea(Scav3, enemy1, 2240, 6336, 2752, 6848);
groupAddArea(NewP1, enemy2, 3769, 4404, 3924, 4681);
groupAddArea(NewP2, enemy2, 4130, 4410, 4302, 4673);
//Set Retreat levels!!!
setGroupRetreatForce(Scav1, 90);
setGroupRetreatLeadership(Scav1, 25);
setGroupRetreatPoint(Scav1, 2368, 320);
setGroupRetreatForce(Scav2, 90);
setGroupRetreatLeadership(Scav2, 25);
setGroupRetreatPoint(Scav2, 2368, 320);
setGroupRetreatForce(Scav3, 90);
setGroupRetreatLeadership(Scav3, 25);
setGroupRetreatPoint(Scav3, 4288, 6592);
}
// 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, attackX, attackY);
}
}
// deal with a droid being built by enemy2
event enemy2build(CALL_NEWDROID, enemy2, ref newDroid, ref newDroidFactory)
{
groupAddDroid(enemy2Build, newDroid);
if (enemy2Build.members >= 4)
{
if (enemy2Guard.members < 6)
{
groupAddGroup(enemy2Guard, enemy2Build);
setGroupSecondary(enemy2Guard, DSO_REPAIR_LEVEL, DSS_REPLEV_HIGH); //set repair level
}
else
{
groupAddGroup(enemy2Attack, enemy2Build);
//do attack force decision here!
orderGroupLoc(enemy2Attack, DORDER_SCOUT, attackX, attackY);
setGroupSecondary(enemy2Attack, DSO_REPAIR_LEVEL, DSS_REPLEV_HIGH); //set repair level
}
}
}
/* events for build lists start here */
/* Enemy 1 Scavengers*/
//build list Scav North 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 SE 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);
}
//build list Scav SW Factory
event enm1cFactEvnt(inactive)
{
enm1cDestroyed = buildingDestroyed (enm1cID, enemy1);
if (enm1cDestroyed)
{
setEventTrigger(enm1cFactEvnt, inactive);
}
else if (structureIdle(enm1c) and (enemy1Build.members+enemy1Attack.members)<enemy1Tot)
{
if (enm1cState == 0)
{
buildDroid (template1[7], enm1c, enemy1, 1);
enm1cState = 1;
}
else if (enm1cState== 1)
{
buildDroid (template1[5], enm1c, enemy1, 1);
enm1cState = 2;
}
else if (enm1cState == 2)
{
buildDroid (template1[0], enm1c, enemy1, 3);
enm1cState = 3;
}
else
{
buildDroid (template1[2], enm1c, enemy1, 3);
enm1cState = 0;
}
}
}
event enm1cStartEvnt(enm1cStartTrig)
{
setEventTrigger(enm1cFactEvnt, enm1cFactTrig);
setEventTrigger(enm1cStartEvnt, inactive);
}
/* New paradigm Factories */
//build list NP Heavy factory!
event enm2aFactEvnt(inactive)
{
enm2aDestroyed = buildingDestroyed (enm2aID, enemy2);
if (enm2aDestroyed)
{
setEventTrigger(enm2aFactEvnt, inactive);
if (not transFlag) //call in transport!
{
setEventTrigger(landTrans, landTransTrig2);
setEventTrigger(stopTrans, stopTransTrig);
}
}
else if (structureIdle(enm2a) and (enemy2Build.members+enemy2Attack.members)<enemy2Tot)
{
if (enm2aState == 0)
{
buildDroid (template2[4], enm2a, enemy2, 3);
enm2aState = 1;
}
else if (enm2aState== 1)
{
buildDroid (template2[2], enm2a, enemy2, 2);
enm2aState = 2;
}
else if (enm2aState == 2)
{
buildDroid (template2[5], enm2a, enemy2, 1);
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, 50) //start producing soon after start of mission
{
setEventTrigger(enm2aFactEvnt, enm2aFactTrig);
setEventTrigger(enm2aStartEvnt, inactive);
}
//build list NP Heavy factory!
event enm2bFactEvnt(inactive)
{
enm2bDestroyed = buildingDestroyed (enm2bID, enemy2);
if (enm2bDestroyed)
{
setEventTrigger(enm2bFactEvnt, inactive);
if (not transFlag) //call in transport!
{
setEventTrigger(landTrans, landTransTrig2);
setEventTrigger(stopTrans, stopTransTrig);
}
}
else if (structureIdle(enm2b) and (enemy2Build.members+enemy2Attack.members)<enemy2Tot)
{
if (enm2bState == 0)
{
buildDroid (template2[0], enm2b, enemy2, 3);
enm2bState= 1;
}
else if (enm2bState== 1)
{
buildDroid (template2[6], enm2b, enemy2, 2);
enm2bState = 2;
}
else if (enm2bState == 2)
{
buildDroid (template2[8], enm2b, enemy2, 1);
enm2bState = 0;
}
else
{
buildDroid (template2[3], enm2b, enemy2, 3);
enm2bState= 0;
}
}
}
event enm2bStartEvnt(wait, 50) //start producing soon after start of mission
{
setEventTrigger(enm2bFactEvnt, enm2bFactTrig);
setEventTrigger(enm2bStartEvnt, inactive);
}
//build list NP cyborg Factory
event enm2cFactEvnt(inactive)
{
enm2cDestroyed = buildingDestroyed (enm2cID, enemy2);
if (enm2cDestroyed)
{
setEventTrigger(enm2cFactEvnt, inactive);
if (not transFlag) //call in transport!
{
setEventTrigger(landTrans, landTransTrig2);
setEventTrigger(stopTrans, stopTransTrig);
}
}
else if (structureIdle(enm2c) and (enemy2Build.members+enemy2Attack.members)<enemy2Tot)
{
if (enm2cState == 0)
{
buildDroid (template3[0], enm2c, enemy2, 3);
enm2cState= 1;
}
else if (enm2cState== 1)
{
buildDroid (template3[1], enm2c, enemy2, 3);
enm2cState = 0;
}
}
}
event enm2cStartEvnt(enm2cStartTrig)
{
setEventTrigger(enm2cFactEvnt, enm2cFactTrig);
setEventTrigger(enm2cStartEvnt, 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);
}
}
//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)
{
if (hitStruc!=NULLOBJECT)
{
//find at least 6 vehicles to defend structure first
tempx2 = 1 * 128;
//groupAddGroup(enemy2Attack, enemy2Guard); //empty the group first (into attack group!)
//don't bother emptying in case of NP for this map
while ((enemy2Guard.members < 6) and (tempx2 <= 2560))
{
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!!!
}
setGroupSecondary(enemy2Guard, DSO_REPAIR_LEVEL, DSS_REPLEV_HIGH); //set repair level
if (attackerObj != NULLOBJECT)
{
//attack attacker (if he exists)!!
//orderGroupObj(enemy2Guard, DORDER_ATTACK, attackerObj);
//go to his location instead! (more likely to find him, and don't give up so easily!
orderGroupLoc(enemy2Guard, DORDER_SCOUT, attackerObj.x, attackerObj.y);
}
else
{
//defend structure!!
orderGroupLoc(enemy2Guard, DORDER_SCOUT, hitStruc.x, hitStruc.y);
}
}
}
/* Transports */
/* group landed enemy units and get going! */
event groupTrans(inactive)
{
//playSound(warnSnd, player);
playSoundPos(warnSnd, player, 48 * 128, 20 * 128, 0); //setNoGoArea(47, 19, 49, 21, enemy2);
//pause(10);
if (enemy2Build.members >= 4)
{
if (enemy2Guard.members < 6)
{
groupAddGroup(enemy2Guard, enemy2Build);
}
else
{
groupAddGroup(enemy2Attack, enemy2Build);
//do attack force decision here!
orderGroupLoc(enemy2Attack, DORDER_SCOUT, attackX, attackY);
}
}
setEventTrigger(groupTrans, inactive);
}
event landTrans(inactive)
{
//don't trigger if haven't got one!
//transFlag = TRUE;
//transportDroid = addDroidToMissionList(transporter, enemy2);
temp1 = 1 + random(5); //range 1 to 5
temp2 = 8 - temp1; //make rest upto 8
count =0;
//can only add units to the Transporter if it exists!
if (transportDroid != NULLOBJECT)
{
transFlag = TRUE;
while (count < temp1)
{
reinforceTemplate = scout[random(numScout)]; //random selection of scouts
loadDroid = addDroidToMissionList(reinforceTemplate, enemy2);
if (loadDroid != NULLOBJECT)
{
addDroidToTransporter(transportDroid, loadDroid);
}
count = count + 1;
}
reinforceTemplate = heavy[random(numHeavy)]; //use same selection for all heavies
count =0;
while (count < temp2)
{
loadDroid = addDroidToMissionList(reinforceTemplate, enemy2);
if (loadDroid != NULLOBJECT)
{
addDroidToTransporter(transportDroid, loadDroid);
}
count = count + 1;
}
//call in transport
setTransporterExit(1, 42, 1);
flyTransporterIn(1, 62, 14, false);
setEventTrigger(groupTrans, groupTransTrig);
setEventTrigger(landTrans, landTransTrig); //5 mins until next one
}
else
{
//if couldn't build a transporter at the start of the mission - no point having this event called!
setEventTrigger(landTrans, inactive);
}
}
event stopTrans(inactive)
{
setEventTrigger(landTrans, inactive); //stop transport landing
setEventTrigger(stopTrans, 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, 768, 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, 768, 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;
}