550 lines
18 KiB
Plaintext
550 lines
18 KiB
Plaintext
// GENERIC SCRIPT file for OFF MAP MISSIONS
|
|
|
|
/* General Values */
|
|
public int player;
|
|
public int enemy1;
|
|
public int enemy2;
|
|
public int pow1, pow2;
|
|
private int numart, winFlag;
|
|
|
|
/* Briefing stuff */
|
|
public INTMESSAGE MissionBrief;
|
|
public INTMESSAGE endMsg; //, winMsg;
|
|
|
|
public TEMPLATE transporter; //required for enemy transports landing
|
|
private DROID transportDroid, loadDroid;
|
|
private BOOL transOnMap;
|
|
|
|
/* Win or lose */
|
|
public SOUND lostSnd;
|
|
public LEVEL NextLev;
|
|
public INT timeLimit;
|
|
|
|
public INTMESSAGE obj1;
|
|
|
|
/* Base Under Attack Stuff */
|
|
private STRUCTURE hitStruc;
|
|
private BASEOBJ attackerObj;
|
|
private int t;
|
|
public SOUND attackSnd1;
|
|
|
|
/* 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;
|
|
|
|
/* Reinforcement Lists for New Paradigm */
|
|
public INT numScout, numHeavy, numLZ;
|
|
public TEMPLATE scout[4], heavy[7];
|
|
public INT enemyLZX[5], enemyLZY[5];
|
|
public INTMESSAGE enemyLZM[5];
|
|
public SOUND warnSnd;
|
|
public INT maxDroid; //limit on number to call in next transport
|
|
private INT reinforceType, reinforceCount, transTot, LZ, LZMess;
|
|
private TEMPLATE reinforceTemplate;
|
|
private GROUP transScout, transHeavy, transTemp, transTemp2;
|
|
|
|
/* Map Targets/Waypoints for New Paradigm */
|
|
public INT numTargets, targetX[9], targetY[9]; //need 3*numTargets for array, since near, mid and far!
|
|
private INT targetChoice, targetType;
|
|
|
|
|
|
/* structure limit stuff */
|
|
public STRUCTURESTAT factory, research, oilDerrick, powerGen;
|
|
//public STRUCTURESTAT powerModuleHack;
|
|
public STRUCTURESTAT command;
|
|
public STRUCTURESTAT gunTower, sensorTower;
|
|
public INT numPow, numExt, numFac, numRes;
|
|
|
|
/* Starting Technology */
|
|
public int numtecE2;
|
|
public RESEARCHSTAT tecE2[12];
|
|
|
|
/* victory conditions */
|
|
private int startStruc; //player's starting structures on plateau
|
|
|
|
/* Triggers: Win or Lose */
|
|
trigger winLoseTrig(every, 5);
|
|
//need to build an extra 4 structures (not walls!)
|
|
trigger winLoseTrig2((numStructsButNotWallsInArea(player, 7360, 5696, 10688, 8640) >= startStruc + 4), 20);
|
|
//need to build 3 defensive structures!!!
|
|
//trigger winLoseTrig2((numStructsByTypeInArea(player, REF_DEFENSE, 7360, 5696, 10688, 8640) >= 3), 10);
|
|
trigger gameLostTrig(every, 20);
|
|
|
|
/* Reinforcement triggers */
|
|
trigger NPTransTrig(every, 900); //every 90 secs
|
|
trigger NPTransTrig2(every, 100); //every 10 seconds for retries
|
|
trigger NPTransTrig3(every, 1800); //every 180 secs
|
|
//altered to when an enemy transport lands
|
|
//trigger groupTransTrig(CALL_TRANSPORTER_LANDED, enemy2, transScout); //wait until transport landed before grouping!
|
|
//trigger obj1Trig(structInArea(player, 7360, 5696, 10688, 8640), 20);
|
|
|
|
event wonYetEvnt;
|
|
event moveTrans;
|
|
event timeUp;
|
|
|
|
event startEvnt(CALL_GAMEINIT)
|
|
{
|
|
//set scroll limits
|
|
centreViewPos(11*128, 52*128);
|
|
// setScrollParams(0, 0, 128, 128); //limit scroll
|
|
//set zoom Level 128x128
|
|
setRadarZoom(0);
|
|
//stop player building on LZ
|
|
initAllNoGoAreas();
|
|
setLandingZone(10, 51, 12, 53);
|
|
//also don't allow building on 1CA's enemy LZs!
|
|
count = 0;
|
|
while (count < numLZ)
|
|
{
|
|
setNoGoArea((enemyLZX[count]/128) - 1, (enemyLZY[count]/128) - 1, (enemyLZX[count]/128) + 1, (enemyLZY[count]/128) + 1, count + 2); //count+2 so doesn't set NP's LZ (since changes later!)
|
|
count = count + 1;
|
|
}
|
|
//make a note of existing structures in case some already built!!!
|
|
//need to build 4 more of these!!!
|
|
startStruc = numStructsButNotWallsInArea(player, 7360, 5696, 10688, 8640);
|
|
|
|
//set no time limits (can carry over from previous missions if not set!)
|
|
setReinforcementTime(-1);
|
|
setMissionTime(timeLimit); //set Mission time limit
|
|
|
|
//add enemy transport (once!)
|
|
setNoGoArea((enemyLZX[0] / 128) - 1, (enemyLZY[0] / 128) - 1, (enemyLZX[0] / 128) + 1, (enemyLZY[0] / 128) + 1, enemy2);
|
|
transportDroid = addDroidToMissionList(transporter, enemy2);
|
|
|
|
addMessage(MissionBrief, MISS_MSG, 0, true);
|
|
//createAlliance(enemy1, enemy2);
|
|
setPowerLevel(pow1, enemy1);
|
|
setPowerLevel(pow2, enemy2);
|
|
setEventTrigger(startEvnt, inactive);
|
|
//Blip Given at start
|
|
addMessage(obj1, PROX_MSG, player, false);
|
|
LZMess = numLZ+1; //force to recalc
|
|
//targetChoice = 1000;
|
|
targetChoice=random(numTargets); //choose target now so can check for waypoints
|
|
|
|
randomiseSeed();
|
|
//allow to build stuff
|
|
setStructureLimits (powerGen,numPow,0);
|
|
setStructureLimits (oilDerrick,numExt,0);
|
|
setStructureLimits (research,numRes,0);
|
|
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);
|
|
//these need to be researched beforehand!
|
|
//enableStructure(gunTower,0);
|
|
//enableStructure(sensorTower,0);
|
|
|
|
// player specific technology startups
|
|
count = 0;
|
|
while (count < numtecE2)
|
|
{
|
|
completeResearch(tecE2[count], enemy2);
|
|
count = count +1;
|
|
}
|
|
//make scavengers allies (just so NP doesn't shoot up Scav walls and stuff)
|
|
createAlliance(enemy1, enemy2);
|
|
}
|
|
|
|
/* 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
|
|
|
|
//removeMessage(MissionBrief, MISS_MSG, player);
|
|
startMission(BETWEEN, NextLev); //SUB1-4A next so BETWEEN rather than OFF_KEEP
|
|
|
|
//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(gameLost, gameLostTrig); //waits 2 seconds before ending
|
|
setEventTrigger(lostYetEvnt, inactive);
|
|
setEventTrigger(timeUp, inactive);
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
|
|
event wonYetEvnt(winLoseTrig2) // have all enemies lost yet?
|
|
{
|
|
//really needs to test for player having built forward base
|
|
if (winFlag == 1)
|
|
{
|
|
if (not anyDroidsLeft(enemy2))
|
|
{
|
|
if (not anyStructButWallsLeft(enemy2))
|
|
{
|
|
//check for forward base built (3 or more structure for now!)
|
|
//check done in trigger now
|
|
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, 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(winLoseTrig2)
|
|
{
|
|
//remove if forward base established
|
|
removeMessage(obj1, PROX_MSG, player);
|
|
setEventTrigger(removeObj1, inactive);
|
|
}
|
|
|
|
/* group landed enemy units and get going! */
|
|
event groupTrans(CALL_TRANSPORTER_LANDED, transTemp, enemy2)
|
|
{
|
|
//warn player!!
|
|
addMessage(enemyLZM[LZ], PROX_MSG, player, false);
|
|
LZMess = LZ; //store so can remove later
|
|
//playSound(warnSnd, player);
|
|
playSoundPos(warnSnd, player, enemyLZX[LZ], enemyLZY[LZ], 0);
|
|
pause(10);
|
|
//groupAddArea(transScout, enemy2, enemyLZX[LZ] - 2000, enemyLZY[LZ] - 2000, enemyLZX[LZ] + 2000, enemyLZY[LZ] + 2000);
|
|
if (reinforceType == 0)
|
|
{
|
|
groupAddGroup(transHeavy, transTemp);
|
|
orderGroupLoc(transHeavy, DORDER_SCOUT, targetX[targetChoice], targetY[targetChoice]);
|
|
//orderGroupLoc(transHeavy, DORDER_SCOUT, 12736, 320);
|
|
}
|
|
else
|
|
{
|
|
groupAddGroup(transScout, transTemp);
|
|
orderGroupLoc(transScout, DORDER_SCOUT, targetX[targetChoice], targetY[targetChoice]);
|
|
//orderGroupLoc(transScout, DORDER_SCOUT, 12736, 320);
|
|
setGroupRetreatForce(transScout, 75);
|
|
setGroupRetreatLeadership(transScout, 50);
|
|
setGroupRetreatPoint(transScout, 12736, 320); //go to top road off map!
|
|
}
|
|
//setEventTrigger(groupTrans, inactive);
|
|
}
|
|
|
|
/* make NP Transport "land" */
|
|
event NPTransEvnt(NPTransTrig2)
|
|
{
|
|
if (transportDroid != NULLOBJECT)
|
|
{
|
|
if (not transOnMap) //make sure transporter not still on map!
|
|
{
|
|
//pick a random LZ
|
|
LZ = random(numLZ);
|
|
//check no player droids or structures near NP LZ, before landing
|
|
if ((not droidInArea(player, enemyLZX[LZ] - 512, enemyLZY[LZ] - 512, enemyLZX[LZ] + 512, enemyLZY[LZ] + 512)) and (not structInArea(player, enemyLZX[LZ] - 512, enemyLZY[LZ] - 512, enemyLZX[LZ] + 512, enemyLZY[LZ] + 512))
|
|
and (not droidInArea(enemy2, enemyLZX[LZ] - 200, enemyLZY[LZ] - 200, enemyLZX[LZ] + 200, enemyLZY[LZ] + 200))
|
|
//limit total number (For PSX mainly)
|
|
and (((reinforceType == 0) and (transHeavy.members < maxDroid)) or ((reinforceType == 1) and (transHeavy.members < maxDroid))))
|
|
|
|
{
|
|
//remove last blip before transport sent
|
|
//must be done after LZ checked for being clear!!
|
|
if (LZMess < numLZ)
|
|
{
|
|
//remove last warning (if any!)
|
|
removeMessage(enemyLZM[LZMess], PROX_MSG, player);
|
|
}
|
|
|
|
//set Landing Zone
|
|
setNoGoArea((enemyLZX[LZ] / 128) - 1, (enemyLZY[LZ] / 128) - 1, (enemyLZX[LZ] / 128) + 1, (enemyLZY[LZ] / 128) + 1, enemy2);
|
|
if (reinforceType == 0)
|
|
{
|
|
//choose target
|
|
targetChoice = targetChoice + numTargets; //go from near to mid to far
|
|
if (targetChoice >= numTargets * 3)
|
|
{
|
|
//choose new target randomly
|
|
targetChoice=random(numTargets);
|
|
}
|
|
//allow win check!
|
|
winFlag = 1;
|
|
//place 8 scouts
|
|
reinforceTemplate = scout[random(numScout)];
|
|
loadDroid = addDroidToMissionList(reinforceTemplate, enemy2);
|
|
if (loadDroid != NULLOBJECT)
|
|
{
|
|
addDroidToTransporter(transportDroid, loadDroid);
|
|
}
|
|
loadDroid = addDroidToMissionList(reinforceTemplate, enemy2);
|
|
if (loadDroid != NULLOBJECT)
|
|
{
|
|
addDroidToTransporter(transportDroid, loadDroid);
|
|
}
|
|
//loadDroid = addDroidToMissionList(reinforceTemplate, enemy2);
|
|
//addDroidToTransporter(transportDroid, loadDroid);
|
|
|
|
reinforceTemplate = scout[random(numScout)];
|
|
loadDroid = addDroidToMissionList(reinforceTemplate, enemy2);
|
|
if (loadDroid != NULLOBJECT)
|
|
{
|
|
addDroidToTransporter(transportDroid, loadDroid);
|
|
}
|
|
loadDroid = addDroidToMissionList(reinforceTemplate, enemy2);
|
|
if (loadDroid != NULLOBJECT)
|
|
{
|
|
addDroidToTransporter(transportDroid, loadDroid);
|
|
}
|
|
//loadDroid = addDroidToMissionList(reinforceTemplate, enemy2);
|
|
//addDroidToTransporter(transportDroid, loadDroid);
|
|
|
|
if (targetChoice >= numTargets / 3)
|
|
{
|
|
reinforceTemplate = scout[random(numScout)];
|
|
loadDroid = addDroidToMissionList(reinforceTemplate, enemy2);
|
|
if (loadDroid != NULLOBJECT)
|
|
{
|
|
addDroidToTransporter(transportDroid, loadDroid);
|
|
}
|
|
loadDroid = addDroidToMissionList(reinforceTemplate, enemy2);
|
|
if (loadDroid != NULLOBJECT)
|
|
{
|
|
addDroidToTransporter(transportDroid, loadDroid);
|
|
}
|
|
}
|
|
if (targetChoice >= 2 * numTargets / 3)
|
|
{
|
|
reinforceTemplate = scout[random(numScout)];
|
|
loadDroid = addDroidToMissionList(reinforceTemplate, enemy2);
|
|
if (loadDroid != NULLOBJECT)
|
|
{
|
|
addDroidToTransporter(transportDroid, loadDroid);
|
|
}
|
|
loadDroid = addDroidToMissionList(reinforceTemplate, enemy2);
|
|
if (loadDroid != NULLOBJECT)
|
|
{
|
|
addDroidToTransporter(transportDroid, loadDroid);
|
|
}
|
|
}
|
|
reinforceType = 1;
|
|
setEventTrigger(NPTransEvnt, NPTransTrig); //1 min
|
|
//now get going!
|
|
//groupAddArea(transScout, enemy2, enemyLZX[LZ] - 128, enemyLZY[LZ] - 128, enemyLZX[LZ] + 128, enemyLZY[LZ] + 128);
|
|
//orderGroupLoc(transScout, DORDER_SCOUT, targetX[targetChoice], targetY[targetChoice]);
|
|
}
|
|
else
|
|
{
|
|
reinforceTemplate = heavy[random(numHeavy)];
|
|
loadDroid = addDroidToMissionList(reinforceTemplate, enemy2);
|
|
if (loadDroid != NULLOBJECT)
|
|
{
|
|
addDroidToTransporter(transportDroid, loadDroid);
|
|
}
|
|
loadDroid = addDroidToMissionList(reinforceTemplate, enemy2);
|
|
if (loadDroid != NULLOBJECT)
|
|
{
|
|
addDroidToTransporter(transportDroid, loadDroid);
|
|
}
|
|
//loadDroid = addDroidToMissionList(reinforceTemplate, enemy2);
|
|
//addDroidToTransporter(transportDroid, loadDroid);
|
|
|
|
reinforceTemplate = heavy[random(numHeavy)];
|
|
loadDroid = addDroidToMissionList(reinforceTemplate, enemy2);
|
|
if (loadDroid != NULLOBJECT)
|
|
{
|
|
addDroidToTransporter(transportDroid, loadDroid);
|
|
}
|
|
loadDroid = addDroidToMissionList(reinforceTemplate, enemy2);
|
|
if (loadDroid != NULLOBJECT)
|
|
{
|
|
addDroidToTransporter(transportDroid, loadDroid);
|
|
}
|
|
//loadDroid = addDroidToMissionList(reinforceTemplate, enemy2);
|
|
//addDroidToTransporter(transportDroid, loadDroid);
|
|
|
|
if (targetChoice >= numTargets / 3)
|
|
{
|
|
reinforceTemplate = heavy[random(numHeavy)];
|
|
loadDroid = addDroidToMissionList(reinforceTemplate, enemy2);
|
|
if (loadDroid != NULLOBJECT)
|
|
{
|
|
addDroidToTransporter(transportDroid, loadDroid);
|
|
}
|
|
loadDroid = addDroidToMissionList(reinforceTemplate, enemy2);
|
|
if (loadDroid != NULLOBJECT)
|
|
{
|
|
addDroidToTransporter(transportDroid, loadDroid);
|
|
}
|
|
}
|
|
if (targetChoice >= 2 * numTargets / 3)
|
|
{
|
|
loadDroid = addDroidToMissionList(reinforceTemplate, enemy2);
|
|
if (loadDroid != NULLOBJECT)
|
|
{
|
|
addDroidToTransporter(transportDroid, loadDroid);
|
|
}
|
|
loadDroid = addDroidToMissionList(reinforceTemplate, enemy2);
|
|
if (loadDroid != NULLOBJECT)
|
|
{
|
|
addDroidToTransporter(transportDroid, loadDroid);
|
|
}
|
|
}
|
|
reinforceType = 0;
|
|
setEventTrigger(NPTransEvnt, NPTransTrig3); //2 mins
|
|
//groupAddArea(transHeavy, enemy2, enemyLZX[LZ] - 128, enemyLZY[LZ] - 128, enemyLZX[LZ] + 128, enemyLZY[LZ] + 128);
|
|
//orderGroupLoc(transHeavy, DORDER_SCOUT, targetX[targetChoice], targetY[targetChoice]);
|
|
}
|
|
|
|
//call in transport, using random-ish positions
|
|
setTransporterExit(enemy2, 126, 1 + random(126));
|
|
flyTransporterIn(enemy2, 126, 1 + random(126), false);
|
|
transOnMap = TRUE;
|
|
//setEventTrigger(groupTrans, groupTransTrig); //allow grouping when it lands
|
|
|
|
//keep track of number of transports done so far!
|
|
transTot = transTot + 1;
|
|
/* this now done short if next is heavies, long if next is scouts
|
|
//set random time before reinforcements again
|
|
if (random(2) == 0)
|
|
{
|
|
setEventTrigger(NPTransEvnt, NPTransTrig); //1 min
|
|
}
|
|
else
|
|
{
|
|
setEventTrigger(NPTransEvnt, NPTransTrig3); //2 mins
|
|
}
|
|
*/
|
|
}
|
|
else
|
|
{
|
|
//try again soon
|
|
setEventTrigger(NPTransEvnt, NPTransTrig2);
|
|
}
|
|
if (transTot > 10)
|
|
{
|
|
//allow win check!
|
|
winFlag = 1;
|
|
setEventTrigger(NPTransEvnt, inactive); //don't allow any more!
|
|
}
|
|
//setEventTrigger(moveTrans, NPTransTrig2); //set moveTrans working, now destination set
|
|
}
|
|
}
|
|
else
|
|
{
|
|
//no transporter so at least let the player win the level
|
|
//allow win check!
|
|
winFlag = 1;
|
|
setEventTrigger(NPTransEvnt, inactive); //don't allow any more!
|
|
}
|
|
}
|
|
|
|
event moveTrans(every, 88) //(inactive)
|
|
{
|
|
//have Scouts got close to target?
|
|
groupAddArea(transTemp, enemy2, targetX[targetChoice] - 512, targetY[targetChoice] - 512, targetX[targetChoice] + 512, targetY[targetChoice] + 512);
|
|
if (transTemp.members > 0)
|
|
{
|
|
targetChoice = targetChoice + numTargets; //go from near to mid to far
|
|
if (targetChoice >= numTargets * 3)
|
|
{
|
|
//choose new target randomly
|
|
targetChoice=random(numTargets);
|
|
}
|
|
groupAddGroup(transScout, transTemp);
|
|
//get going to next one!!
|
|
orderGroupLoc(transScout, DORDER_SCOUT, targetX[targetChoice], targetY[targetChoice]);
|
|
}
|
|
|
|
//have Heavies got close to target?
|
|
groupAddArea(transTemp, enemy2, targetX[targetChoice] - 512, targetY[targetChoice] - 512, targetX[targetChoice] + 512, targetY[targetChoice] + 512);
|
|
if (transTemp.members > 0)
|
|
{
|
|
targetChoice = targetChoice + numTargets; //go from near to mid to far
|
|
if (targetChoice >= numTargets * 3)
|
|
{
|
|
//choose new target randomly
|
|
targetChoice=random(numTargets);
|
|
}
|
|
groupAddGroup(transHeavy, transTemp);
|
|
//get going to next one!!
|
|
orderGroupLoc(transHeavy, DORDER_SCOUT, targetX[targetChoice], targetY[targetChoice]);
|
|
}
|
|
|
|
}
|
|
|
|
event transOff(CALL_TRANSPORTER_OFFMAP, enemy2)
|
|
{
|
|
transOnMap = FALSE;
|
|
|
|
}
|
|
|
|
event timeUp(CALL_MISSION_TIME)
|
|
{
|
|
setEventTrigger(wonYetEvnt,inactive);
|
|
setEventTrigger(lostYetEvnt,inactive);
|
|
setEventTrigger(gameLost, gameLostTrig);
|
|
setEventTrigger(timeUp, inactive);
|
|
}
|