Skip to content

Commit

Permalink
More campaign bug fixing.
Browse files Browse the repository at this point in the history
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 1c1b9c5
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 43 deletions.
4 changes: 0 additions & 4 deletions data/base/script/campaign/cam1-5s.js
Expand Up @@ -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);
Expand Down
49 changes: 29 additions & 20 deletions data/base/script/campaign/cam1ca.js
Expand Up @@ -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
Expand Down Expand Up @@ -105,7 +115,7 @@ function sendTransport()
function eventStartLevel()
{
totalTransportLoads = 0;
baseEstablished = false;
blipActive = false;

camSetStandardWinLossConditions(CAM_VICTORY_STANDARD, "SUB_1_4AS", {
callback: "extraVictoryCondition"
Expand All @@ -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);
Expand Down
23 changes: 9 additions & 14 deletions data/base/script/campaign/cam2-end.js
Expand Up @@ -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.
Expand Down Expand Up @@ -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);

Expand Down
2 changes: 2 additions & 0 deletions data/base/script/campaign/cam3-b.js
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions data/base/script/campaign/cam3-c.js
Expand Up @@ -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.
Expand Down
11 changes: 6 additions & 5 deletions data/base/script/campaign/libcampaign.js
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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]))
Expand Down

0 comments on commit 1c1b9c5

Please sign in to comment.