Permalink
Browse files

More campaign bug fixing.

cam1-ca: Allow the base building blip to switch on and off depending on the amount of structures there are on the plateau.

cam1-5s: Remove extra eight minutes from insane due to being able to research python in Alpha 8.

cam2-end: Rework some rather ugly looking code. Include a bunker buster template for the heavy ground attackers.

libcampaign: Enemy transporter blips disappear once the transporter exits the map.

cam3-b and cam3-c: Use green for the ally color rather than yellow.
  • Loading branch information...
KJeff01 committed Sep 17, 2017
1 parent 01b4e29 commit 1c1b9c541131f0906ab81c35a1488540a7fa56b9
@@ -3,10 +3,6 @@ include("script/campaign/libcampaign.js");
function eventStartLevel()
{
var ti = camChangeOnDiff(3600); //60 min
if (difficulty === INSANE)
{
ti = ti + 480; //Add an extra eight minutes for insane difficulty.
}
camSetupTransporter(11, 52, 100, 126);
centreView(13, 52);
setNoGoArea(10, 51, 12, 53, CAM_HUMAN_PLAYER);
@@ -4,39 +4,49 @@ include("script/campaign/templates.js");
const landingZoneList = [ "NPLZ1", "NPLZ2", "NPLZ3", "NPLZ4", "NPLZ5" ];
const landingZoneMessages = [ "C1CA_LZ1", "C1CA_LZ2", "C1CA_LZ3", "C1CA_LZ4", "C1CA_LZ5" ];
var baseEstablished;
var blipActive;
var lastLZ, lastHeavy;
var totalTransportLoads;
//See if we have enough structures on the plateau area and toggle
//the green objective blip on or off accordingly.
function baseEstablished()
{
//Now we check if there is stuff built here already from cam1-C.
if (camCountStructuresInArea("buildArea") >= 4)
{
if (blipActive)
{
blipActive = false;
hackRemoveMessage("C1CA_OBJ1", PROX_MSG, CAM_HUMAN_PLAYER);
}
return true;
}
else
{
if (!blipActive)
{
blipActive = true;
hackAddMessage("C1CA_OBJ1", PROX_MSG, CAM_HUMAN_PLAYER, false);
}
return false;
}
}
// a simple extra victory condition callback
function extraVictoryCondition()
{
const MIN_TRANSPORT_RUNS = 10;
var enemies = enumArea(0, 0, mapWidth, mapHeight, ENEMIES, false);
// No enemies on map and at least eleven New Paradigm transport runs.
if ((totalTransportLoads > MIN_TRANSPORT_RUNS) && !enemies.length)
if (baseEstablished() && (totalTransportLoads > MIN_TRANSPORT_RUNS) && !enemies.length)
{
if (baseEstablished) // if base is destroyed later, we don't care
return true;
//Now we check if there is stuff built here already from cam1-C.
if (camCountStructuresInArea("buildArea") >= 4)
{
baseEstablished = true;
hackRemoveMessage("C1CA_OBJ1", PROX_MSG, CAM_HUMAN_PLAYER);
return true;
}
return true;
}
// otherwise returns 'undefined', which suppresses victory;
// returning 'false' would have triggered an instant defeat
}
function eventStructureBuild()
{
// update `baseEstablished' variable instantly
// rather than by timer
extraVictoryCondition();
}
function sendTransport()
{
// start with light forces
@@ -105,7 +115,7 @@ function sendTransport()
function eventStartLevel()
{
totalTransportLoads = 0;
baseEstablished = false;
blipActive = false;
camSetStandardWinLossConditions(CAM_VICTORY_STANDARD, "SUB_1_4AS", {
callback: "extraVictoryCondition"
@@ -126,7 +136,6 @@ function eventStartLevel()
setMissionTime(camChangeOnDiff(1800));
hackAddMessage("MB1CA_MSG", MISS_MSG, CAM_HUMAN_PLAYER, true);
hackAddMessage("C1CA_OBJ1", PROX_MSG, CAM_HUMAN_PLAYER, false);
// first transport after 10 seconds; will re-queue itself
queue('sendTransport', 10000);
@@ -106,22 +106,17 @@ function randomTemplates(list, isTransport)
//Attack every 30 seconds.
function vtolAttack()
{
var vtolPosNorthRoad = {"x": 99, "y": 1};
var vtolPosNorthEast = {"x": 127, "y": 65};
var vtolPosNorthEast2 = {"x": 127, "y": 28};
var vtolPosNorthWest = {"x": 36, "y": 1};
var vtolPosNorthWestLeft = {"x": 1, "y": 28};
const VTOL_POSITIONS = [
{"x": 99, "y": 1},
{"x": 127, "y": 65},
{"x": 127, "y": 28},
{"x": 36, "y": 1},
{"x": 1, "y": 28},
];
var vtolRemovePos = {"x": 127, "y": 64};
var startPos = [];
startPos.push(vtolPosNorthRoad);
startPos.push(vtolPosNorthEast);
startPos.push(vtolPosNorthEast2);
startPos.push(vtolPosNorthWest);
startPos.push(vtolPosNorthWestLeft);
var list; with (camTemplates) list = [commorv, colcbv, colagv, comhvat];
camSetVtolData(THE_COLLECTIVE, startPos, vtolRemovePos, list, camChangeOnDiff(30000));
camSetVtolData(THE_COLLECTIVE, VTOL_POSITIONS, vtolRemovePos, list, camChangeOnDiff(30000));
}
//Every 10 minutes.
@@ -161,7 +156,7 @@ function tankAttack()
var northTankAssembly = {"x": 95, "y": 3};
//var westTankAssembly = {"x": 3, "y": 112}; //This was unused.
var list; with (camTemplates) list = [comhltat, cohact, cohhpv, comagt];
var list; with (camTemplates) list = [comhltat, cohact, cohhpv, comagt, cohbbt];
var pos = [];
pos.push(northTankAssembly);
@@ -296,6 +296,8 @@ function eventStartLevel()
hackAddMessage("CM3B_GAMMABASE", PROX_MSG, CAM_HUMAN_PLAYER, true);
eventVideoDone();
changePlayerColour(GAMMA, 0);
queue("transferPower", 3000);
queue("vtolAttack", camChangeOnDiff(300000)); //5 min
queue("enableAllFactories", camChangeOnDiff(300000)); //5 min
@@ -218,6 +218,7 @@ function eventStartLevel()
eventVideoDone();
setScrollLimits(0, 137, 64, 192); //Show the middle section of the map.
changePlayerColour(GAMMA, 0);
queue("enableAllFactories", camChangeOnDiff(180000)); // 3 min.
queue("setupPatrolGroups", 10000); // 10 sec.
@@ -1084,11 +1084,6 @@ function __camDispatchTransporterUnsafe()
setTransporterExit(data.exit.x, data.exit.y, player);
// will guess which transporter to start, automagically
startTransporterEntry(data.entry.x, data.entry.y, player);
if (camDef(__camTransporterMessage))
{
hackRemoveMessage(__camTransporterMessage, PROX_MSG, 0);
__camTransporterMessage = undefined;
}
return true;
}
@@ -3094,6 +3089,12 @@ function cam_eventTransporterExit(transport)
|| (__camWinLossCallback === "__camVictoryStandard"
&& transport.player === CAM_HUMAN_PLAYER))
{
//Delete any enemy reinforcement transport blips once it exits map.
if (transport.player !== CAM_HUMAN_PLAYER && camDef(__camTransporterMessage))
{
hackRemoveMessage(__camTransporterMessage, PROX_MSG, 0);
__camTransporterMessage = undefined;
}
// allow the next transport to enter
if (camDef(__camIncomingTransports[transport.player]))

0 comments on commit 1c1b9c5

Please sign in to comment.