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

1259 lines
34 KiB
Plaintext

// SCRIPT file for Cam 1-3
/* General Values */
public int player;
public int enemy1;
public int enemy2;
private int numart;
public int pow1, pow2, repLev;
private STRUCTURE newDroidFactory;
/* structure limit stuff */
public STRUCTURESTAT factory, research, oilDerrick, powerGen;
//public STRUCTURESTAT powerModuleHack;
public STRUCTURESTAT command;
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 DROID hitDroid;
private BASEOBJ attackerObj, attackedObj;
private int t;
public SOUND attackSnd1;
/* Transport Entry/Exit coords */
public int entryX, entryY, exitX, exitY;
/* Briefing stuff */
public INTMESSAGE MissionBrief;
public INTMESSAGE NewParadigm_MSG1, NewParadigm_MSG2;
public SOUND incomingSnd;
public TEXTSTRING RetLZMsg;
public INTMESSAGE endMsg; //, winMsg;
/* LZ Message */
public INTMESSAGE LZ_MSG;
public SOUND LZSnd, LZComp, LZClear, reinfSnd;
public INTMESSAGE obj1,obj2,obj3,obj4;
public INT ReinforceTime;
private BOOL transOnMap;
/* Proximity: Resources */
/*
public FEATURE res1;
public INTMESSAGE res1Msg;
public SOUND res1Snd;
public STRUCTURESTAT derrick;
private int res1x,res1y; //temp values to cope with oil disappearing!
*/
/* Proximity: Artifacts */
public FEATURESTAT crate;
public int art1X, art1Y;
public STRUCTURE art1Get;
public SOUND art1Snd2;
//public INTMESSAGE art1Msg;
public RESEARCHSTAT art1Comp;
private FEATURE art1ID;
public int art2X, art2Y;
public STRUCTURE art2Get;
public SOUND art2Snd2;
//public INTMESSAGE art2Msg;
public RESEARCHSTAT art2Comp;
private FEATURE art2ID;
public int art3X, art3Y;
public STRUCTURE art3Get;
public SOUND art3Snd2;
//public INTMESSAGE art3Msg;
public RESEARCHSTAT art3Comp;
private FEATURE art3ID;
public int art4X, art4Y;
public STRUCTURE art4Get;
public SOUND art4Snd2;
//public INTMESSAGE art4Msg;
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 enm1;
public STRUCTUREID enm1ID;
public INTMESSAGE enm1Msg;
public SOUND enm1Snd1;
public SOUND enm1Snd2;
public STRUCTURE enm2;
public STRUCTUREID enm2ID;
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 enemy1West, enemy1North, enemy1South, enemy1Hill, enemy1Scout;
private GROUP enemy1Defend, enemy2Defend;
private GROUP scout1, strike1, strike2;
private INT tempx1, tempx2, tempy1, tempy2;
/*
public INT rBlkX,rBlkY;
public INT oilPatchX,oilPatchY;
public INT playerX,playerY;
private BOOL oilWellClear;
*/
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
/* 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 trike;
public TEMPLATE buggy;
public TEMPLATE bloke;
public TEMPLATE jeep;
public TEMPLATE rktJeep;
public TEMPLATE rktBuggy;
public TEMPLATE BugRktP, BugHMG, ScorpMCan;
public DROID scoutDroid;
/* enemy1 */
public int enm1Ass1X, enm1Ass1Y;
public int enm1Ret1X, enm1Ret1Y;
public int enm1Ret2X, enm1Ret2Y;
private int enm1Fact1State;
private bool enm1Fact1Destroyed;
/* enemy2 */
public int enm2Ass1X, enm2Ass1Y, enm2Ass2X, enm2Ass2Y;
public int enm2Ret1X, enm2Ret1Y;
public int enm2Ret2X, enm2Ret2Y;
private int enm2Fact1State, enm2Fact2State;
private bool enm2Fact1Destroyed, enm2Fact2Destroyed;
/* Sectors to check */
/*
public int numBaseSects;
public int baseSectX1[8], baseSectY1[8], baseSectX2[8], baseSectY2[8];
*/
public int numAtk1Sects;
public int atk1SectX1[6], atk1SectY1[6], atk1SectX2[6], atk1SectY2[6];
private int bs, bs1, bsX, bsY, randNum;
private int as, as1, asX, asY, scoutSector;
/* Starting Technology */
public int numtecE1, numtecE2;
public RESEARCHSTAT tecE1[2], tecE2[3];
/* repair stuff */
private GROUP scout1Rep, enemy2GuardRep;
/* Triggers: Win or Lose */
trigger winLoseTrig(every, 5);
trigger gameLostTrig(every, 20);
/* Triggers: Briefing */
trigger vidEndTrig(CALL_VIDEO_QUIT);
trigger obj1Trig(droidInRange(player, 448, 6592, 5*128), 20);
trigger obj2Trig(droidInRange(player, 7616, 7744, 5*128), 20);
trigger obj3Trig(droidInRange(player, 5312, 704, 5*128), 20);
trigger obj4Trig(droidInRange(player, 6848, 3008, 5*128), 20);
/* Triggers: Resource */
/*
trigger res1SeenTrig(droidHasSeen(res1, player), 10);
trigger res1UsedTrig(every, 10);
*/
/* Triggers: Artifacts */
//trigger art1SeenTrig(droidHasSeen(art1ID, player), 5);
trigger art1TakeTrig(droidInRange(player, art1X, art1Y, 171), 5);
trigger art1PlaceTrig((art1Get==NULLOBJECT), 5);
//trigger art2SeenTrig(droidHasSeen(art2ID, player), 5);
trigger art2TakeTrig(droidInRange(player, art2X, art2Y, 171), 5);
trigger art2PlaceTrig((art2Get==NULLOBJECT), 5);
//trigger art3SeenTrig(droidHasSeen(art3ID, player), 5);
trigger art3TakeTrig(droidInRange(player, art3X, art3Y, 171), 5);
trigger art3PlaceTrig((art3Get==NULLOBJECT), 5);
//trigger art4SeenTrig(droidHasSeen(art4ID, player), 5);
trigger art4TakeTrig(droidInRange(player, art4X, art4Y, 171), 5);
trigger art4PlaceTrig((art4Get==NULLOBJECT), 5);
/* Triggers: Enemy */
//trigger enm1SeenTrig(droidHasSeen(enm1, player), 10); //enmWait
//trigger enm1DeadTrig(every, 10); //enmWait
trigger enm1SeenTrig(seenStructInArea(player, enemy1, FALSE, 4416, 4032, 6208, 5184), 10);
trigger enm1DeadTrig(numStructsButNotWallsInArea(enemy1, 4416, 4032, 6208, 5184) == 0, 20);
//trigger enm2SeenTrig(droidInRange(player, 6592, 1856, 1280),10); //enmWait
//trigger enm2DeadTrig(every, 10); //enmWait
trigger enm2SeenTrig(seenStructInArea(player, enemy2, FALSE, 5440, 64, 8000, 3136), 10);
trigger enm2DeadTrig(numStructsButNotWallsInArea(enemy2, 5440, 64, 8000, 3136) == 0, 20);
trigger goGetTrig(wait, 600); //wait 1 min before launching attack anyway!
//LZ contains enemies?
trigger LZNoGoTrig((objectInArea(enemy1, 64, 64, 1344, 1344)) or
(objectInArea(enemy2, 64, 64, 1344, 1344)), 35);
//LZ clear of enemies?
trigger LZ_OKTrig((not objectInArea(enemy1, 64, 64, 1344, 1344)) and
(not objectInArea(enemy2, 64, 64, 1344, 1344)), 35);
/* AI TRIGGERS */
trigger scoutSeenTrig(every, 7);
trigger enemy1AttackPause( every, 3000 ); //5 mins
/* triggers for build lists start here */
/* Triggers: Enemy Tactics */
trigger enm1Start1Trig(droidInRange(player,4544, 4288, 15*128),20);
trigger enm1Fact1Trig(every,400); //used to be 300, slowed for difficulty
trigger enm2Start1Trig(droidInRange(player,6848, 2880, 5*128),10);
trigger enm2Fact1Trig(every,600); //used to be 500, slowed for difficulty
//trigger enm2Fact2Trig(every,500);
//trigger convoyTrig(droidInRange(player, enm1.x, enm1.y, 2000),10);
trigger convNorthTrig(droidInArea(player, 4416, 64, 5952, 1728), 10);
trigger convSouthTrig(droidInArea(player, 5824, 6080, 8000, 8000), 10);
trigger convWestTrig(droidInArea(player, 192, 5568, 2368, 7488), 10);
trigger scoutTrig(every, 50);
trigger heavyTrig(every, 70);
/* Events: Start */
event LZNoGo;
event LZ_OK;
/*
event removeObj1;
event removeObj2;
event removeObj3;
event removeObj4;
*/
event startEvnt(CALL_GAMEINIT)
{
//centreView(enm1); //temporary solution for thin maps
centreViewPos(5*128, 5*128);
//make scavengers and New paradigm allies
createAlliance(enemy1, enemy2);
//set scroll limits
// setScrollParams(0, 0, 64, 64); //limit scroll
//set zoom Level 64x64
setRadarZoom(1);
//set landing zone
setLandingZone(4,4,6,6);
//call in transport
flyTransporterIn(player, entryX, entryY, false);
setTransporterExit(player, exitX, exitY);
//make sure all buttons available/unavailable
//removeReticuleButton(DESIGN);
//removeReticuleButton(BUILD);
addMessage(MissionBrief, MISS_MSG, 0, false);
flashOff(INTELMAP);
//set up resource coords (since oil pools diappear when built on!!!)
//res1x=res1.x;
//res1y=res1.y;
setPowerLevel(pow1, enemy1);
setPowerLevel(pow2, enemy2);
//Blip Given at start
addMessage(obj1, PROX_MSG, player, false);
//addMessage(obj2, PROX_MSG, player, false);
//addMessage(obj3, PROX_MSG, player, false);
//addMessage(obj4, PROX_MSG, player, false);
setEventTrigger(startEvnt, inactive);
//allow to build stuff
setStructureLimits (powerGen,numPow,0);
setStructureLimits (oilDerrick,numExt,0);
setStructureLimits (research,numRes,0);
setStructureLimits (factory,numFac,0);
setStructureLimits(command, 0, player);
enableStructure(command, player);
enableStructure(powerGen,0);
enableStructure(oilDerrick,0);
enableStructure(research,0);
enableStructure(factory,0);
//enableStructure(powerModuleHack, 0);
//set transport time
setReinforcementTime(-1); //not available at start
//setReinforcementTime(ReinforceTime);
//delay before warning message
pause(30);
//message from New Paradigm
//need Warning message here!!!!
playSound(incomingSnd, player);
pause(20);
addMessage(NewParadigm_MSG1, MISS_MSG, 0, true);
}
/*Events: */
/* 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);
}
/* Events: Enemies */
event enm1DeadEvnt(inactive)
{
killStructsInArea(enemy1, REF_WALL, 4416, 4032, 6208, 5184, TRUE, TRUE); //remove walls and features in base
killStructsInArea(enemy1, REF_WALLCORNER, 4416, 4032, 6208, 5184, TRUE, FALSE); //remove corner walls in base
removeMessage(enm1Msg, PROX_MSG, player);
//playSound(enm1Snd2, player);
playSoundPos(enm1Snd2, player, 5376, 4544, 0);
setEventTrigger(enm1DeadEvnt, inactive);
}
event enm1SeenEvnt(enm1SeenTrig)
{
addMessage(enm1Msg, PROX_MSG, player, false);
//playSound(enm1Snd1, player);
playSoundPos(enm1Snd1, player, 5376, 4544, 0);
//allow reinforcements now base found
setReinforcementTime(ReinforceTime);
playSound(reinfSnd, player);
//setup checks for LZ
setEventTrigger(LZNoGo, LZNoGoTrig);
//setEventTrigger(LZ_OK,LZ_OKTrig);
setEventTrigger(enm1DeadEvnt, enm1DeadTrig);
setEventTrigger(enm1SeenEvnt, inactive);
}
event enm2DeadEvnt(inactive)
{
killStructsInArea(enemy2, REF_WALL, 5440, 64, 8000, 3136, TRUE, TRUE); //remove walls and features in base
killStructsInArea(enemy2, REF_WALLCORNER, 5440, 64, 8000, 3136, TRUE, FALSE); //remove corner walls in base
removeMessage(enm2Msg, PROX_MSG, player);
//playSound(enm2Snd2, player);
playSoundPos(enm2Snd2, player, 6592, 1856, 0);
setEventTrigger(enm2DeadEvnt, inactive);
}
event enm2SeenEvnt(enm2SeenTrig) //base 2 seen
{
addMessage(enm2Msg, PROX_MSG, player, false);
//playSound(enm2Snd1, player);
playSoundPos(enm2Snd1, player, 6592, 1856, 0);
//allow reinforcements now base found
setReinforcementTime(ReinforceTime);
//setup checks for LZ
setEventTrigger(LZNoGo, LZNoGoTrig);
//setEventTrigger(LZ_OK,LZ_OKTrig);
setEventTrigger(enm2DeadEvnt, enm2DeadTrig);
setEventTrigger(enm2SeenEvnt, inactive);
}
event wonYetEvnt;
//event wonYetLZEvnt;
event timeUp;
/* Events: Win or Lose */
event nextLevEvnt(inactive) //assumes victory already checked
{
flushConsoleMessages();
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(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))
{
/* Don't bother with killing all scavs
if (not anyDroidsLeft(enemy1))
{
if (not anyStructButWallsLeft(enemy1))
{
*/
if (numart==4) // a victory condition
{
setEventTrigger(lostYetEvnt, inactive);
setEventTrigger(timeUp, inactive);
setEventTrigger(nextLevEvnt, winLoseTrig);
setEventTrigger(wonYetEvnt, inactive);
//setEventTrigger(wonYetLZEvnt, inactive);
}
/*
}
}
*/
}
}
}
/* No getting to LZ now (kill all NP)
event wonYetLZEvnt(winLoseTrig) //alternate victory condition, got artifact(s) and back at LZ
{
totDroids = numDroidsInArea(player, 0, 0, 64*128, 64*128);
if (totDroids == numDroidsInArea(player, 1*128, 1*128, 10*128, 10*128))
{
if (totDroids!=0)
{
if (numart==4)
{
setEventTrigger(lostYetEvnt, inactive);
setEventTrigger(timeUp, inactive);
setEventTrigger(nextLevEvnt, winLoseTrig);
setEventTrigger(wonYetEvnt, inactive);
setEventTrigger(wonYetLZEvnt, 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==4)
{
//add LZ blip and WAV message
addMessage(LZ_MSG, PROX_MSG, player, false);
addConsoleText(RetLZMsg, player);
//playSound(LZSnd, player);
playSoundPos(LZSnd, player, 704, 704, 0);
setEventTrigger(retLZ, inactive);
}
}
*/
event removeObj1(obj1Trig)
{
removeMessage(obj1, PROX_MSG, player);
//addMessage(obj2, PROX_MSG, player, false);
//playSound(enm1Snd1, player);
//setEventTrigger(removeObj2, obj2Trig);
setEventTrigger(removeObj1, inactive);
}
/*
event removeObj2(inactive)
{
removeMessage(obj2, PROX_MSG, player);
addMessage(obj3, PROX_MSG, player, false);
playSound(enm1Snd1, player);
//now allow reinforcements (may want extra briefing?)
setReinforcementTime(ReinforceTime);
setEventTrigger(removeObj3, obj3Trig);
setEventTrigger(removeObj2, inactive);
}
event removeObj3(inactive)
{
removeMessage(obj3, PROX_MSG, player);
addMessage(obj4, PROX_MSG, player, false);
playSound(enm1Snd1, player);
setEventTrigger(removeObj4, obj4Trig);
setEventTrigger(removeObj3, inactive);
}
event removeObj4(inactive)
{
removeMessage(obj4, PROX_MSG, player);
setEventTrigger(removeObj4, inactive);
}
*/
/* AI EVENTS */
// event prototypes
//event enemy1AttackBase;
event scavHit;
event enemy1NConvoy;
event enemy1WConvoy;
event enemy1SConvoy;
event heavySector;
event scoutAtkSector;
event startup(CALL_GAMEINIT)
{
//setass here since factory may be dead if done later!!!
setAssemblyPoint (enm1, enm1Ass1X, enm1Ass1Y);
setAssemblyPoint (enm2, enm2Ass1X, enm2Ass1Y);
//setAssemblyPoint (enm22, enm2Ass2X, enm2Ass2Y);
//set up of positions now done in VLO
//make scavengers allies
createAlliance(enemy1, enemy2);
// whether the oil well has been cleared
//oilWellClear = FALSE;
//set starting power
setPowerLevel(200,enemy1);
setPowerLevel(200,enemy2);
ld=75; //enemy2 leadership (change to higher when fixed!)
//make up starting forces
groupAddArea(enemy1West, enemy1, 704, 6336, 1344, 6848); // 128, 6144, 2048, 7040);
groupAddArea(enemy1Scout, enemy1, 576, 6336, 832, 6848);
groupAddArea(enemy1North, enemy1, 4928, 448, 5824, 1728); //4800, 192, 5824, 3008);
groupAddArea(enemy1South, enemy1, 6464, 6976, 7616, 7872); //6400, 6784, 7680, 7808);
groupAddArea(enemy1Hill, enemy1, 4096, 4224, 4480, 4480);
setGroupSecondary(enemy1Hill, DSO_HALTTYPE, DSS_HALT_HOLD); //hold position
//groupAddArea(enemy1Force1, enemy1, 4288, 9024, 5568, 9920);
//groupAddArea(enemy1Force2, enemy1, 1600, 10048, 2624, 10816);
groupAddArea(scout1, enemy2, 6336, 1984, 6848, 2240);
groupAddArea(enemy2Guard, enemy2, 6720, 1600, 7232, 1984);
//set retreat point
setRetreatPoint(enemy1, enm1Ret1X, enm1Ret1Y); //retreat to road block
setRetreatForce(enemy1, 90); //set morale to 10%
setRetreatLeadership(enemy1, 50); //set leadership chance (small=more likely?)
//set retreat point enemy2
setRetreatPoint(enemy2, enm2Ret1X, enm2Ret1Y); //retreat to base2
setRetreatForce(enemy2, 75); //set morale to 25%
setRetreatLeadership(enemy2, ld); //set leadership chance (small=more likely?)
// 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;
}
}
// 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
}
}
// deal with a droid being built by enemy2
event enemy2build(CALL_NEWDROID, enemy2, ref newDroid,ref newDroidFactory)
{
if (enemy2Guard.members < 6)
{
groupAddDroid(enemy2Guard, newDroid);
}
if ((scout1.members < 4) and (enm2Fact1State > 0)) //RktP or HMG
{
groupAddDroid(scout1, newDroid);
setGroupRetreatForce(scout1, 80); //set morale to 10%
setGroupRetreatLeadership(scout1, 0); //set leadership chance (small=more likely?)
setGroupRetreatPoint(scout1, enm2Ret1X, enm2Ret1Y); //retreat to base2
}
else if ((strike1.members < 6) and (enm2Fact1State == 0)) //MCan
{
groupAddDroid(strike1, newDroid);
}
else if (strike2.members < 6)
{
groupAddDroid(strike2, newDroid);
}
else
{
groupAddDroid(enemy2Build, newDroid);
randNum = random(10);
if ((enemy2Build.members >= 4) and (randNum < 5))
{
groupAddGroup(strike1, enemy2Build);
}
else if ((enemy2Build.members >= 4) and (randNum >= 5))
{
groupAddGroup(strike2, enemy2Build);
}
}
}
/* events for build lists start here */
/* Enemy 1 */
//build list
event enm1Fact1Evnt(inactive)
{
enm1Fact1Destroyed = buildingDestroyed (enm1ID, enemy1);
if (enm1Fact1Destroyed)
{
setEventTrigger(enm1Fact1Evnt, inactive);
}
else if (structureIdle(enm1) and (enemy1Build.members+enemy1Attack.members)<enemy1Tot)
{
if (enm1Fact1State == 0)
{
buildDroid (rktBuggy, enm1, enemy1, 1);
enm1Fact1State = 1;
}
else if (enm1Fact1State == 1)
{
buildDroid (bloke, enm1, enemy1, 3);
enm1Fact1State = 2;
}
else if (enm1Fact1State == 2)
{
buildDroid (rktJeep, enm1, enemy1, 1);
enm1Fact1State = 3;
}
else
{
buildDroid (buggy, enm1, enemy1, 1);
enm1Fact1State = 0;
}
}
}
event enm1Start1Evnt(enm1Start1Trig)
{
enm1Fact1Destroyed = buildingDestroyed (enm1ID, enemy1);
if (not enm1Fact1Destroyed)
{
buildDroid (rktJeep, enm1, enemy1, 1); //build first ones so AI triggered
setEventTrigger(enm1Fact1Evnt, enm1Fact1Trig);
}
setEventTrigger(enm1Start1Evnt, inactive);
}
/* Enemy 2 */
//build list
event enm2Fact1Evnt(inactive)
{
enm2Fact1Destroyed = buildingDestroyed (enm2ID, enemy2);
if (enm2Fact1Destroyed)
{
setEventTrigger(enm2Fact1Evnt, inactive);
}
else if (structureIdle(enm2) and (numDroidsInArea(enemy2, 0, 0, 64*128, 64*128))<enemy2Tot)
{
if (enm2Fact1State == 0)
{
buildDroid (BugRktP, enm2, enemy2, 2);
enm2Fact1State = 1;
}
else if (enm2Fact1State == 1)
{
buildDroid (BugHMG, enm2, enemy2, 2);
enm2Fact1State = 2;
}
else if (enm2Fact1State == 2)
{
buildDroid (ScorpMCan, enm2, enemy2, 1);
enm2Fact1State = 0;
}
else
{
buildDroid (ScorpMCan, enm2, enemy2, 2);
enm2Fact1State = 0;
}
}
}
/*
//build list
event enm2Fact2Evnt(inactive)
{
enm2Fact2Destroyed = buildingDestroyed (enm22ID, enemy2);
if (enm2Fact2Destroyed)
{
setEventTrigger(enm2Fact2Evnt, inactive);
}
else if (structureIdle(enm22) and (numDroidsInArea(enemy2, 0, 0, 64*128, 64*128))<enemy2Tot)
{
//use enm2Fact1State to control both factories (otherwise don't know what has been built!)
if (enm2Fact1State == 0)
{
buildDroid (BugRktP, enm22, enemy2, 2);
}
else if (enm2Fact1State == 1)
{
buildDroid (BugHMG, enm22, enemy2, 2);
}
else if (enm2Fact1State == 2)
{
buildDroid (ScorpMCan, enm22, enemy2, 1);
}
else
{
buildDroid (ScorpMCan, enm22, enemy2, 2);
}
}
}
*/
//New Paradigm Base or droids attacked: Give warning and start production
//event enm2Start1Evnt(enm2Start1Trig)
event enm2Start1Evnt(CALL_ATTACKED, enemy2, ref attackedObj, ref attackerObj)
{
//disable other trigger??????????
//setEventTrigger(scavHit, inactive);
//start NP factory working
enm2Fact1Destroyed = buildingDestroyed (enm2ID, enemy2);
if (not enm2Fact1Destroyed)
{
//build first ones to Trigger AI
buildDroid (BugRktP, enm2, enemy2, 1);
}
//get defence force to block gate
//orderGroupLoc(enemy2Guard, DORDER_SCOUT, enm2Ass1X, enm2Ass1Y);
//warning of incoming message
playSound(incomingSnd, player);
pause(20);
//message from New Paradigm
addMessage(NewParadigm_MSG2, MISS_MSG, 0, true);
//allow reinforcements (unneccessary?)
//setReinforcementTime(ReinforceTime);
setEventTrigger(enm2Fact1Evnt, enm2Fact1Trig);
//setEventTrigger(enm2Fact2Evnt, enm2Fact2Trig);
setEventTrigger(scoutAtkSector, scoutTrig);
setEventTrigger(heavySector, heavyTrig);
setEventTrigger(enm2Start1Evnt, inactive);
}
event enemy1NConvoy(convNorthTrig)
{
//When player nearby, start convoy
orderGroupLoc(enemy1North, DORDER_MOVE, 5184, 5440);
setEventTrigger(enemy1NConvoy, inactive);
}
event enemy1WConvoy(convWestTrig)
{
//When player nearby, start convoy
orderGroupLoc(enemy1West, DORDER_MOVE, 6080, 5312);
setEventTrigger(enemy1WConvoy, inactive);
}
event enemy1SConvoy(convSouthTrig)
{
//When player nearby, start convoy
orderGroupLoc(enemy1South, DORDER_MOVE, 5952, 4288);
setEventTrigger(enemy1SConvoy, inactive);
}
event lastAttack1(every, 50)
{
//make enemy easier to find if all his buildings destroyed
if (not anyStructButWallsLeft(enemy1))
{
groupAddArea(enemy1Fin, enemy1, 0, 0, 64*128, 64*128);
orderGroupLoc(enemy1Fin, DORDER_SCOUT, enm1Ass1X, enm1Ass1Y);
//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*128, 64*128);
orderGroupLoc(enemy2Fin, DORDER_SCOUT, enm2Ass1X, enm2Ass1Y);
//setEventTrigger(lastAttack2, inactive);
}
}
//Scavenger base hit!!! mobilise NP
event scavHit(CALL_STRUCT_ATTACKED, enemy1, ref hitStruc, ref attackerObj)
{
//Now triggered only if player hits Scav Factory)
if (hitStruc == enm1)
{
//set NP building
setEventTrigger(enm2Fact1Evnt, enm2Fact1Trig);
//send New paradigm attack force
orderGroupLoc(scout1, DORDER_SCOUT, enm2Ret2X, enm2Ret2Y);
/* Don't bother reinforcing Scav base with factory production
//set assembly at Scav Base
enm2Fact1Destroyed = buildingDestroyed (enm2ID, enemy2);
if (not enm2Fact1Destroyed)
{
setAssemblyPoint (enm2, enm2Ret2X, enm2Ret2Y);
}
//build first ones to Trigger AI
buildDroid (BugRktP, enm2, enemy2, 1);
*/
setEventTrigger(scavHit, inactive);
}
}
//Generic go investigate nearby structures if under attack!
event enm1Hit(CALL_STRUCT_ATTACKED, enemy1, ref hitStruc, ref attackerObj)
{
//get force nearby
if ((hitStruc!=NULLOBJECT) and (attackerObj!=NULLOBJECT))
{
tempx1=(hitStruc.x) - 1280;
tempy1=(hitStruc.y) - 1280;
tempx2=(hitStruc.x)+1280;
tempy2=(hitStruc.y)+1280;
groupAddArea(enemy1Guard, enemy1, tempx1, tempy1, tempx2, tempy2);
orderGroupLoc(enemy1Guard, DORDER_SCOUT, attackerObj.x, attackerObj.y); // hitStruc.x, hitStruc.y);
}
/*
if (attackerObj!=NULLOBJECT)
{
tempx1=attackerObj.x - 1280;
tempy1=attackerObj.y - 1280;
tempx2=attackerObj.x+1280;
tempy2=attackerObj.y+1280;
groupAddArea(enemy2Guard, enemy2, tempx1, tempy1, tempx2, tempy2);
orderGroupLoc(enemy2Guard, DORDER_SCOUT, attackerObj.x, attackerObj.y);
}
*/
}
event enm2Hit(CALL_STRUCT_ATTACKED, enemy2, ref hitStruc, ref attackerObj)
{
//get force nearby
if ((attackerObj!=NULLOBJECT) and (enemy2Guard.members >= 4))
{
/* messing up groups too much!
tempx1=hitStruc.x - 1280;
tempy1=hitStruc.y - 1280;
tempx2=hitStruc.x+1280;
tempy2=hitStruc.y+1280;
groupAddArea(enemy2Guard, enemy2, tempx1, tempy1, tempx2, tempy2);
*/
orderGroupLoc(enemy2Guard, DORDER_SCOUT, attackerObj.x, attackerObj.y);
}
if (attackerObj!=NULLOBJECT)
{
tempx1=attackerObj.x - 1280;
tempy1=attackerObj.y - 1280;
tempx2=attackerObj.x+1280;
tempy2=attackerObj.y+1280;
groupAddArea(enemy1Guard, enemy1, tempx1, tempy1, tempx2, tempy2);
orderGroupLoc(enemy1Guard, DORDER_SCOUT, attackerObj.x, attackerObj.y);
}
}
//Sector seek and destroy stuff
event scoutAtkSector(inactive)
{
//check all attack areas for enemy
as1 = scoutSector;
if (not (objectInArea(player, atk1SectX1[as1], atk1SectY1[as1], atk1SectX2[as1], atk1SectY2[as1])))
{
//sector clear so use as a retreat point
setGroupRetreatPoint(scout1, scout1.x, scout1.y);
//setGroupRetreatPoint(scout2, scout2.x, scout2.y);
//sector clear so choose another
scoutSector = scoutSector + 1; //keep track of frontline
if (scoutSector >= numAtk1Sects)
{
//out of sectors!
scoutSector = scoutSector - 1;
}
}
//put repaired scout1 droids back in group!
initIterateGroup(scout1Rep);
count = 0;
while (count < scout1Rep.members)
{
hitDroid = iterateGroup(scout1Rep);
if (hitDroid.health >= 99)
{
//go back to group (don't wait for new order)
orderDroidLoc(hitDroid, DORDER_SCOUT, scout1.x, scout1.y);
groupAddDroid(scout1, hitDroid);
}
count = count + 1;
}
setGroupSecondary(scout1, DSO_REPAIR_LEVEL, DSS_REPLEV_LOW); //set repair level
as1 = scoutSector;
if (idleGroup(scout1) > scout1.members / 2)
{
//order scout forces to random position in this sector
asX = atk1SectX1[as1] + random(atk1SectX2[as1] - atk1SectX1[as1]);
asY = atk1SectY1[as1] + random(atk1SectY2[as1] - atk1SectY1[as1]);
orderGroupLoc(scout1, DORDER_SCOUT, asX, asY);
}
/*
asX = atk1SectX1[as1] + random(atk1SectX2[as1] - atk1SectX1[as1]);
asY = atk1SectY1[as1] + random(atk1SectY2[as1] - atk1SectY1[as1]);
orderGroupLoc(scout2, DORDER_SCOUT, asX, asY);
*/
//also want to set previous sector as retreat point!
}
event heavySector(inactive)
{
//order Heavies to previous scouted sector
if (idleGroup(strike1) > strike1.members / 2)
{
as1 = scoutSector;
asX = atk1SectX1[as1] + random(atk1SectX2[as1] - atk1SectX1[as1]);
asY = atk1SectY1[as1] + random(atk1SectY2[as1] - atk1SectY1[as1]);
orderGroupLoc(strike1, DORDER_SCOUT, asX, asY);
}
/* NO IDFs, so ignore
//order IDFs to previous sector
if (as1 > 0)
{
as1 = as1 - 1;
asX = atk1SectX1[as1] + random(atk1SectX2[as1] - atk1SectX1[as1]);
asY = atk1SectY1[as1] + random(atk1SectY2[as1] - atk1SectY1[as1]);
orderGroupLoc(IDF1, DORDER_SCOUT, asX, asY);
asX = atk1SectX1[as1] + random(atk1SectX2[as1] - atk1SectX1[as1]);
asY = atk1SectY1[as1] + random(atk1SectY2[as1] - atk1SectY1[as1]);
orderGroupLoc(IDF2, DORDER_SCOUT, asX, asY);
}
*/
//send random attack force
if (idleGroup(strike2) > strike2.members / 2)
{
as1 = random(numAtk1Sects);
asX = atk1SectX1[as1] + random(atk1SectX2[as1] - atk1SectX1[as1]);
asY = atk1SectY1[as1] + random(atk1SectY2[as1] - atk1SectY1[as1]);
orderGroupLoc(strike2, DORDER_SCOUT, asX, asY);
}
//put repaired droids back in group!
initIterateGroup(enemy2GuardRep);
count = 0;
while (count < enemy2GuardRep.members)
{
hitDroid = iterateGroup(enemy2GuardRep);
if (hitDroid.health >= 99)
{
//go back to group (don't wait for new order)
orderDroidLoc(hitDroid, DORDER_SCOUT, enemy2Guard.x, enemy2Guard.y);
groupAddDroid(enemy2Guard, hitDroid);
}
count = count + 1;
}
setGroupSecondary(enemy2Guard, DSO_REPAIR_LEVEL, DSS_REPLEV_LOW); //set repair level (medium damage)
//if guard force not busy, go home
if ((idleGroup(enemy2Guard) > enemy2Guard.members / 2) or (enemy2Guard.members < 3))
{
orderGroupLoc(enemy2Guard, DORDER_SCOUT, 6208, 1984); //6848, 3264);
}
}
event checkRepair(every, 20)
{
//don't bother if already 4+ in queue
if ((enemy2GuardRep.members + scout1Rep.members) <= 4)
{
//enemy2Guard repair
initIterateGroup(enemy2Guard);
count = 0;
while (count < enemy2Guard.members)
{
hitDroid = iterateGroup(enemy2Guard);
if (hitDroid.order == DORDER_RTR) //if (hitDroid.health <= repLev)
{
orderDroid(hitDroid, DORDER_RTR);
groupAddDroid(enemy2GuardRep, hitDroid);
}
count = count + 1;
}
//scout1 repair
initIterateGroup(scout1);
count = 0;
while (count < scout1.members)
{
hitDroid = iterateGroup(scout1);
if (hitDroid.order == DORDER_RTR) //if (hitDroid.health <= repLev)
{
orderDroid(hitDroid, DORDER_RTR);
groupAddDroid(scout1Rep, hitDroid);
}
count = count + 1;
}
}
}
event goGet(goGetTrig)
{
//send scavenger scouts to player LZ after delay!
orderGroupLoc(enemy1Scout, DORDER_SCOUT, 6*128, 6*128);
/*
setEventTrigger(enm2Fact1Evnt, enm2Fact1Trig);
//setEventTrigger(enm2Fact2Evnt, enm2Fact2Trig);
setEventTrigger(scoutAtkSector, scoutTrig);
setEventTrigger(heavySector, heavyTrig);
*/
setEventTrigger(goGet, inactive);
}
event LZNoGo(inactive)
{
if (not transOnMap) //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, 704, 704, 0);
//disable transport landing
setReinforcementTime(LZ_COMPROMISED_TIME); //(set to 1 hour)
//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, 704, 704, 0);
//allow reinforcements now LZ clear
setReinforcementTime(ReinforceTime); //(set back to normal)
setEventTrigger(LZNoGo, LZNoGoTrig);
setEventTrigger(LZ_OK, inactive);
}
event scoutSeenEvnt(scoutSeenTrig)
{
//make NP scout vehicle return to NP base when player sees him.
if (scoutDroid != NULLOBJECT)
{
if (droidHasSeen(scoutDroid, player))
{
orderDroidLoc(scoutDroid, DORDER_MOVE, enm2Ret1X, enm2Ret1Y);
setEventTrigger(scoutSeenEvnt, inactive);
}
}
else
{
setEventTrigger(scoutSeenEvnt, inactive);
}
}
event transOn(CALL_TRANSPORTER_REINFORCE)
{
transOnMap = TRUE;
}
event transOff(CALL_TRANSPORTER_OFFMAP, player)
{
transOnMap = FALSE;
}