warzone2100/data/script/text/cam1a.slo

575 lines
17 KiB
Plaintext
Raw Normal View History

/* Script file for Cam1A (now start of Campaign 1)*/
/* structure limit stuff */
public STRUCTURESTAT factory, research, oilDerrick, powerGen;
public STRUCTURESTAT command;
//public STRUCTURESTAT powerModuleHack;
public INT numPow, numExt, numFac, numRes;
public int startPower; //initial power level
/* Starting Tech */
public BODY viperBody;
public CONSTRUCT spade;
public PROPULSION wheeledProp;
public WEAPON mg;
/* Starting Tech now done as completed research */
public int numTech;
public RESEARCHSTAT tech[4];
/* General Values */
public int player;
public int enemy1;
public int enemy2;
private int numart; //keep track of number of artifacts collected
//private int res1x,res1y;
//public STRUCTURE commandCentre;
/* Base Under Attack Stuff */
private STRUCTURE hitStruc;
private BASEOBJ attackerObj;
private int t;
public SOUND attackSnd1;
/* Briefing stuff */
public INTMESSAGE MissionBrief, MissionBrief2, obj1Msg;
public SOUND incomingSnd;
public INTMESSAGE endMsg; //, winMsg;
//public SOUND briefSnd1, briefSnd2;
/* Proximity: Resources */
/*
public FEATURE res1;
public INTMESSAGE res1Msg;
public SOUND res1Snd;
public STRUCTURESTAT derrick;
*/
/* Proximity: Artifacts */
public FEATURESTAT crate;
public int art1X, art1Y;
public STRUCTURE art1Get;
public SOUND art1Snd2;
//public INTMESSAGE art1Msg;
public RESEARCHSTAT art1Comp; //Engineering Upgrade
private FEATURE art1ID;
public int art2X, art2Y;
public STRUCTURE art2Get;
public SOUND art2Snd2;
//public INTMESSAGE art2Msg;
public RESEARCHSTAT art2Comp; //Repair Facility (NOT Robotics)
private FEATURE art2ID;
public int art3X, art3Y;
public STRUCTURE art3Get;
public SOUND art3Snd2;
//public INTMESSAGE art3Msg;
public RESEARCHSTAT art3Comp; //Flamer
private FEATURE art3ID;
public int art4X, art4Y;
//public STRUCTURE art4Get; //placed in script
public SOUND art4Snd2;
//public INTMESSAGE art4Msg;
public RESEARCHSTAT art4Comp; //Light Machine Gun Mk1
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 enm0;
public INTMESSAGE enm0Msg;
public SOUND enm0Snd1;
public SOUND enm0Snd2;
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;
public STRUCTURE enm22;
public STRUCTUREID enm22ID;
public INTMESSAGE enm22Msg;
public SOUND enm22Snd1;
//public SOUND enm22Snd2;
private BOOL base2Flag;
/* Enemy Tactics */
public TEMPLATE trike;
public TEMPLATE buggy;
public TEMPLATE bloke;
public TEMPLATE jeep;
/* Win or lose */
public SOUND lostSnd;
public LEVEL NextLev;
public INT timeLimit;
//group to stop players droids chsing too much!!
private GROUP allPlayer, scavGroup;
/* Triggers: Resource */
/*
trigger res1SeenTrig(droidHasSeen(res1, player), 10); //resWait
trigger res1UsedTrig(every, 10); //resWait
//trigger res1UsedTrig(CALL_RESEX_BUILT); //until built function fixed
*/
/* Triggers: Artifacts */
//trigger art1SeenTrig(droidInRange(player, art1X, art1Y, 512), 5);
//trigger art1SeenTrig(droidHasSeen(art1ID, player), 5);
trigger art1TakeTrig(droidInRange(player, art1X, art1Y, 171), 5);
trigger art1PlaceTrig((art1Get==NULLOBJECT), 5);
//trigger art2SeenTrig(droidInRange(player, art2X, art2Y, 512), 5);
//trigger art2SeenTrig(droidHasSeen(art2ID, player), 5);
trigger art2TakeTrig(droidInRange(player, art2X, art2Y, 171), 5);
trigger art2PlaceTrig((art2Get==NULLOBJECT), 5);
//trigger art3SeenTrig(droidInRange(player, art3X, art3Y, 512), 5);
//trigger art3SeenTrig(droidHasSeen(art3ID, player), 5);
trigger art3TakeTrig(droidInRange(player, art3X, art3Y, 171), 5);
trigger art3PlaceTrig((art3Get==NULLOBJECT), 5);
//trigger art4SeenTrig(droidInRange(player, art4X, art4Y, 512), 5);
//trigger art4SeenTrig(droidHasSeen(art4ID, player), 5);
trigger art4TakeTrig(droidInRange(player, art4X, art4Y, 171), 5);
//trigger art4PlaceTrig((art4Get==NULLOBJECT), 5);
/* Triggers: Enemy */
trigger enm0SeenTrig(seenStructInArea(player, enemy1, FALSE, 3520, 4416, 4416, 5056), 10);
trigger enm0DeadTrig((numStructsButNotWallsInArea(enemy1, 3520, 4416, 4416, 5056) == 0), 20);
trigger enm1SeenTrig(seenStructInArea(player, enemy1, FALSE, 4544, 1856, 5440, 2496), 10);
trigger enm1DeadTrig((numStructsButNotWallsInArea(enemy1, 4544, 1856, 5440, 2496) == 0), 20);
trigger enm2SeenTrig(seenStructInArea(player, enemy2, FALSE, 1088, 1216, 2240, 2240), 10);
trigger enm2DeadTrig((numStructsButNotWallsInArea(enemy2, 1088, 1216, 2240, 2240) == 0), 20);
trigger enm22SeenTrig(seenStructInArea(player, enemy2, FALSE, 1472, 3776, 2752, 5440), 10);
trigger enm22DeadTrig((numStructsButNotWallsInArea(enemy2, 1472, 3776, 2752, 5440) == 0), 20);
/* Triggers: Win or Lose */
trigger winLoseTrig(every, 5);
trigger gameLostTrig(every, 20);
/* initial scav attack */
trigger scavtrig(every, 100); //better if checks for HQ built?
trigger scavtrig2(droidInArea(player, 2496, 6080, 4928, 7232), 5);
trigger scavtrig3(wait, 1); //go immediately
trigger obj1Trig(droidInRange(player, 4928, 6592, 5*128), 20);
/* Events: Initialise */
event enm2SeenEvnt;
event enm2DeadEvnt;
event wonYetEvnt;
//event art4SeenEvnt;
event art4TakeEvnt;
event scavAttack2;
event timeUp;
/* Events: Start */
event startEvnt(CALL_GAMEINIT)
{
//take over the selectedPlayer's units to avoid id number clashes on later levels
takeOverDroidsInArea(0,0, 0,0, mapWidth*128, mapHeight*128);
//set scroll limits
// setScrollParams(0, 0, 64, 70); //limit scroll
//centreView(commandCentre);
centreViewPos(1728, 6720); //centre near transport
//set zoom Level 64x64
setRadarZoom(1);
//set starting power
setPowerLevel(startPower,player);
//set start tech
/*
makeComponentAvailable(viperBody, player);
makeComponentAvailable(spade, player);
makeComponentAvailable(wheeledProp, player);
*/
makeComponentAvailable(mg, player); //needs to be done this way so doesn't enable rest of tree!
count = 0;
while (count < numTech)
{
completeResearch(tech[count], player);
count = count +1;
}
//give player briefing
addMessage(MissionBrief, CAMP_MSG, player, false);
//make sure all buttons available
addReticuleButton(OPTIONS);
addReticuleButton(CANCEL);
addReticuleButton(BUILD);
addReticuleButton(MANUFACTURE);
addReticuleButton(RESEARCH);
addReticuleButton(INTELMAP);
addReticuleButton(DESIGN);
//stop player building on LZ
setLandingZone(10, 51, 12, 53);
//stop players droids from chasing!
/* not any more - john
groupAddArea(allPlayer, player, 0, 30*128, 40*128, 70*128);
setGroupSecondary(allPlayer,DSO_HALTTYPE, DSS_HALT_HOLD);
*/
//set no time limits (can carry over from previous missions if not set!)
setReinforcementTime(-1);
setMissionTime(timeLimit); //set Mission time limit
///allow to build stuff
setStructureLimits (powerGen,numPow,0);
setStructureLimits (oilDerrick,numExt,0);
setStructureLimits (research,numRes,0); // numRes changed by Keith to set Research Facility Limits to 1, until.... 1C
setStructureLimits (factory,numFac,0);
setStructureLimits(command, 1, player);
enableStructure(command, player);
enableStructure(powerGen,0);
enableStructure(oilDerrick,0);
enableStructure(research,0);
enableStructure(factory,0);
//enableStructure(powerModuleHack, 0);
//add machine gun crate *** BACK IN ***
//now got from new 1st base
art4ID=addFeature(crate, art4X, art4Y);
//setEventTrigger(art4SeenEvnt, art4SeenTrig);
//setEventTrigger(art4TakeEvnt, art4TakeTrig); //set from start since didn't always set!!
//set up initial attack group
groupAddArea(scavGroup, enemy1, 4416, 6336, 5440, 7104);
//set retreat point
setGroupRetreatPoint(scavGroup, 4416, 5440); //retreat to crossroads
setGroupRetreatForce(scavGroup, 99); //set morale to 1%
setGroupRetreatLeadership(scavGroup, 10); //set leadership chance 10% (small=more likely)
setEventTrigger(startEvnt, inactive);
}
/* 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);
//make sure art2 placed before base2 dead
//setEventTrigger(enm2DeadEvnt, enm2DeadTrig);
//make sure art2 placed before mission won as well!!!
setEventTrigger(wonYetEvnt, winLoseTrig);
setEventTrigger(art2PlaceEvnt, inactive);
}
event art3TakeEvnt(inactive)
{
numart=numart+1;
destroyFeature(art3ID);
//playSound(art3Snd2, player);
playSoundPos(art3Snd2, player, art3ID.x, art3ID.y, art3ID.z);
//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(art4TakeTrig) //mg crate (placed at start of script)
{
numart=numart+1;
destroyFeature(art4ID);
//playSound(art4Snd2, player);
playSoundPos(art4Snd2, player, art4ID.x, art4ID.y, art4ID.z);
//removeMessage(art4Msg, PROX_MSG, player);
enableResearch(art4Comp, player);
setEventTrigger(art4TakeEvnt, inactive);
}
/* Events: Enemies */
event enm0DeadEvnt(inactive) //newbase dead?
{
killStructsInArea(enemy1, REF_WALL, 3520, 4416, 4416, 5056, TRUE, TRUE); //remove walls and building features in base
killStructsInArea(enemy1, REF_WALLCORNER, 3520, 4416, 4416, 5056, TRUE, FALSE); //remove corner walls in base
removeMessage(enm0Msg, PROX_MSG, player);
//playSound(enm0Snd2, player);
playSoundPos(enm0Snd2, player, 3904, 4672, 0); //should be same as in prox1a.txt
setEventTrigger(enm0DeadEvnt, inactive);
}
event enm0SeenEvnt(enm0SeenTrig) //base 2 seen
{
addMessage(enm0Msg, PROX_MSG, player, false);
//playSound(enm0Snd1, player);
playSoundPos(enm0Snd1, player, 3904, 4672, 0); //should be same as in prox1a.txt
setEventTrigger(enm0DeadEvnt, enm0DeadTrig);
setEventTrigger(enm0SeenEvnt, inactive);
}
event enm1DeadEvnt(inactive)
{
killStructsInArea(enemy1, REF_WALL, 4544, 1856, 5440, 2496, TRUE, TRUE); //remove walls and features in base
killStructsInArea(enemy1, REF_WALLCORNER, 4544, 1856, 5440, 2496, TRUE, FALSE); //remove corner walls in base
removeMessage(enm1Msg, PROX_MSG, player);
//playSound(enm1Snd2, player);
playSoundPos(enm1Snd2, player, 5002, 2154, 135); //should be same as in prox1a.txt
//trigger 2nd base blip if not already triggered
if (not base2Flag)
{
base2Flag = TRUE;
addMessage(enm2Msg, PROX_MSG, player, false);
//playSound(enm2Snd1, player);
playSoundPos(enm2Snd1, player, 1600, 1728, 0); //should be same as in prox1a.txt
setEventTrigger(enm2DeadEvnt, enm2DeadTrig);
setEventTrigger(enm2SeenEvnt, inactive);
}
setEventTrigger(enm1DeadEvnt, inactive);
}
event enm1SeenEvnt(enm1SeenTrig)
{
addMessage(enm1Msg, PROX_MSG, player, false);
//playSound(enm1Snd1, player);
playSoundPos(enm1Snd1, player, 5002, 2154, 135); //should be same as in prox1a.txt
setEventTrigger(enm1DeadEvnt, enm1DeadTrig);
setEventTrigger(enm1SeenEvnt, inactive);
}
event enm2DeadEvnt(inactive) //base 2 dead?
{
killStructsInArea(enemy2, REF_WALL, 1088, 1216, 2240, 2240, TRUE, TRUE); //remove walls and features in base
killStructsInArea(enemy2, REF_WALLCORNER, 1088, 1216, 2240, 2240, TRUE, FALSE); //remove corner walls in base
removeMessage(enm2Msg, PROX_MSG, player);
//playSound(enm2Snd2, player);
playSoundPos(enm2Snd2, player, 1600, 1728, 0); //should be same as in prox1a.txt
setEventTrigger(enm2DeadEvnt, inactive);
}
event enm2SeenEvnt(enm2SeenTrig) //base 2 seen (used to be wrong trigger!)
{
base2Flag = TRUE;
addMessage(enm2Msg, PROX_MSG, player, false);
//playSound(enm2Snd1, player);
playSoundPos(enm2Snd1, player, 1600, 1728, 0); //should be same as in prox1a.txt
setEventTrigger(enm2DeadEvnt, enm2DeadTrig);
setEventTrigger(enm2SeenEvnt, inactive);
}
event enm22DeadEvnt(inactive) //base 2A dead?
{
killStructsInArea(enemy2, REF_WALL, 1472, 3776, 2752, 5440, TRUE, TRUE); //remove walls and features in base
killStructsInArea(enemy2, REF_WALLCORNER, 1472, 3776, 2752, 5440, TRUE, FALSE); //remove corner walls in base
removeMessage(enm22Msg, PROX_MSG, player);
//playSound(enm2Snd2, player); //should this be enm22Snd2?
playSoundPos(enm2Snd2, player, 2112, 4544, 0); //should be same as in prox1a.txt
setEventTrigger(enm22DeadEvnt, inactive);
}
event enm22SeenEvnt(enm22SeenTrig) //base 2A seen
{
addMessage(enm22Msg, PROX_MSG, player, false);
//playSound(enm22Snd1, player);
playSoundPos(enm22Snd1, player, 2112, 4544, 0); //should be same as in prox1a.txt
setEventTrigger(enm22DeadEvnt, enm22DeadTrig);
setEventTrigger(enm22SeenEvnt, inactive);
}
/* Events: Win or Lose */
event nextLevEvnt(inactive) //assumes victory already checked
{
//pause(20);
pause(40); //increased to allow all audio before won
// give bonus research (if req'd)
count = 0;
while (count < numResP0)
{
enableResearch(resP0[count], 0);
count = count +1;
}
gameLevel=gameLevel+1; //flag next part of map
//removeMessage(MissionBrief, MISS_MSG, player);
startMission(CAMP_EXPAND, NextLev);
setEventTrigger(nextLevEvnt, inactive);
}
event gameLost(inactive)
{
// addMessage(endMsg, MISS_MSG, 0, true);
// pause(10);
// gameOver(false);
gameOverMessage(endMsg, MISS_MSG, 0, false);
setEventTrigger(gameLost, inactive);
}
event lostYetEvnt(winLoseTrig)
{
if (not anyDroidsLeft(player))
{
if (not anyStructButWallsLeft(player))
{
setEventTrigger(wonYetEvnt,inactive);
setEventTrigger(gameLost, gameLostTrig); //waits 2 seconds before ending
setEventTrigger(lostYetEvnt, inactive);
setEventTrigger(timeUp, inactive);
}
}
}
event wonYetEvnt(inactive) // have all enemies lost yet, and all artifacts picked up?
{
if (not anyDroidsLeft(enemy2))
{
if (not anyStructButWallsLeft(enemy2))
{
if (not anyDroidsLeft(enemy1))
{
if (not anyStructButWallsLeft(enemy1))
{
if (numart==4)
{
setEventTrigger(lostYetEvnt, inactive);
setEventTrigger(nextLevEvnt, winLoseTrig);
setEventTrigger(wonYetEvnt, inactive);
setEventTrigger(timeUp, inactive);
}
}
}
}
}
}
event cheatEvnt(CALL_MISSION_START) //cheat button ctrl M
{
setEventTrigger(nextLevEvnt, winLoseTrig);
setEventTrigger(cheatEvnt, inactive);
}
/* Base Under Attack */
event baseHit(CALL_STRUCT_ATTACKED, selectedPlayer, ref hitStruc, ref attackerObj)
{
if (t >= 20)
{
t=0;
if (hitStruc != NULLOBJECT)
{
playSoundPos(attackSnd1, selectedPlayer, hitStruc.x, hitStruc.y, hitStruc.z); //show position if still alive
}
else
{
playSound(attackSnd1, selectedPlayer);
}
}
}
event everySec(every, 20)
{
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(inactive)
{
removeMessage(obj1Msg, PROX_MSG, player);
setEventTrigger(removeObj1, inactive);
}
/*
event scavAttack(scavtrig)
{
setEventTrigger(scavAttack2, inactive);
setEventTrigger(scavAttack, inactive);
//setEventTrigger(removeObj1, obj1Trig);
//addMessage(MissionBrief2, MISS_MSG, player, true);
//addMessage(obj1Msg, PROX_MSG, player, false);
//orderGroupLoc(scavGroup, DORDER_SCOUT, 2100, 6700);
}
*/
event scavAttack2(scavtrig2)
{
//setEventTrigger(scavAttack, inactive);
playSound(incomingSnd, player);
pause(20);
setEventTrigger(scavAttack2, inactive);
setEventTrigger(removeObj1, obj1Trig);
addMessage(MissionBrief2, MISS_MSG, player, true);
addMessage(obj1Msg, PROX_MSG, player, false);
orderGroupLoc(scavGroup, DORDER_SCOUT, 2100, 6700);
}
event timeUp(CALL_MISSION_TIME)
{
setEventTrigger(wonYetEvnt,inactive);
setEventTrigger(lostYetEvnt,inactive);
setEventTrigger(gameLost, gameLostTrig);
setEventTrigger(timeUp, inactive);
}