Skip to content

Commit

Permalink
Update a couple of Gamma missions.
Browse files Browse the repository at this point in the history
Cam3-2:
- Nexus VTOL units spawn after entering the phantomFacTrigger area.
- Only donate Alpha team to the player once they reach the rescueTrigger
area.
- Increase minimum size of Nexus land reinforcements by two.
- Cyborg phantom factories start immediately.
- SE phantom factory starts as soon as the phantomFacTrigger is entered.
- Reduce timers for the phantom factories.

Cam3-ab:
- Let Nexus say "synaptic links activated" before absorbing stuff.
- Faster Nexus reinforcement spawners. Land unit density is 16-20.
- Require all three resistence research to win.
- At least fifteen land reinforcement runs from Nexus are needed to win.
  • Loading branch information
KJeff01 committed Jan 12, 2018
1 parent 21ca83b commit 493bf7e
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 56 deletions.
83 changes: 48 additions & 35 deletions data/base/script/campaign/cam3-2.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const NEXUS_RES = [
]; ];
var edgeMapIndex; var edgeMapIndex;
var alphaUnitIDs; var alphaUnitIDs;
var startExtraLoss;


//Remove Nexus VTOL droids. //Remove Nexus VTOL droids.
camAreaEvent("vtolRemoveZone", function(droid) camAreaEvent("vtolRemoveZone", function(droid)
Expand All @@ -35,49 +36,41 @@ camAreaEvent("vtolRemoveZone", function(droid)
//groups that are hidden farther south. //groups that are hidden farther south.
camAreaEvent("rescueTrigger", function(droid) camAreaEvent("rescueTrigger", function(droid)
{ {
hackRemoveMessage("C3-2_OBJ1", PROX_MSG, CAM_HUMAN_PLAYER);
camManageGroup(camMakeGroup("laserTankGroup"), CAM_ORDER_ATTACK, { camManageGroup(camMakeGroup("laserTankGroup"), CAM_ORDER_ATTACK, {
regroup: true, regroup: true,
count: -1, count: -1,
morale: 90, morale: 90,
fallback: camMakePos("healthRetreatPos") fallback: camMakePos("healthRetreatPos")
}); });
//Donate All of alpha to the player.
setAlliance(ALPHA, NEXUS, false);
camAbsorbPlayer(ALPHA, CAM_HUMAN_PLAYER);
queue("getAlphaUnitIDs", 2000);
camPlayVideos("MB3_2_MSG4");
}); });


function playVideos() //Warn about VTOLs.
function playVtolWarningVideo()
{ {
camPlayVideos(["MB3_2_MSG3", "MB3_2_MSG4"]); camPlayVideos("MB3_2_MSG3");
} }


//Activate edge map queues and play videos, donate alpha to the player, setup reinforcements. //Activate edge map queues and play videos, donate alpha to the player, setup reinforcements.
camAreaEvent("phantomFacTrigger", function(droid) camAreaEvent("phantomFacTrigger", function(droid)
{ {
queue("phantomFactoryNE", camChangeOnDiff(180000)); //3 min; vtolAttack();
queue("phantomFactorySW", camChangeOnDiff(240000)); //4 min; phantomFactorySE();
queue("phantomFactorySE", camChangeOnDiff(360000)); //6 min;

setAlliance(ALPHA, NEXUS, false);
playSound("pcv456.ogg"); //Incoming transmission... playSound("pcv456.ogg"); //Incoming transmission...
queue("playVideos", 2000); queue("playVtolWarningVideo", 2500);
//Donate All of alpha to the player.
camAbsorbPlayer(ALPHA, CAM_HUMAN_PLAYER);

hackRemoveMessage("C3-2_OBJ1", PROX_MSG, CAM_HUMAN_PLAYER);
queue("getAlphaUnitIDs", 3000);
queue("enableReinforcements", 5000); queue("enableReinforcements", 5000);
}); });


//Get the IDs of Alpha units after they were donated to the player. Set Experience function setAlphaExp()
//while we are at it.
function getAlphaUnitIDs()
{ {
const DROID_EXP = 512; //Hero rank. const DROID_EXP = 512; //Hero rank.
if (!camDef(alphaUnitIDs)) var alphaDroids = enumArea("alphaPit", ALPHA, false).filter(function(obj) {
{ return obj.type === DROID;
alphaUnitIDs = [];
}

var alphaDroids = enumArea("alphaPit", CAM_HUMAN_PLAYER, false).filter(function(obj) {
return (obj.type === DROID);
}); });


for (var i = 0, l = alphaDroids.length; i < l; ++i) for (var i = 0, l = alphaDroids.length; i < l; ++i)
Expand All @@ -87,29 +80,44 @@ function getAlphaUnitIDs()
{ {
setDroidExperience(dr, DROID_EXP); setDroidExperience(dr, DROID_EXP);
} }
}
}

//Get the IDs of Alpha units after they were donated to the player.
function getAlphaUnitIDs()
{
alphaUnitIDs = [];
var alphaDroids = enumArea("alphaPit", CAM_HUMAN_PLAYER, false).filter(function(obj) {
return obj.type === DROID && obj.experience === 512;
});

for (var i = 0, l = alphaDroids.length; i < l; ++i)
{
var dr = alphaDroids[i];
alphaUnitIDs.push(dr.id); alphaUnitIDs.push(dr.id);
} }
startExtraLoss = true;
} }


function phantomFactoryNE() function phantomFactoryNE()
{ {
var list; with (camTemplates) list = [nxcyrail, nxcyscou, nxcylas, nxlflash]; var list; with (camTemplates) list = [nxcyrail, nxcyscou, nxcylas];
sendEdgeMapDroids(4, "NE-PhantomFactory", list); sendEdgeMapDroids(6, "NE-PhantomFactory", list);
queue("phantomFactoryNE", camChangeOnDiff(180000)); //3 min; queue("phantomFactoryNE", camChangeOnDiff(120000)); //2 min
} }


function phantomFactorySW() function phantomFactorySW()
{ {
var list; with (camTemplates) list = [nxcyrail, nxcyscou, nxcylas, nxlflash]; var list; with (camTemplates) list = [nxcyrail, nxcyscou, nxcylas];
sendEdgeMapDroids(6, "SW-PhantomFactory", list); sendEdgeMapDroids(8, "SW-PhantomFactory", list);
queue("phantomFactorySW", camChangeOnDiff(240000)); //4 min; queue("phantomFactorySW", camChangeOnDiff(180000)); //3 min
} }


function phantomFactorySE() function phantomFactorySE()
{ {
var list; with (camTemplates) list = [nxcyrail, nxcyscou, nxcylas, nxlflash, nxmrailh, nxmlinkh]; var list; with (camTemplates) list = [nxcyrail, nxcyscou, nxcylas, nxlflash, nxmrailh, nxmlinkh];
sendEdgeMapDroids(8 + camRand(5), "SE-PhantomFactory", list); sendEdgeMapDroids(10 + camRand(6), "SE-PhantomFactory", list); //10-15 units
queue("phantomFactorySE", camChangeOnDiff(360000)); //6 min; queue("phantomFactorySE", camChangeOnDiff(240000)); //4 min
} }


function sendEdgeMapDroids(droidCount, location, list) function sendEdgeMapDroids(droidCount, location, list)
Expand Down Expand Up @@ -222,14 +230,14 @@ function enableReinforcements()


function alphaTeamAlive() function alphaTeamAlive()
{ {
if (camDef(alphaUnitIDs)) if (camDef(alphaUnitIDs) && startExtraLoss)
{ {
var alphaAlive = false; var alphaAlive = false;
var alive = enumArea(0, 0, mapWidth, mapHeight, CAM_HUMAN_PLAYER, false).filter(function(obj) { var alive = enumArea(0, 0, mapWidth, mapHeight, CAM_HUMAN_PLAYER, false).filter(function(obj) {
return (obj.type === DROID); return obj.type === DROID;
}); });
var allDroidsAtLZ = enumArea("RTLZ", CAM_HUMAN_PLAYER, false).filter(function(obj) { var allDroidsAtLZ = enumArea("RTLZ", CAM_HUMAN_PLAYER, false).filter(function(obj) {
return (obj.type === DROID); return obj.type === DROID;
}); });


for (var i = 0, l = alive.length; i < l; ++i) for (var i = 0, l = alive.length; i < l; ++i)
Expand Down Expand Up @@ -265,6 +273,7 @@ function eventStartLevel()
var lz = getObject("landingZone"); var lz = getObject("landingZone");
var tent = getObject("transporterEntry"); var tent = getObject("transporterEntry");
var text = getObject("transporterExit"); var text = getObject("transporterExit");
startExtraLoss = false;


camSetStandardWinLossConditions(CAM_VICTORY_OFFWORLD, "CAM3A-B", { camSetStandardWinLossConditions(CAM_VICTORY_OFFWORLD, "CAM3A-B", {
area: "RTLZ", area: "RTLZ",
Expand All @@ -283,8 +292,12 @@ function eventStartLevel()
camCompleteRequiredResearch(GAMMA_ALLY_RES, ALPHA); camCompleteRequiredResearch(GAMMA_ALLY_RES, ALPHA);
setAlliance(ALPHA, NEXUS, true); setAlliance(ALPHA, NEXUS, true);
setAlliance(ALPHA, CAM_HUMAN_PLAYER, true); setAlliance(ALPHA, CAM_HUMAN_PLAYER, true);
changePlayerColour(ALPHA, 0);

phantomFactoryNE();
phantomFactorySW();


hackAddMessage("C3-2_OBJ1", PROX_MSG, CAM_HUMAN_PLAYER); hackAddMessage("C3-2_OBJ1", PROX_MSG, CAM_HUMAN_PLAYER);
queue("setAlphaExp", 1500);
queue("setupPatrolGroups", 15000); queue("setupPatrolGroups", 15000);
queue("vtolAttack", camChangeOnDiff(300000)); //5 min
} }
43 changes: 24 additions & 19 deletions data/base/script/campaign/cam3-ab.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const NEXUS_RES = [
"R-Sys-NEXUSrepair", "R-Wpn-Flamer-Damage06", "R-Sys-NEXUSrepair", "R-Wpn-Flamer-Damage06",
]; ];
var edgeMapIndex; var edgeMapIndex;
var edgeMapCounter; var edgeMapCounter; //how many Nexus reinforcement runs have happened.
var winFlag; var winFlag;


//Remove Nexus VTOL droids. //Remove Nexus VTOL droids.
Expand All @@ -32,7 +32,7 @@ camAreaEvent("vtolRemoveZone", function(droid)


function sendEdgeMapDroids() function sendEdgeMapDroids()
{ {
const COUNT = 10 + camRand(6); // 10 - 15. const COUNT = 16 + camRand(5); // 16 - 20.
const EDGE = ["SWPhantomFactory", "NWPhantomFactory"]; const EDGE = ["SWPhantomFactory", "NWPhantomFactory"];
var list; with (camTemplates) list = [ var list; with (camTemplates) list = [
nxcyrail, nxcyscou, nxcylas, nxlflash, nxmrailh, nxmlinkh, nxmscouh, nxcyrail, nxcyscou, nxcylas, nxlflash, nxmrailh, nxmlinkh, nxmscouh,
Expand All @@ -51,32 +51,32 @@ function sendEdgeMapDroids()
droids.push(list[camRand(list.length)]); droids.push(list[camRand(list.length)]);
} }


camSendReinforcement(NEXUS, camMakePos(EDGE[edgeMapIndex]), list, camSendReinforcement(NEXUS, camMakePos(EDGE[edgeMapIndex]), droids,
CAM_REINFORCE_GROUND, { CAM_REINFORCE_GROUND, {
data: {regroup: true, count: -1} data: {regroup: false, count: -1}
} }
); );


edgeMapIndex += 1; edgeMapIndex += 1;
edgeMapCounter += 1;
if (edgeMapIndex === EDGE.length) if (edgeMapIndex === EDGE.length)
{ {
edgeMapIndex = 0; edgeMapIndex = 0;
} }


edgeMapCounter += 1; queue("sendEdgeMapDroids", camChangeOnDiff(180000)); // 3 min.
if (edgeMapCounter === EDGE.length)
{
edgeMapCounter = 0;
}

queue("sendEdgeMapDroids", camChangeOnDiff(240000)); // 4 min.
} }


//Setup Nexus VTOL hit and runners. NOTE: These do not go away in this mission. //Setup Nexus VTOL hit and runners. NOTE: These do not go away in this mission.
function vtolAttack() function vtolAttack()
{ {
var list; with (camTemplates) list = [nxlscouv, nxmtherv, nxmheapv]; var list; with (camTemplates) list = [nxlscouv, nxmtherv, nxlscouv, nxmheapv];
camSetVtolData(NEXUS, "vtolAppearPos", "vtolRemovePos", list, camChangeOnDiff(240000)); //4 min var ext = {
limit: [2, 4, 2, 4],
alternate: true,
altIdx: 0
};
camSetVtolData(NEXUS, "vtolAppearPos", "vtolRemovePos", list, camChangeOnDiff(120000), undefined, ext); //2 min
} }


function powerTransfer() function powerTransfer()
Expand All @@ -88,6 +88,10 @@ function powerTransfer()
function eventResearched(research, structure, player) function eventResearched(research, structure, player)
{ {
if (research.name === "R-Sys-Resistance-Upgrade01") if (research.name === "R-Sys-Resistance-Upgrade01")
{
camSetNexusState(false);
}
if (research.name === "R-Sys-Resistance-Upgrade03")
{ {
winFlag = true; winFlag = true;
} }
Expand All @@ -98,21 +102,23 @@ function hackPlayer()
camHackIntoPlayer(CAM_HUMAN_PLAYER, NEXUS); camHackIntoPlayer(CAM_HUMAN_PLAYER, NEXUS);
if (camGetNexusState()) if (camGetNexusState())
{ {
queue("hackPlayer", 6000); queue("hackPlayer", 5000);
} }
} }


function synapticsSound() function synapticsSound()
{ {
playSound(SYNAPTICS_ACTIVATED); playSound(SYNAPTICS_ACTIVATED);
camHackIntoPlayer(CAM_HUMAN_PLAYER, NEXUS);
} }


//winFlag is set in eventResearched.
function resistanceResearched() function resistanceResearched()
{ {
if (winFlag) const MIN_EDGE_COUNT = 15;
if (winFlag && edgeMapCounter >= MIN_EDGE_COUNT)
{ {
camSetNexusState(false); return true;
return true; //Set in eventResearched().
} }
} }


Expand Down Expand Up @@ -140,10 +146,9 @@ function eventStartLevel()
winFlag = false; winFlag = false;


vtolAttack(); vtolAttack();
camHackIntoPlayer(CAM_HUMAN_PLAYER, NEXUS, true);


queue("powerTransfer", 800); queue("powerTransfer", 800);
queue("synapticsSound", 5000); queue("synapticsSound", 2500);
queue("hackPlayer", 8000); queue("hackPlayer", 8000);
queue("sendEdgeMapDroids", 15000); // 15 sec queue("sendEdgeMapDroids", 15000); // 15 sec
} }
10 changes: 8 additions & 2 deletions data/base/script/campaign/libcampaign.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3014,7 +3014,10 @@ function camHackIntoPlayer(player, to)
camTrace("stealing object: " + obj.name); camTrace("stealing object: " + obj.name);
if (obj.type === STRUCTURE && obj.stattype === HQ) if (obj.type === STRUCTURE && obj.stattype === HQ)
{ {
camSafeRemoveObject(obj, false); if (!donateObject(obj, to))
{
camSafeRemoveObject(obj, false);
}
if (player === CAM_HUMAN_PLAYER) if (player === CAM_HUMAN_PLAYER)
{ {
setMiniMap(false); setMiniMap(false);
Expand All @@ -3023,7 +3026,10 @@ function camHackIntoPlayer(player, to)
} }
else else
{ {
donateObject(obj, to); if (!donateObject(obj, to))
{
camSafeRemoveObject(obj, true); //Explode it then.
}
} }
} }
} }
Expand Down

0 comments on commit 493bf7e

Please sign in to comment.